Skip to content

Freeze the memory migration artifacts v0.1.1 to v0.3.0 wrote and apply, verify and roll them back with the current commands (#271) - #326

Merged
memtomem merged 3 commits into
mainfrom
test/frozen-memory-migration-271
Nov 19, 2026
Merged

memtomem merged 3 commits into
mainfrom
test/frozen-memory-migration-271

Conversation

@memtomem

Copy link
Copy Markdown
Owner

Refs #271 (Memory family, part 2b). Follows #321 (Mem0 and LangGraph stores) and #317 / #319 (memtomem stores). With this PR every Memory row of the persisted-contracts doc is frozen.

What this freezes

The artifacts syncmill memory migration writes (manifest.json, snapshot.json, state.json, receipt.json, rollback.json, the materialized sources/, from v0.2.0 the .lock), and the stores they were planned from and written into. Each release's own CLI wrote all of them, for v0.1.2, v0.1.4 and v0.3.0:

  • three sources (memtomem, Mem0, LangGraph), each holding a route run, a finished board run, and three rows in each state namespace;
  • one destination per direction. Each state's artifact selects only its own namespace, so the states share a destination; verified uses the default selection, which no state namespace overlaps;
  • every state for every destination backend: planned; crashed before the first ledger write and after one (os._exit in place of that state.json write); partial (the destination put raised); verified; verification_failed (a target deleted through the release's own adapter, then verify); rolled_back; rollback_partial (a target rewritten in place, then rollback). The resume states are also frozen for the other source into memtomem, and every direction is frozen at least planned and verified. 33 artifacts per release.

v0.1.1 wrote schema 1 artifacts, with no destination binding. Two of them (planned, applied) are frozen under legacy/.

Release differences are frozen as written:

v0.2.0 and v0.1.3 are not frozen. Their migration code, adapters and SDK locks are byte-identical to v0.3.0 and v0.1.4.

How the tests hold HEAD to them

  • Default suite, no SDK:
    • _load of every released artifact, field by field.
    • Each record's digest and lineage, source_digest, the target ids and the destination binding, recomputed by HEAD.
    • Each snapshot against the source store, read with the standard library, and the selection rule written out.
    • Every destination row the release wrote, recorded or not, against its record: timestamp per writing memtomem, migration metadata, materialized source bytes.
    • Each state's ledger, errors, receipt and rollback record.
    • v0.1.1: refused by _load, and by apply / verify / rollback with the exact messages. The only new file is an empty 0600 .lock.
  • Real SDKs (SYNCMILL_TEST_MEMORY_BACKENDS_REAL=1, added to the memory-backends-real CI job). The tests rebind a copy first: memtomem's source_file, each manifest's target_storage_digest (first recomputed for the release's own path), and a check that every row moved and the FTS mirror agrees. Then HEAD's CLI:

Findings (filed; #271 changes no reader)

Verification

  • suite-run: CLEAN. 42 default tests pass. Real SDKs: 124 passed locally. The documented smoke command (2a's file plus this one) exits 0.
  • 23 mutations of memory_migration.py each fail a test, with an assertion or a refusal the test expects. They cover:
    • the target id formula, lineage, aggregate order, both binding locators, the digest check in _load;
    • the scratch exclusion, Mem0 reconciliation, the rollback and verify digest checks, memtomem created_at, root tightening;
    • the ledger skip, the memtomem and LangGraph existing-id guards, storage validation, the memtomem records' timestamps, the empty-destination check;
    • both v1 refusals, Mem0 lineage and LangGraph digest metadata, and CRLF in the materialized source.
  • Review: design 2 rounds (r1 11 Major, all held; r2 2 Major, 1 from an r1 amendment). Implementation r1: 5 findings, none from earlier fixes, all fixed in the second commit. Implementation r2: SHIP.
  • gitleaks: 476 commits scanned, no leaks, with the new .gitleaks.toml. Without it, 295 generic-api-key findings, all on the lineage_key line of the frozen snapshot.json files: a sha256 the release wrote, which cannot be reshaped. The allowlist targets only that rule, that line and those files. Checked in a scratch repository: the same digest in another file, and another key in those files, are still reported.
  • Not verified locally: Linux reading the macOS-written stores. The CI job shows it.

🤖 Generated with Claude Code

memtomem and others added 3 commits November 19, 2026 23:15
…y, verify and roll them back with the current commands (#271)

The release's own CLI writes every migration state per destination backend
(planned, crashed before and after the first recorded write, partial,
verified, verification_failed, rolled_back, rollback_partial) from memtomem,
Mem0 and LangGraph sources into a shared destination per direction, for
v0.1.2, v0.1.4 and v0.3.0, plus v0.1.1's two schema 1 artifacts. The default
suite checks them with the standard library and HEAD's pure functions; the
real suite runs HEAD's `memory migration` commands on rebound copies, and
`--from memtomem` over the stores Memory-1 froze.

Findings filed while freezing, pinned as measured where a test reaches them:
#322, #323, #324, #325. No reader changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ebinding moved every row (#271)

Review round 1 of the Memory-2b freeze: the real tests now hold HEAD-written
Mem0 and LangGraph rows to their migration id, lineage and digest, and
HEAD-written memtomem rows to their materialized source path and bytes; the
crashed states' unrecorded rows get the same check as recorded targets (in the
generator too); memtomem rebinding requires every row to move and the FTS
mirror to agree; the Memory-1 `--from memtomem` copies are rebound first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts (#271)

The snapshots a released syncmill wrote record each row's lineage_key, a
sha256 the generic-api-key rule reads as a token (295 findings, all in
tests/fixtures/persisted/memory/migration/**/snapshot.json). The frozen bytes
cannot change, so one allowlist on top of the default rules skips that rule
only on a lineage_key line of exactly those files; the same digest elsewhere,
or another key in those files, is still reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@memtomem
memtomem merged commit 56064c5 into main Nov 19, 2026
14 checks passed
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