Skip to content

contrib: add migration checklist for breaking session schema changes - #344

Merged
davedumto merged 1 commit into
Vellar-Wallet:devfrom
arandomogg:contrib/issue-282-session-schema-migration-checklist
Aug 31, 2026
Merged

contrib: add migration checklist for breaking session schema changes#344
davedumto merged 1 commit into
Vellar-Wallet:devfrom
arandomogg:contrib/issue-282-session-schema-migration-checklist

Conversation

@arandomogg

Copy link
Copy Markdown

Summary

Adds a self-contained reference under contrib/examples/issue-282-session-schema-migration-checklist/ providing a standard checklist for safely rolling out a breaking change to the stored session schema across consumer versions.

Scoped entirely to contrib/ per CONTRIBUTING.md and contrib/README.md.

Why it's needed

WalletSession is persisted by the consumer's app (localStorage, or their own SessionStorageAdapter), not by the SDK's own process. A user can carry a session written by an older SDK for months before their app upgrades. restore() in src/session.ts is deliberately fail-soft — unreadable storage means "disconnected", never a crash — so an unmigrated breaking schema change silently signs every existing user out on their next app load, all at once, with no error surfaced anywhere.

Files

File What it is
CHECKLIST.md The checklist — backward compatibility, migration helper usage, testing, rollout — plus the worked example.
session-schema-migration-checklist.ts A runnable implementation of that worked example, so the guidance is demonstrably correct rather than only asserted.
session-schema-migration-checklist.test.ts 18 tests exercising every item in checklist sections 1–3.
README.md Orientation and how to reference the checklist from a migration PR.

The checklist covers

  1. Backward compatibility — old sessions still parse, defined fallbacks for newly required fields, the guard is widened rather than disabled.
  2. Migration helper usage — migrate on read (not write), pure and synchronous (no network or passkey prompt), idempotent, non-mutating.
  3. Testing — old-shape input, new-shape passthrough, invalid-data rejection, and the fallback value.
  4. Rollout — changelog entry under a Breaking heading, a stated compatibility window, and a tracked follow-up to drop the old read path.

Worked example

Replacing the flat lastActiveAt: string with a structured activity: { lastActiveAt, lastActiveNetwork }. The guard accepts both shapes, a pure and idempotent migrateSession upgrades old data on read with a defined fallback (the session's own network) for the field that didn't exist before, and invalid data still returns null.

Requirements checklist

  • Checklist covering backward compatibility and migration helper usage
  • Required to be referenced in migration PR descriptions (stated in CHECKLIST.md and README.md)
  • Example walkthrough using a hypothetical schema change — and it's runnable and tested, not just prose
  • Stored alongside the contribution guidelines (in contrib/, since this PR is scoped there)

Test plan

npx vitest run contrib/examples/issue-282-session-schema-migration-checklist

18 tests, all passing.

closes #282

Self-contained reference for issue Vellar-Wallet#282 under contrib/examples. There is no
standard process for safely rolling out a breaking change to the stored
WalletSession schema across consumer versions. Sessions are persisted by the
consumer's app, and restore() is deliberately fail-soft, so an unmigrated
breaking change silently signs every existing user out on their next app load
with no error surfaced anywhere.

CHECKLIST.md covers backward compatibility, migration helper usage, the tests
a migration PR must carry, and rollout, and asks migration PRs to reference it
in their description. It is backed by a runnable implementation of a worked
example, replacing a flat lastActiveAt field with a structured activity
object, so the guidance is demonstrably correct rather than only asserted.

Includes 18 tests exercising every item in checklist sections 1 to 3: both
shapes accepted, invalid data still rejected, migration on read, idempotency,
purity, and the fallback for the newly required field.
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@arandomogg is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

@davedumto
davedumto merged commit fc549c2 into Vellar-Wallet:dev Aug 31, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants