You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Memory: synthetic state-change regression test #312
From the memory-systems research: every public benchmark number in this space is vendor-run and judge-noisy (Mem0's own scorer has a refusal-matcher bug; rankings flip with memory tenure). The recommended alternative is a cheap synthetic test immune to judge variance.
For memory-server: inject a state change ('project X migrated from Postgres to MySQL on date D' as a supersede), then later query current state and assert the new fact wins and the old one is only reachable as history. Extend to: near-dup rejection, invalidation tombstoning, scope isolation (#179 regression), and bootstrap budget behavior. Runs in CI against a scratch DB.
bootstrap budget → memory.test.js ("bootstrap budgets drop whole entries from the end")
The genuinely uncovered part is the one the issue leads with: the end-to-end state change itself. memory.test.js only asserts supersede marks old and returns new id — nothing covers a multi-step supersede chain, or that the predecessor is excluded from every read surface while staying reachable as history via the superseded_by pointer.
So: one new test/state-change.test.js for the supersede scenario, plus an audit of the other four for real holes (particularly whether liveSql()/projectScopeSql() are applied on graphSearch and vectorSearch, not just search/recent/bootstrap). No CI change needed — npm test already globs memory-server/test/*.test.js.
Done on coder/memory-synthetic-state-change-regression-a73cec (2 commits, local — not pushed yet).
New: memory-server/test/state-change.test.js (3 tests) — the synthetic state change the issue asks for. Store "Project X uses Postgres", supersede with "migrated from Postgres to MySQL on 2026-03-04", then assert:
successor is a live hit on search, recent, bootstrap and graphSearch; 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/body are undefined, so the predecessor is reachable only as a history pointer
a three-step chain A→B→C: only C is live, and walking A's pointers reaches C
supersede on an already-superseded id throws
The other four scenarios were already covered, so rather than duplicate them the second worker audited them and found one real hole, now pinned in project-key.test.js:
search() fuses graph + vector + FTS candidates and re-scores them at src/memory.js:913 with liveSql('e') only — no projectScopeSql. Project isolation on those two paths 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: dropping the filter at :645 would have leaked a sibling project's entries through fusion with every existing test still green.
No bug today — both filters are present and correct. The new test seeds a shared entity across two projects and asserts graphSearch('…', 'coder') returns only the coder row. Mutation-checked: removing the :645 filter fails it with graphSearch leaked out of project: ["Other hidden graph target","Coder hidden graph target"].
Full suite: 164 pass, 0 fail (cd memory-server && node --test test/*.test.js). No CI change needed — the root npm test already globs memory-server/test/*.test.js.
Activity
currentbits commentedon Aug 18, 2026
Scoping note before implementation.
Four of the five listed scenarios already have tests in
memory-server/test/:dedup.test.js(block at ≥0.7,forcebypass, warn band, semantic near-dup)resolve.test.js("tombstones the older loser and hides it from search/recent/bootstrap")project-key.test.js, describememory is project-scoped (no global leakage)memory.test.js("bootstrap budgets drop whole entries from the end")The genuinely uncovered part is the one the issue leads with: the end-to-end state change itself.
memory.test.jsonly assertssupersede marks old and returns new id— nothing covers a multi-step supersede chain, or that the predecessor is excluded from every read surface while staying reachable as history via thesuperseded_bypointer.So: one new
test/state-change.test.jsfor the supersede scenario, plus an audit of the other four for real holes (particularly whetherliveSql()/projectScopeSql()are applied ongraphSearchandvectorSearch, not justsearch/recent/bootstrap). No CI change needed —npm testalready globsmemory-server/test/*.test.js.currentbits commentedon Aug 18, 2026
Done on
coder/memory-synthetic-state-change-regression-a73cec(2 commits, local — not pushed yet).New:
memory-server/test/state-change.test.js(3 tests) — the synthetic state change the issue asks for. Store "Project X uses Postgres", supersede with "migrated from Postgres to MySQL on 2026-03-04", then assert:search,recent,bootstrapandgraphSearch; predecessor appears on none of them, and the old claim text never surfaces in a live excerptget(oldId)returns only{superseded_by, hint}—title/bodyareundefined, so the predecessor is reachable only as a history pointersupersedeon an already-superseded id throwsThe other four scenarios were already covered, so rather than duplicate them the second worker audited them and found one real hole, now pinned in
project-key.test.js:search()fuses graph + vector + FTS candidates and re-scores them atsrc/memory.js:913withliveSql('e')only — noprojectScopeSql. Project isolation on those two paths rests entirely on the filters insidegraphSearch(:645) andvectorSearch(:701). The existing #179 tests never seed entities, so nothing exercised the graph path at all: dropping the filter at:645would have leaked a sibling project's entries through fusion with every existing test still green.No bug today — both filters are present and correct. The new test seeds a shared entity across two projects and asserts
graphSearch('…', 'coder')returns only the coder row. Mutation-checked: removing the:645filter fails it withgraphSearch leaked out of project: ["Other hidden graph target","Coder hidden graph target"].Full suite: 164 pass, 0 fail (
cd memory-server && node --test test/*.test.js). No CI change needed — the rootnpm testalready globsmemory-server/test/*.test.js.currentbits commentedon Aug 18, 2026
PR: #429