Repository navigation
events: use the caller's clock in markDuplicates (fixes red CI) - #13
Open
Mathyaszzz wants to merge 1 commit into
Open
Mathyaszzz wants to merge 1 commit into
Mathyaszzz wants to merge 1 commit into
Conversation
markDuplicates filtered on Postgres now(), ignoring the `now` that ingestMessage accepts. The reminder-collapse test pins its clock to 2026-09-28, so once the real date passed 2026-09-29 the event fell out of the one-day window and the test failed (2 !== 1). That is why CI has been red on every PR since then, including all the dependabot bumps. markDuplicates now takes an optional `now` (default: the current time) and ingestMessage passes its own through. syncMpuEvents is unchanged and keeps using the current time.
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.
Problem
CI has failed on every PR since late September, including all 9 open dependabot bumps. The failing test is
reminder emails for the same event collapse to the first announcement(2 !== 1, pipeline.test.ts:65).Root cause
The test pins its clock to 2026-09-28 through
ingestMessage'snowoption.markDuplicatesignored that and filtered on Postgresnow(), so once the real date passed Sept 29 the event fell outside the one-day window and was never marked as a duplicate.Fix
markDuplicatestakes an optionalnow(defaults to the current time), andingestMessagepasses its own through. I fixed the function instead of moving the test's dates, since otherwise the next test that injects a clock would hit the same thing.Testing
Locally against Postgres 17 with
TEST_DATABASE_URLset:2 !== 1)npm run checkcleanRisk
Low. No production caller passes
now, so production still uses the current time; the only difference is that it now comes from the app server's clock instead of the database's.syncMpuEventsis unchanged.