fix(store): heal a database that version 1 left empty - #11
Conversation
The launch probe could create 'ftw' at version 1 with no object stores, and an app opening the same version got no upgrade callback and created none either — every read and write broken for the life of the install. The probe no longer does that, but prevention cannot reach a phone already in that state. Only a version it has not seen can. Version 2, with an upgrade that creates each store only if it is missing. A broken database gets its schema; a healthy one is untouched, rows and all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
ftw-webapp | 2a7bbf6 | Aug 05 2026, 05:43 PM |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a7bbf6f8c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // either, so every read and write failed for the life of the install. The | ||
| // probe no longer does that — but installs that already suffered it cannot be | ||
| // healed by prevention, only by a version they have not seen. | ||
| const DB_VERSION = 2 |
There was a problem hiding this comment.
Update the boot probe before forcing the v2 upgrade
When an existing v1 install launches with ftw.site set, the inline boot probe still opens indexedDB.open('ftw', 1) and, on success, never closes req.result after checking/reading snapshot (index.html:74 and index.html:93-99). Bumping the app open to version 2 makes that still-open v1 connection block the upgrade that is supposed to repair the database, so the exact broken v1 installs this targets can leave db() pending for the session; after a successful v2 upgrade, the same v1 probe will also just VersionError and skip the first-frame cached snapshot path. Please update the probe to the new version and close or onversionchange-close its connection as part of this bump.
Useful? React with 👍 / 👎.
Follow-up to #9, which stopped the launch probe from creating an empty database — but could not help an install that already had one. Version 2 with an idempotent upgrade repairs the schema in place; a healthy database is untouched, rows included. Tests build the broken state deliberately and open it the way the app does.