Skip to content

memory: synthetic state-change regression test, and pin graphSearch project isolation - #429

Merged
currentbits merged 3 commits into
mainfrom
coder/memory-synthetic-state-change-regression-a73cec
Aug 18, 2026
Merged

currentbits merged 3 commits into
mainfrom
coder/memory-synthetic-state-change-regression-a73cec

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes #312.

Public memory-system benchmarks are vendor-run and LLM-judge-noisy, so #312 asked for a cheap deterministic synthetic test instead. This adds it, plus one gap found while auditing the scenarios the issue wanted it extended to.

New: memory-server/test/state-change.test.js (3 tests)

The state change the issue describes: store "Project X uses Postgres", supersede it with "migrated from Postgres to MySQL on 2026-03-04", then assert the new fact wins and the old one survives only as history.

  • The successor is a live hit on search, recent, bootstrap and graphSearch; the predecessor appears on none of them, and the old claim text never surfaces in a live excerpt.
  • get(oldId) returns only {superseded_by, hint} — title and body are undefined. The predecessor is reachable only by following the pointer.
  • A three-step chain A→B→C: only C is live, and walking A's pointers reaches C. memory.test.js previously only covered a single hop.
  • supersede on an already-superseded id throws.

Changed: memory-server/test/project-key.test.js (+1 test)

The issue also asked to extend to near-dup rejection, invalidation tombstoning, scope isolation (#179) and bootstrap budget. All four were already covered — by dedup.test.js, resolve.test.js, project-key.test.js and memory.test.js respectively — so rather than duplicate them this audits them for holes. One was real:

search() fuses graph, vector and FTS candidates and re-scores them at memory-server/src/memory.js:913 with liveSql('e') and no projectScopeSql. Project isolation on the graph and vector paths therefore rests entirely on the filters inside graphSearch (:645) and vectorSearch (:701). The existing #179 tests never seed entities, so nothing exercised the graph path at all — deleting the :645 filter would leak a sibling project's entries through fusion with the whole suite still green.

This is not a live bug; both filters are present and correct today. The new test seeds one entity mentioned by entries in two different projects and asserts graphSearch(..., 'coder') returns only the coder row. It was mutation-checked: with the :645 filter removed it fails with graphSearch leaked out of project: ["Other hidden graph target","Coder hidden graph target"].

Notes

  • Tests only, no production code touched.

  • cd memory-server && node --test test/*.test.js → 164 pass, 0 fail.

  • No CI change needed; the root npm test already globs memory-server/test/*.test.js.

  • PR created by the Claude Code agent

Willem added 3 commits August 18, 2026 08:23
Inject a Postgres→MySQL supersede and assert the successor wins on
search/recent/bootstrap, history is pointer-only, a three-step chain
walks A→B→C, and re-superseding a dead id throws.
search() fusion re-applies liveSql but not projectScopeSql, so a missing
filter on graphSearch would leak a sibling that shares an entity. The
existing narwhal cases never seed entities and would not catch that.
…into coder/memory-synthetic-state-change-regression-a73cec
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit 3a303a3 into main Aug 18, 2026
1 check failed
@currentbits
currentbits deleted the coder/memory-synthetic-state-change-regression-a73cec branch October 3, 2026 16:07
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.

Memory: synthetic state-change regression test

1 participant