Skip to content

Drop the legacy local practice Y.Doc loader and its Dexie tables #802

Description

@InfinityBowman

The local practice plane keeps two generations of legacy data machinery whose rollback windows have closed. With the schema-migration replay in place (the PR stacked on #800), local rows follow the same mechanism as online rows, and this is the remaining local-only surface.

What to remove

  • packages/web/src/project/localProject.ts: everything except LOCAL_PROJECT_ID and LOCAL_REVIEWER_ID. The localChecklists flat-row import (migrateLocalChecklistsToYDoc, the buildStudyForLocalRow family, the text seeding), and loadLegacyLocalRows. Move the two constants somewhere without the yjs and y-dexie imports.
  • rowsFromLocalDoc in localCollections.ts, and the yjs import there.
  • packages/web/src/project/localProject.test.ts (tests the round-trip of the flat-row import).
  • packages/web/src/dev/legacy.ts and its window.__devLegacy seam in dev/expose.ts.
  • packages/web/e2e/flat-key-migration.spec.ts.
  • packages/web/src/primitives/useProject/flatKeyMigration.ts and the checklist handlers under primitives/useProject/handlers/ if nothing else imports them (the commit that moved the write path onto the outbox kept them only for the legacy conversion).
  • The ConnectionPool.initializeLocalRows fallback that calls the loader when no localProjects row exists. A device with no row starts empty.

Dexie

  • Add a schema version that drops the projects ydoc table and localChecklists (this.version(5).stores({ projects: null, localChecklists: null })).
  • Remove the yDexie addon and the y-dexie dependency once no table declares a Y.Doc column. Check whether Dexie needs the addon to parse the historical version 1 declaration on existing databases before removing it.
  • Update db.on('ready') and clearAllData, which reference the projects table and the local Y.Doc row, and the glossary entries for projects and localChecklists.
  • localChecklistPdfs stays: it is live storage for practice PDFs.

Risk

Any device that has not opened the app since the row-plane cutover (the localProjects table shipped in Dexie version 3) would lose local practice data it never converted. Decide on a cutoff and say so in the release notes.

Refs #791.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions