Skip to content

fix(v0.5.1): round 3 follow-up — fallback_on_error + Import restore + events absolute path#22

Merged
ikeikeikeike merged 3 commits into
mainfrom
patch/v0.5.1-followup
Jun 20, 2026
Merged

fix(v0.5.1): round 3 follow-up — fallback_on_error + Import restore + events absolute path#22
ikeikeikeike merged 3 commits into
mainfrom
patch/v0.5.1-followup

Conversation

@ikeikeikeike

Copy link
Copy Markdown
Member

Summary

v0.5.0 の round 3 review で残った 3 follow-up を集約。 v0.5 plugin contract / SQLite schema 不変、 drop-in upgrade。

internal/instinct.New が 4 引数化 (= fallback backend optional)。 internal package なので外部 caller への影響なし。

Test plan

  • go test ./... 全 green (= unit + conformance memory + sqlite + cli + instinct)
  • golangci-lint run 0 issues
  • sqlite_regression_test.go round-trip YAML/JSONL = Forget → Import で row 復元 assert
  • coordinator_fallback_test.go 4 path (= recovers / disabled / nil fallback / both fail)
  • events_test.go 3 case (= relative reject / empty reject / absolute success)

Refs: v0.5.0 round 3 review (= #21https://github.com/ikeikeikeike/bough/releases/tag/v0.5.0 で ship 済)

NewEventWriter now rejects relative paths up front with a clear
error pointing the caller at the monorepo root resolution path.
Two worktrees (or a CI step + a dev shell) used to race on a
cwd-relative .bough/memory/events.jsonl when one ran from the
monorepo root and the other from a worktree subdirectory.

docs/INSTINCTS.md gains an Audit log section documenting the
absolute-path contract and the default location.
…#15 + #17)

MEDIUM #15: coordinator.Query now consumes instinct.fallback_on_error.
On a primary backend error with the flag set and a fallback
backend wired in, the same QueryReq is replayed against the
fallback and a query_fallback audit event is emitted. v0.5 ships
only SQLite so callers pass nil for fallback (= no-op pass-through);
v0.6 wires mem0 + SQLite together and the flag starts mattering.

MEDIUM #17: sqlite.Import used to walk the YAML / JSONL payload
and increment counters without ever re-Storing the rows, so an
Import after Forget left the table empty. The new
parseExportedYAML / parseExportedJSONL helpers reconstruct
memapi.Instinct records and route each through the same Store
path the host uses for fresh ingest (UpsertSemantics=true). The
CLI reports imported / upserted / skipped so an operator can
confirm the round-trip.

LOW #18 follow-on: loadInstinctCoordinator anchors the default
.bough/memory/events.jsonl against the monorepo root the
loadConfigAndRoot helper resolves. Combined with the
NewEventWriter absolute-path requirement landed in the previous
commit, the CLI now writes to the same file regardless of cwd.

instinct.New takes a fourth parameter (fallback) — the package is
internal so callers outside the repo are not expected; v0.5.1
stays a drop-in upgrade for plugin authors and end users.
CHANGELOG documents the three follow-up fixes and notes that
v0.5.0 -> v0.5.1 is a drop-in upgrade (MemoryBackend interface,
schema, and plugin binaries all unchanged).

sqlite_regression_test.go adds two round-trip tests
(TestImport_RestoresRows_YAML / TestImport_RestoresRows_JSONL)
that seed a row, Export, Forget it to be sure, Import, and verify
the row is queryable again — the assertion the old conformance
test (which only checked ImportedCount > 0) failed to catch.
@ikeikeikeike
ikeikeikeike merged commit 5846c12 into main Jun 20, 2026
12 checks passed
@ikeikeikeike
ikeikeikeike deleted the patch/v0.5.1-followup branch June 28, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant