Repository navigation
fix(doctor): preserve large media migration timestamps - #132099
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 6:16 PM ET / 22:16 UTC. ClawSweeper reviewWhat this changesThe PR reads the media-migration aggregate timestamp fingerprint as exact SQLite text and adds a regression test for valid rows whose sum exceeds JavaScript’s safe integer range. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open for standard maintainer review: the requested regression coverage is now present and the narrow repair is source-proven, but it is not on current main or in the latest stable release. Priority: P2 Review scores
Verification
How this fits togetherDoctor migrates legacy agent SQLite databases into the current media-persistence format. It compares a source fingerprint before rewriting media metadata so concurrent database changes prevent a partial migration. flowchart LR
A[Legacy agent database] --> B[Doctor media migration]
B --> C[Read source fingerprint]
C --> D[Rewrite media metadata]
D --> E[Compare source fingerprint]
E --> F[Commit schema migration]
E --> G[Warn on source change]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -5, Tests +43. Total +38 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Land the owner-bound exact-text fingerprint repair once the exact-head required checks complete. Do we have a high-confidence way to reproduce the issue? Yes. The direct node:sqlite query reproduces the unsafe numeric materialization, and the added fixture supplies the equivalent migration path with a safe post-fix result. Is this the best way to solve the issue? Yes. The repair is at the fingerprint-producing query, preserves exact drift comparison, and leaves bounded numeric fingerprints unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a79e6517be83. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
b9cc77f to
9cbd128
Compare
9cbd128 to
58e25e9
Compare
* fix(doctor): preserve large media migration timestamps * fix(ci): keep media migration fingerprint compact * chore: restore source newline * test(doctor): cover unsafe media timestamp aggregates --------- Co-authored-by: Sarah Fortune <[email protected]>
Why
Doctor must migrate persisted databases containing valid SQLite integers even when aggregate timestamp fingerprints exceed JavaScript's safe integer range. Without preserving the aggregate exactly,
doctor --fixexits before committing the schema migration.Failure scenario
During a schema 16 to 18 media-persistence migration, Doctor reads
SUM(created_at)as part of its before/after source-drift fingerprint. A database with enough valid timestamp rows can produce an aggregate larger thanNumber.MAX_SAFE_INTEGER. Node SQLite then throws before the migration transaction can commit:The individual timestamps remain valid SQLite integers; only their aggregate exceeds JavaScript's safe integer range.
What changed
SUM(created_at)migration fingerprint as SQLite textValidation
oxfmt --check src/infra/state-migrations.media-persistence.ts