Repository navigation
fix(server): upgrade preview databases with peer-link migration collisions - #25293
juliusmarminge wants to merge 3 commits into
Conversation
Refs #25289 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Previews 3511/3516 recorded PeerLinks, PeerLinkFence and WaitingLinkRequestIndex at ids 68-70, which main uses for ShellStopRequestIndex and ThreadMessageSearch, so startup refused the history. Recognize that exact history, renumber the peer-link rows to 70-72 (the ids 3702 uses) keeping their schema and data, and apply 68/69 in the same transaction. Any other history still hits the guard. Fixes #25289 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused migration compatibility fix that repairs only recognized preview histories while leaving current and unknown database histories protected by existing guards. The included tests cover upgrade behavior, preservation of peer-link data, idempotence, and refusal of unexpected histories. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Reconcile preview migration history apps/server/src/persistence/reconcilePeerLinkPreviewMigration.ts, apps/server/src/persistence/Migrations.ts, apps/server/src/persistence/Migrations.test.ts |
The reconciliation checks whether migration history matches the expected preview sequence. On a match, it shifts preview records to IDs 70–72, applies migrations 68 and 69, and returns their records to the runner. The runner skips reconciliation when the inclusive migration limit is below 69. Tests verify the upgrade, preserved data and index, no-op repeat run, and rejection of a mismatched history. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- pingdotgg/t3code#25058: Handles the same preview migration history during dev-database import.
- pingdotgg/t3code#24343: Adds migration 069, which this reconciliation applies.
- pingdotgg/t3code#24665: Routes dev database migration-history handling through
runMigrations.
Suggested labels: size:M
Suggested reviewers: t3dotgg, macroscopeapp
Merge Risk: 
Minimal · up to b8c53
-
The exact preview database history has a transactional upgrade path, with no identified issue requiring a fix before merge.
Pre-merge checks: 
4
-
Full details: Linked Issues check
-
Explanation
Issue
#25289requires recognition of the exact 68–70 peer-link history, relocation to 70–72, and application of migrations 68 and 69 without replaying peer-link DDL.reconcilePeerLinkPreviewMigrationmatches IDs 55–70 exactly, updates peer-link records in reverse order, runsShellStopRequestIndexandThreadMessageSearchin one transaction, and inserts their history records.Migrations.tsinvokes this reconciliation before the regular loader. Tests verify data and the waiting-link index remain, the second run is a no-op, and a near-match is rejected without mutation.
Full details: Out of Scope Changes check
-
Explanation
The changed files are limited to the migration integration, the focused peer-link history reconciliation, and regression tests. The reconciliation and tests directly support issue
#25289. No unrelated product behavior or unrelated files are shown in the reviewed changes.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
Problem
Preview 3511/3516 databases record peer-link migrations at 68–70. Starting current main against that history fails before the server listens because required migrations
ShellStopRequestIndexandThreadMessageSearchwould be skipped.Change
Recognize this exact preview history and, in one transaction, move its peer-link migration records to 70–72 and apply the missing main migrations 68/69. Preserve the existing peer-link schema and data without replaying its DDL. Leave unrecognized histories subject to the existing migration guard.
Scope and approval
Fixes #25289
Triaged bug explicitly enqueued by Julius via the automated issue flow: #25289.
Verification
Migrations.test.ts,reconcileV2PreviewMigration.test.ts, andinitializeV2Database.test.ts.vp run check:changed: format, lint, GraphQL, knip, affected typechecks and adjacent tests passed.Models: Claude Opus 5.5 and GPT-6.1, through T3 Code's Claude Agent and Codex harnesses.