Repository navigation
[engine] fix: strict uuid pg_ids, case-insensitive lookups, strict reads on delete paths - #65
Merged
Merged
Conversation
…ads on delete paths
- validPgIds / valid_pg_ids: only real 8-4-4-4-12 uuids join the thermal
batch, lower-cased. One id that passed the old [0-9a-fA-F-]{36} filter but
failed Postgres's ::uuid cast failed the whole batch, and every memory fell
back to frontmatter ranking. Rejects are counted on stderr (count only).
- Lookups compare lower-case on both sides, so a hand-edited upper-case pg_id
resolves instead of ranking as an orphan.
- findFilesByPgId (which picks the files `forget` and the rename sweep
DELETE) reads pg_id with readFrontmatterField(..., { strict: true }): a real
`---` block (LF or CRLF), top-level key only, no 800-char or nested fallback,
no regex built from the id, and an empty id matches nothing.
- memory_dedup.read_fm gains the same strict mode, used by main(), whose
T1/T2 results are deleted under --apply. Index ranking stays lenient in both.
Behaviour changes: a file whose only pg_id is in the body, nested, or after
an unclosed fence is no longer deleted (memory_dedup reports it as T4); a
case variant or quoted value of the same id now is. In memory_dedup an
upper-case pg_id of a live entity moves from T4 to KEEP/T1/T2 by the usual
rules.
Tests: vitest 729 passed (+7 skipped), pytest 360 passed. 9 new tests fail on
main. Mutants killed: Python 6/7 (survivor: CRLF opening fence, equivalent
because read_text normalises newlines), TS 3/4 (survivor: trim of the id,
equivalent for ids from Postgres).
Gate: Full, 6 reviewers + disclosure reader, 2 rounds. Fixed: lenient reader
on the dedup delete path, misleading comment, docstrings, `---foo`/quoted/BOM
cases, strict key requiring the colon right after it (as in TS). Declined:
splitting the strict flag into a second function (internal; both twins share
the shape). mypy findings unchanged from main.
|
Reviewed the diff in
Verdict: PASS ccebfac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
validPgIds/valid_pg_ids): only real 8-4-4-4-12 uuids join the thermal batch. One id that passed the old[0-9a-fA-F-]{36}filter but failed Postgres's::uuidcast failed the whole batch, so every memory fell back to frontmatter ranking. Rejects are counted on stderr (count only).pg_idresolves instead of ranking as an orphan.findFilesByPgId(used byforgetand the rename sweep) andmemory_dedup.py main()(whose T1/T2 are deleted under--apply) only accept a top-levelpg_idinside a real---block (LF or CRLF). No 800-char fallback, no nested match, no regex built from the id, and an empty id matches nothing. Index ranking stays lenient.Behaviour changes
pg_idis in the body, nested under another key, or after an unclosed fence is no longer deleted (memory_dedupreports it as T4_REVIEW).memory_dedup, an upper-casepg_idof a live entity moves from T4 to KEEP/T1/T2 by the usual rules.Tests
main.read_text; ids from Postgres are never padded).