feat(memory): add V1 migration audit and deprecation guidance - #77
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Deprecate json-v1 and shadow-v2 in favor of sqlite-v2-opt-in with explicit no-removal-date guidance, and make /memory audit-migration read-only and inspection-first so absent, invalid, and unreadable V1 records are reported distinctly before any V2 acquisition. Reconcile V1 evidence against descriptor-bound versioned hashes with containment checks and fail-closed, token-owned cross-process locking so pruning never acts on unverifiable or inherited stale verdicts. Validate V1->V2 migration deterministically by reconstructing every source-derived task and observation event and comparing full normalized headers and payloads, closing the first two Gate 0 removal-readiness blockers documented in docs/memory-v1-removal-readiness.md.
…ip validation The V1->V2 import now runs before the query-id check and fails closed against a stateless stub, so update the stale coordinator expectation to the deterministic 'migration-failed' reason while keeping the no-context/no-parity safety invariant. Split validatedMigrationOwnedMarkerMetadata's inline check chain into focused boolean predicate helpers; semantics are unchanged.
The Bun SQLite backend persists event payloads via stableJson (recursive key sort) and export() re-parses from that sorted JSON, so record-valued marker fields like sourceItemCounts round-trip in sorted key order while the in-memory draft keeps insertion order. equalEventDraft's naive JSON.stringify comparison therefore always reported imported-body-mismatch on the real provider. Canonicalize both sides (recursive key sort, arrays keep order) so comparison is by content, letting import return 'imported' and audit report 'exact'. Adds a regression test mimicking the stableJson round-trip, hoists the loop-invariant getV1MigrationIdentity out of findMigrationMarker's reservation loop, and documents hashToken truncation collision tolerance.
Seed a V1 task-memory record, import it into V2 through the real Bun SQLite backend against a temp project, and assert the migration audit certifies an exact result with matching sourceItemCounts. This exercises the canonicalizeForCompare key-order round-trip end to end: the backend persists event payloads via key-sorted stableJson, so the re-read marker arrives with sorted record keys while the in-memory draft keeps insertion order.
The sdk-side test reached into cli internals via a cross-package relative path to import the Bun SQLite backend, which a reviewer advisory flagged as fragile. Colocating the test with the existing cli backend test makes the backend import package-local; the migration and V1-store modules are still exercised from sdk source.
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.
Summary
/memory audit-migrationCLI flowMigration safety
exactis lossless only with zero omissions, truncations, and warningsnot-migratedmeans removal is not ready; it is not treated as a product defectValidation
check:ci-localpassed, including 1,245 agents/common testsThis change is