Repository navigation
fix(tests): Remove durable queue timeout race - #1925
Merged
Merged
Conversation
Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
8 screenshot changes — 8 changed · 0 added · 0 removed Review screenshots in Frameshift
|
Co-Authored-By: David Cramer <[email protected]>
dcramer
approved these changes
Sep 25, 2026
dcramer
marked this pull request as ready for review
September 25, 2026 04:37
dcramer
enabled auto-merge (squash)
September 25, 2026 04:39
dcramer
added a commit
that referenced
this pull request
Nov 16, 2026
In the junior Vitest suite, `Date` now starts each test file and each test 5 s after the start of the current real minute, and then moves forward in real time. This is the offset clock the evals already use. It moves from `junior-evals/src/eval-clock.ts` to `@sentry/junior-testing/clock`, and the evals import it from there. ## Why Recent fixes for nondeterministic tests, grouped by mechanism: | Mechanism | Fix | Suite | Harness default before this PR | | --- | --- | --- | --- | | Wall clock | #3265: a run that crossed a minute boundary left fixture stamps newer than a Turn | junior Vitest | **None.** The test pinned its own clock. | | Wall clock | #2111: model-derived times went stale between recording and replay | evals | Eval clock | | Shared state | #3355: the Redis user cache outlived the Postgres reset | evals | Per-test namespace delete | | Shared state | #1775: module-level mock state leaked between specs | dashboard e2e | Reset in the page fixture | | Shared state | #2474: keep-alive connections blocked server close | dashboard e2e | `closeAllConnections()` | | Timing | #1925, #3316: one-off races | junior Vitest, dashboard e2e | Fixed in each fixture or spec | The only mechanism with no harness default was the wall clock in the junior Vitest suite, so this PR changes only that. ## What the harness guarantees - Each test starts at second 5 of a minute. A test that runs for less than 55 s cannot cross a minute boundary by chance. #3265 is no longer possible, so `versions.test.ts` drops its own pin. - `Date` stays within a minute of real time. Times that JS stamps stay comparable with Postgres `now()`, `defaultNow()` columns, and real servers such as S3, so no test needs an opt-out. A fixed calendar instant would put `Date` weeks away from those clocks. - The clock keeps millisecond steps and real-time speed. Timers and `performance.now()` stay real. Sinon's Date-only fake (`shouldAdvanceTime`) moves in 20 ms steps and does not move during microtask-only work. Timestamps would then tie and make `ORDER BY created_at` flaky, so this PR does not use it. - `vi.useFakeTimers()`, `vi.setSystemTime()`, and `vi.spyOn(Date, "now")` work on top of the clock. - A global `afterEach` calls `vi.useRealTimers()`, so fake timers do not leak into the next test. A test that forgets `vi.useRealTimers()` no longer shows up as a leak in later tests. ## Left out - Shared state and timing: each listed fix already lives in its own harness or was one specific race. The junior Vitest suite already resets Postgres and the state adapter for each integration test, and I found no common leak to guard against. - Calendar-dependent output, such as weekday or month names, still follows the real date. No listed fix came from that. - Existing per-test `vi.setSystemTime` pins still work and stay as they are. <!-- junior-request-attribution:start --> via @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Ae0825347725c723b07a008a8b27a2961 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Ae0825347725c723b07a008a8b27a2961) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ae0825347725c723b07a008a8b27a2961/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
This branch was successfully deployed
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.
Wait for the model request to abort instead of releasing its response 50 ms after the deadline.
Keep one test for timeout, repeated timeout, and successful resume. It also checks lease release, saved replies, and a later user request. Remove the duplicate test and timing helpers. No production changes.
Failure: https://github.com/getsentry/junior/actions/runs/36093057420/job/107939498578.
via David Cramer.
--
View Junior Session [Sentry]