Skip to content

fix(memory): name a missing or ambiguous match instead of review_changed - #131

Merged
docwilde merged 1 commit into
mainfrom
fix/memory-match-errors
Oct 20, 2026
Merged

docwilde merged 1 commit into
mainfrom
fix/memory-match-errors

Conversation

@docwilde

Copy link
Copy Markdown
Owner

lore memory replace without --match answered review_changed and changed nothing. That code means "the reviewed snapshot changed since you looked", so a caller goes looking for a concurrent writer when the real cause is their own match: an empty --match matches every entry, and the substring path refuses anything but exactly one hit.

The direct path now names the match. A missing or empty --match on memory replace|remove|move and filemap replace|remove is invalid_request, as is a positional argument the subcommand does not take, which the parser used to drop silently. A match that hits no entry is the new match_not_found, one that hits several is match_ambiguous, and memory move --to and project move report an unknown project name the same way. review_changed stays wherever it means a stale snapshot or a concurrent change: the exact replay path used by sync and project move, reviewed --expected writes, pending, the gate and the belief stores.

The stray positionals were worse than a misleading code on the old binary: filemap remove src/a.rs deleted the only row, filemap replace src/b.rs second rewrote it, and memory remove --match old stray applied. All of them are refused now.

Text stays variadic for memory add|replace and filemap add|replace, matching the Python CLI's text nargs="+", so replace --match X old new still writes "old new".

Releases 0.62.25: version in the plugin manifests and Cargo files, and a CHANGELOG entry.

Validation: cargo check --locked --workspace, cargo test --locked (all native suites), the native launcher checks, the 41 Python test files and tests/test_native_interop.py pass locally. New unit tests cover a zero and a two-entry match for memory, move and filemap with the file left unchanged, plus an exact-path miss that still reports review_changed. A CLI test drives the binary through eleven refused forms, including the reported one, and through both new codes. With the fix reverted, the new tests fail with review_changed where they expect the new codes. The built binary, run against a scratch LORE_ROOT, returns invalid_request for the reported call, match_not_found and match_ambiguous for the two misses, and applies a correct --match.

Release LORE 0.62.25. `memory replace --scope project "<old>" "<new>"`
answered `review_changed` and changed nothing: the CLI joins positionals
into the text, so the match stayed empty, matched every entry and the
substring path refused it with the code for a changed reviewed snapshot.
That code sends a caller looking for a concurrent writer or a stale
review, while the cause was their own match.

A substring that hits no entry is now `match_not_found` and one that hits
several is `match_ambiguous` (memory replace/remove/move, filemap
replace/remove, and project-name resolution for `memory move --to`,
`project move` and `backfill --project`). A missing or empty `--match`,
and a positional these commands cannot read, are `invalid_request`; the
old parser dropped them, which let `filemap remove <path>` delete the
only row of a one-row map. `review_changed` stays where something
really changed: the exact review path, exact sync replay, pending
listings and the other snapshot checks.

Verified: cargo check --locked --workspace, cargo test --locked (all
suites), the native launcher smoke test, all 41 Python test files and
tests/test_native_interop.py.
@docwilde
docwilde merged commit a6eb853 into main Oct 20, 2026
3 checks passed
@docwilde
docwilde deleted the fix/memory-match-errors branch October 20, 2026 13:49
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