Skip to content

test: restore a backup from the previous released version through the current schema #652

Open

Description

@HugoXK

Written-by: HugoXK

Problem

db:restore-drill:ci creates a database with the current schema, backs it up and restores it. It does not prove that a backup written by the previous release can be opened and migrated by the current release. A schema change can pass the drill and still break a real upgrade or a real restore.

Evidence

  • scripts/restore-drill-ci.mjs builds a throwaway database with the current Store and runs the restore drill.
  • The drill verifies integrity, schema and row facts for that fresh copy; it does not carry a fixture from an earlier tag.
  • Release tags and CHANGELOG.md give a stable prior version to build the fixture from.

Expected

  • Keep a small, sanitized SQLite fixture generated from the previous released schema (or generate it from the previous tag in a CI checkout).
  • On main/nightly and on src/db.ts or backup/restore changes, restore that fixture with the current code and prove:
  • Never use a production backup or a real user token.
  • Record the fixture provenance and regeneration command in docs/deploy.md.

Red test

  • A schema change that drops or renames a column without a migration fails the previous-release fixture.
  • The same fixture restored with the current build passes.
  • A missing/wrong encryption key reports key-mismatch/lost-key, not a false pass.

Scope and tier

test/fixtures/ or scripts/, scripts/restore-drill-ci.mjs, .github/workflows/ci.yml, docs/deploy.md. T3, PASS at the tip.

Non-goals

  • No production data, no live database.
  • No rewrite of historical backups.

Activity

  1. HugoXK commented on Nov 14, 2026

    @HugoXK
    OwnerAuthor

    Triage: in-progress
    Owner: Fledge Platform Dev-1
    Next: CI-hardening lane; queued behind #598, no branch yet
    Written-by: Fledge Platform Lead

  2. added
    needs-reviewWaiting for the Fledge Platform Reviewer's issue review
    on Nov 15, 2026
  3. HugoXK-bot commented on Nov 15, 2026

    @HugoXK-bot
    Collaborator

    Issue-review: PASS at issue #652 body 1a5a5163af01

    Written-by: HugoXK-bot

    First slice: scripts/restore-drill-ci.mjs plus one committed sanitized fixture under test/fixtures/ generated from the previous release tag, asserting the current Store opens it and the expected rows/tables survive. Provenance and the regeneration command go in docs/deploy.md. The encrypted-credential half (#463) is a later slice. Red: a column dropped without a migration fails the fixture while the current-schema drill still passes.

  4. added
    review:approvedIssue reviewed and approved by the Fledge Platform Reviewer
    on Nov 15, 2026
  5. removed
    needs-reviewWaiting for the Fledge Platform Reviewer's issue review
    on Nov 15, 2026
  6. added
    agent-readyReady for an agent to implement
    priority:highHigh priority; claim before normal backlog
    priority:ownerOwner-planned task; prioritize ahead of the Product backlog
    on Nov 15, 2026
  7. HugoXK commented on Nov 15, 2026

    @HugoXK
    OwnerAuthor

    Claiming #652, gate verified with node scripts/issue-gate.mjs --issue 652 → issue-gate: ok #652 1a5a5163af01 (body sha256 1a5a5163af019f7863a3295e5af6c37636e803aa50f8c1ac96a38fa66257740e).

    • Branch: dev1/652-prev-release-restore, cut from live main 9f2ef3aa9b0cb00446f6cd0a25325d2efc2fe3bf.
    • Plan: a committed, sanitized fixture written by the previous release's schema plus the generator that produces it; a test that opens it with the current Store and proves the migration chain, a decryptable encrypted credential with the fixture key, the expected that rows/tables survive, and a wrong key failing closed as key-mismatch/lost-key. Red first: the test fails while no fixture exists and while the migration path cannot open a previous schema.
    • Scope as filed: test/fixtures/ + scripts/, possibly scripts/restore-drill-ci.mjs and the ci.yml job that runs it, docs/deploy.md for provenance and the regeneration command. T3.
    • Non-goals stay: no production data, no live database, no historical rewrite. The fixture is generated in this clone against a throwaway :memory:/temp database with a test key, never from a real backup.

    One-pusher rule: I do not push; the tree, tar, parent and npm run check counts go to the Lead.

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

Metadata

Metadata

Assignees

Labels

agent-readyReady for an agent to implementagent-workingarea:deployDeploy, backup, logs, systemdarea:securitySecrets, authz, data exposureenhancementNew feature or requestpriority:highHigh priority; claim before normal backlogpriority:ownerOwner-planned task; prioritize ahead of the Product backlogreview:approvedIssue reviewed and approved by the Fledge Platform Reviewer

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions