fix(credential-groups): pin the clock in the enrollment tests - #6812
Conversation
`invitationExpiresAt` was dated 2026-08-18T12:00:00Z, and the code under test compares it against the wall clock. The suite passed until that instant and has failed for everyone since -- the same commit passed CI at 07:21Z and failed at 14:55Z with no code change between the runs. Pin the clock to a point inside the invitation window instead. Every existing date literal keeps its meaning and the suite stops depending on when it runs. Re-dating the fixture to a later instant would only move the failure.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview The suite now pins time with Vitest fake timers: a fixed Reviewed by Cursor Bugbot for commit 1aa8014. Configure here. |
Greptile SummaryPins the enrollment test suite’s system clock within the invitation-validity window and restores real timers after each test, removing dependence on the wall clock.
Confidence Score: 5/5The PR appears safe to merge; the fixed clock removes the expired-fixture failure without introducing a reachable test regression. The affected tests perform date comparisons but do not rely on real timer scheduling, and each test restores real timers during cleanup.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/credential-groups/enrollments.test.ts | Adds deterministic clock setup and cleanup without disrupting the file’s existing timer or date-sensitive behavior. |
Reviews (1): Last reviewed commit: "fix(credential-groups): pin the clock in..." | Re-trigger Greptile
Summary
apps/sim/lib/credential-groups/enrollments.test.tshad a time bomb that has now gone off. It blocks CI on every branch, not just this one.ENROLLMENT.invitationExpiresAtwas hardcoded to2026-08-18T12:00:00.000Z, andcompleteCredentialGroupEnrollmentcompares it against the wall clock. Before that instant the invitation was valid and the suite passed; after it, the invitation is expired, the function returnsnull, and two tests fail.The evidence is a single unchanged commit running twice:
enrollments.test.tsSame SHA, same base, no code change between them — only the clock moved past 12:00Z.
Confirmed locally: on clean
origin/stagingthe two tests fail deterministically; re-dating the fixture to 2027 makes all 11 pass.Fix
Pin the clock to a point inside the invitation window rather than re-dating the fixture:
Every existing date literal keeps its meaning, and the suite stops depending on when it runs. Bumping the date to a later instant would only re-arm the same failure.
Type of Change
Testing
lib/credential-groups— 63 tests across 13 files pass.type-checkclean, lint clean. Verified the cause by moving the fixture date forward and back.Checklist