fix: repair legacy desktop upgrade migration and replay crashes#7
Open
paul-bouzian wants to merge 2 commits intoEmanuele-web04:mainfrom
Open
Conversation
Repair upgrades where older desktop builds recorded different migration IDs for 17-22, causing the current thread metadata migrations to be skipped and migration 23 to crash. The patched migration now rebuilds any missing thread/message columns before backfilling the durable associated worktree ref, and adds a regression test that reproduces the incompatible migration ledger. Co-authored-by: Codex <noreply@openai.com>
Repair desktop upgrades where older databases contain thread.archived or thread.unarchived orchestration events that the current release cannot decode during startup replay. Add a migration that rewrites those legacy rows into thread.meta-updated events, and cover the normalization with a regression test. Co-authored-by: Codex <noreply@openai.com>
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.
Why
effect_sql_migrationstable already contains different migration names for ids17through22from an older release line.023_ProjectionThreadsAssociatedWorktreeRefstill runs, and startup crashes becauseassociated_worktree_branchdoes not exist.thread.archivedorthread.unarchivedorchestration events, which the current release cannot decode during replay, causing the backend to restart in a loop even after the schema issue is repaired.How
23repair the full current thread/message metadata shape before backfillingassociated_worktree_ref.17-23migration line and add only the ones that are absent, so healthy databases keep their existing data untouched.24to normalize legacy archived/unarchived thread events into decodablethread.meta-updatedrows that preservethreadIdandupdatedAt.Tests
bunx vitest run apps/server/src/persistence/Migrations/023_ProjectionThreadsAssociatedWorktreeRef.test.ts apps/server/src/persistence/Migrations/024_NormalizeLegacyArchivedThreadEvents.test.tsbun fmtbun lint(passes with existing repo warnings only)bun typecheckReview Setup
effect_sql_migrationstable already contains the legacy17-22rows and whoseorchestration_eventstable may include legacythread.archivedrows, then launch the app and confirm startup no longer crashes during replay.