fix(pricing): atomically replace cached catalogs on Linux - #3444
Conversation
Extract the existing cache replacement defect identified in #3412 while leaving its Antigravity feature scope separate. Replace the redundant temporary-file swap with one atomic write and preserve successful-save memo invalidation. Co-authored-by: WeGoToMars <profigor7@gmail.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 6, 2026, 12:59 AM ET / 04:59 UTC. ClawSweeper reviewWhat this changesReplace pricing-catalog saves with one atomic destination write, add repeated-save coverage, and update the parser fingerprint, documentation, and changelog. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 3 items remain The cache repair remains useful, but the generated fingerprint change unnecessarily rebuilds existing usage databases. This upgrade defect was missed in the earlier review of the same head. Priority: P2 Review scores
Verification
How this fits togetherCodexBar caches public model prices for local usage-cost calculations. Catalog refreshes write that cache, while a generated source fingerprint also controls compatibility of the separate SQLite usage database. flowchart TD
A[Public pricing catalog] --> B[Catalog refresh]
B --> C[Atomic cache write]
C --> D[Disk catalog and memory cache]
D --> E[Usage cost calculations]
F[Generated source fingerprint] --> G[SQLite compatibility check]
G --> H[Preserve or rebuild usage database]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the atomic catalog write and adopt the released predecessor fingerprint without rebuilding, with explicit upgrade preservation coverage. Do we have a high-confidence way to reproduce the issue? Yes: opening a database stamped with the v0.56.6 fingerprint under this head follows the source-proven incompatible-schema rebuild path. This read-only review did not execute it. Is this the best way to solve the issue? The atomic write is an appropriate narrow repair, but the accompanying fingerprint update needs the existing compatible-predecessor mechanism to avoid unnecessary database destruction. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 211781be79d3. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(pricing): atomically replace cached catalogs on Linux This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Follow the pricing-cache repair in #3444 by replacing the remaining redundant file swap with one atomic write. Preserve complete scan, pricing, timezone and provider state across repeated saves, and retain the best-effort persistence contract.
Refreshing an existing models.dev pricing catalog on Linux can fail and remove the cache file. The old path atomically wrote a temporary file and then performed a second
FileManager.replaceItemAtoperation. This replaces that sequence with one atomic write to the destination, retaining the existing failure return and invalidating the in-memory memo only after a successful save.This extracts the shared cache defect identified in #3412. Thanks @WeGoToMars for identifying and addressing it in that proposal. The Antigravity estimation feature remains separate and #3412 stays open. The generated parser fingerprint is updated through the existing generator; documentation and the Unreleased changelog are included. Production sources are net −7 lines (2 added, 9 removed, including the generated fingerprint).
Validation:
saved=false, destination missing). The candidate passes 100 successive saves, each checked with a fresh disk decode and a memo read, with no leftover staging files.make checkpasses. All 1,025 selections across 86 groups pass inmake test; one unrelated RPC child-teardown timing failure passed on its group retry. All 42 focused pricing/cache tests pass, including the portable replacement regression.