fix(db): harden migration recovery snapshots - #12435
Merged
Merged
Conversation
diegosouzapw
marked this pull request as ready for review
September 4, 2026 00:00
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
Validado em lote numa worktree combinada com os 14 PRs desta campanha de error-boundary sobre o tip de `release/v3.8.51`: `typecheck:core` limpo e **120/120** nos 23 arquivos de teste que os PRs trazem. Um ponto que só apareceu no tree combinado: **diegosouzapw#12465 e diegosouzapw#12466 criam o mesmo arquivo novo** `open-sse/utils/streamReadiness.ts` (que não existe no tip) com desenhos divergentes de cancelamento — `cancelled` + `releaseLock` imediato num, `readInFlight`/`cancelRequested` com `cancelReader` fire-and-forget no outro. Adotei a versão do diegosouzapw#12466, que difere e defere o release do lock para quando a leitura em voo termina, e validei a escolha rodando as suítes dos **dois** PRs contra ela: 21/21 no readiness compartilhado e 22/22 incluindo o boundary do Perplexity.
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.
Summary
Hardens SQLite upgrades around the historical migration 074 slot collision and makes every
actionable migration of a database that physically existed before initialization depend on a
durable safety snapshot.
table is missing, resolves the known
074_discovery_results/081_inspector_custom_hostsprovenance and replays the legitimate migration atomically
skeleton is snapshotted without reintroducing the false mass-migration abort on first setup
fsyncand atomic, no-overwrite hard linksVACUUMclone so identical retries reuse one snapshotIMMEDIATEwriter transactionDATA_DIRguard to direct Node--eval/--printtest probesDISABLE_SQLITE_AUTO_BACKUPnever bypasses migration safetyTDD regressions
081without physical inspector table must replayFinal validation
DATA_DIRmatrix/tmpDATA_DIRnpm run typecheck:core, exit 0migrationRunner.ts1170/1201;core.ts1744/1745git diff --check; 87 stale-version docs warnings remain informationalb2661074f0: 9 success, 0 failure, 0 pending, 7 intentionally skipped, 2 neutralReconciliation evidence
dbbf20dd9d57af8f0b287cfc83a2d9f640def11897041954171ee3aa3f51a7fb01748797c23716f8bf0d902dfc5369bd025f64808d96fe6cb473ea75bff879a4e87b5984edb72567ae40430462374f2fb2661074f02d671b1e5973b7f21e41cdfa2bd58b78ba4e1288b2e91c242b3a91eb83add34d11e797before the additional reviewed hardening commitOperational contract and residual scope
Filesystems without same-filesystem hard links or durable file synchronization fail closed before
an existing persistent database is migrated. Windows directory-entry
fsyncremains best effort,and sql.js snapshot canonicalization temporarily holds multiple full database images in memory.
These are explicit availability/resource tradeoffs, not silent safety bypasses.
The new
DATA_DIRguard covers direct Node test/eval/print probes. Arbitrary script-file executionsuch as
node --import tsx file.tsis not claimed as closed by this PR and remains follow-up scope.The new
081cases exercise the shared atomic replay path; fault injection during the specific081DDL is not duplicated because the same transaction rollback is already covered through the074replay regression.State: OWN SCOPE PASS · REMOTE DRAFT FAST-PATH PASS · FULL RELEASE HOLD