fix(cli): accept v0.0.13/v0.0.14 schema fingerprints as legacy v0 - #465
Open
alan-roe wants to merge 2 commits into
Open
fix(cli): accept v0.0.13/v0.0.14 schema fingerprints as legacy v0#465alan-roe wants to merge 2 commits into
alan-roe wants to merge 2 commits into
Conversation
Stores created by v0.0.13 or v0.0.14 carry schema fingerprints (ea2d7ee4f385544e / 06d3f9912027129b) that were never registered in the local-schema history, so 'maple schema plan' fails with 'the store fingerprint ... is not registered' and those stores are locked out of the v0->v5 migration chain entirely. The v0.0.12->v0.0.14 DDL delta touches only derived tables/MVs (raw tables are byte-identical), and the legacy->v1 migration replays only the six raw tables, so the existing v0 edge is correct for all three schemas. - register the three fingerprint/projectRevision variants on the v0 history entry - classify any registered variant as legacy v0 in identityFromMarker and resolveMigrationChain (unknown fingerprints still fail closed) - accept a registered variant as the journal's source identity when validating the chain's first step (the frozen legacy edge records the canonical v0 identity; the journal records the marker as found) Verified end-to-end on a production v0.0.14 store: plan resolves v0->v5 and migrate promotes cleanly.
…ntity history The append-only gate (scripts/check-local-schema-manifest.ts) compares every existing LOCAL_SCHEMA_HISTORY entry against the base branch byte-for-byte, so adding a variants field inside the v0 entry tripped it. The variant list now lives in schema-identity.ts as its own constant; the history array is byte-identical to main.
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.
Problem
Stores created by v0.0.13 or v0.0.14 cannot enter the versioned local-store migration chain. Only the v0.0.12 schema fingerprint (
428701854f9fd30e) is registered as legacy v0, somaple schema planon a store born on a later pre-migration release fails with:Computed with the repo's own
schemaFingerprintover each tag'slocal-schema.sql: v0.0.12 →428701854f9fd30e, v0.0.13 →ea2d7ee4f385544e, v0.0.14 →06d3f9912027129b.Since
maple startfails closed on a non-current identity (correctly), the only path such a deployment has ismaple reset— full data loss, exactly what the migration system exists to avoid.Why widening is safe
The v0.0.12→v0.0.14 DDL delta touches only derived state (
alert_checkscolumns,service_map_db_*_hourlyMV reworks, the newservice_operations_minutelytable+MV). The six authoritative raw tables are byte-identical across all three schemas, andlegacy-to-current.tsreplays only those raw tables (derived state is rebuilt;alert_checks/session tables stay with the retained rollback source). So the existing frozen v0→v1 edge is already correct for all three sources — they just weren't registered.Changes
local-schema-history.ts: the v0 entry carries three frozen fingerprint/projectRevision variantsschema-identity.ts:LEGACY_SCHEMA_VARIANTS/LEGACY_SCHEMA_FINGERPRINTS/legacyLocalSchemaIdentitylocal-store-migrations.ts:identityFromMarkerandresolveMigrationChainclassify any registered variant as legacy v0; unknown fingerprints still fail closedassertJournalChainInvariantsnow accepts any registered v0 variant for that one comparison (sourceMatchesFirstStep); everything else stays strictplanMigrationv0→v5 for every variant, unknown-fingerprint rejectionVerification
bun test test/local-store-migrations.test.ts— 18 pass;tsc --noEmitcleanschema planresolves the full v0→v5 chain andschema migrate --yespromotes cleanly (all 5 steps verified), raw telemetry intact, stock v0.0.18 binary serves the migrated storeNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.