Repository navigation
fix: keep the earliest row per source id in state history mirrors - #1532
Merged
Merged
Conversation
…ages arrive in A state history mirror kept the first row it received for a source id. When one id had rows at different times, a rebuild that read a later page first kept a different row than a clean scan. The earliest row now wins, then the smallest record text, on SQLite and PostgreSQL. Also print the Snowflake-like connection keys warning once per process.
A refreshed cost estimate reuses its observation id and the warehouse treats the latest row as current, so its mirror keeps the latest row. Every other history kind keeps the earliest.
…cher The test waited for the first periodic summary and then expected the event to be delivered, but a summary can be published while the event is still queued. Wait for delivery and for a summary that reports it, then count deliveries after shutdown drains the queue.
A refresh writes a new attempt with a new id; the same id comes from two builds refreshing one run's estimate at once.
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 17, 2026
…tory-mirror # Conflicts: # fensu.toml
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
When a state table holds two rows with the same source id, such as one check result written twice, the server's mirror kept whichever arrived first. A full reread could keep a different row than an incremental scan, so the history shown depended on page order, and one integration test failed intermittently.
Mirrors now keep the same row whatever the order. A server that kept a different row corrects itself at the location's next full reread: at location start, and on the first sync at least 5 minutes after the previous one.
Changes
observed_at, then the smallest record text in byte order. SQLite and PostgreSQL may differ on an exact tie; each is deterministic and a store migration rebuilds the mirror.Verification
sqlbuild-python(66,756 to 66,760); cap set exactly.make check-cion the final head.DuckShop:
audit_result_history.jsonalready carries 105 duplicate source ids at a later time; the cost case is built fromresource_cost_history.json's record.