PR 1/N: version the Deck schema + migrator at store boundary#5
Merged
karthikmudunuri merged 1 commit intokarthikmudunuri/slidewise-pptx-fidelityfrom May 4, 2026
Conversation
Adds a `version: number` field on Deck and a migrator chain that runs
on every external Deck before it enters the editor store. Lets us
evolve the persisted schema without breaking hosts that pin an older
@textcortex/slidewise.
* src/lib/schema/migrate.ts — exports CURRENT_DECK_VERSION (= 1) and
migrate(input). Walks the MIGRATIONS table forward from the
deck's version to current, throws on bogus input, throws if the
deck was written by a newer Slidewise (host should upgrade rather
than silently render a degraded version).
* createEditorStore() and setDeck() now run migrate() so PPTX import,
JSON import, localStorage hydration, host props, and seed all
pass through the same gate.
* parsePptx() and seedDeck stamp the current version on output so
callers don't need to migrate after.
* Roundtrip test fixtures get the version field.
* New unit tests for migrate(): v0 → v1 stamping, current-version
pass-through, future-version rejection, bad input rejection,
no-mutation guarantee.
Future schema changes register a migrator at MIGRATIONS[oldVersion]
and bump CURRENT_DECK_VERSION; migrators are append-only and never
deleted, since published decks may still be at any historical version.
This was referenced May 4, 2026
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.
First PR in the integration plan (.context/integration-plan.md). Stacked on top of #4 — review/merge that first.
Summary
Adds a
version: numberfield onDeckand a migrator chain that runs on every external Deck before it enters the editor store. Lets us evolve the persisted schema without breaking hosts that pin an older@textcortex/slidewise.What changes
src/lib/schema/migrate.ts— exportsCURRENT_DECK_VERSION = 1andmigrate(input). Walks theMIGRATIONStable forward from the deck's version to current. Throws on bogus input. Throws if the deck was written by a newer Slidewise (host should upgrade rather than silently render a degraded version).createEditorStore()andsetDeck()runmigrate()so PPTX import, JSON import, localStorage hydration, host props, and seed all pass through the same gate.parsePptx()andseedDecknow emit current-version decks so callers don't need to migrate after.How future schema changes work
CURRENT_DECK_VERSION.MIGRATIONS[oldVersion] = (deck) => …returning the new shape.setDeckor mounts the editor with a stale persisted deck migrates transparently.Migrators are append-only and never deleted, since published decks may still be at any historical version.
Test plan
npx tsc -bcleannpx vitest run— 13/13 (6 roundtrip + 7 new migrator tests)