Repository navigation
fix: stop aggregate writes losing messages silently - #734
Open
Maelstromeous wants to merge 3 commits into
Open
Maelstromeous wants to merge 3 commits into
Maelstromeous wants to merge 3 commits into
Conversation
- Upserts write each doc with updateOne. A duplicate-key race on one doc is retried from that doc and the rest still apply; before, the error was swallowed and every increment after it in the message was lost. - Failed aggregate writes are requeued once, then logged and dropped, instead of being acknowledged as if they had succeeded. - The victories cache bump runs after the message is settled, so a Redis failure can no longer ack the message twice and close the channel. - Adds jest and ts-jest, which the existing jest config needed, with specs for the retry and requeue rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d insert failures Review follow-ups: - A failed upsert is only requeued when it provably wrote nothing (the first operation failed, or no server was reachable). Replaying one that half-applied its increments would count them twice, so it is logged and acked instead. - A failed alert lookup in a global message is requeued once rather than treated as a deleted alert and dropped. - Failed inserts (populations, facility control events) are requeued once; the collections have unique indexes and inserts are now unordered, so a replay cannot duplicate rows or stop at the first duplicate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Takes main's lockfile, which now carries the same jest dependencies (#736). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Manual steps
No manual steps or intervention required.
What this does
Aggregate writes could lose data without any trace. This makes the failures visible and retries the recoverable ones:
updateManyupserts, and a duplicate-key error was caught and reported as success. When two consumers created the same new row at once, the loser's first doc failed and every increment after it in that message was dropped. Upserts now useupdateOne; a duplicate-key error on one doc is retried from that doc, and the docs after it still apply. A second failure on the same doc is thrown.Pairs with ps2alerts/aggregator#1024, which fixes the keys those writes use. Either can deploy first.
Validation done
tsc --noEmitand ESLint clean. 13 specs cover the retry, requeue and no-replay rules, all passing, alongside the pagination specs from #736, and run in the Tests workflow.🤖 Generated with Claude Code