Repository navigation
test(members): pin the clock in the retained-document age test - #14387
Pearcekieser wants to merge 1 commit into
Conversation
|
Intent: Make the retained-document age test in |
UX Review (Fable 5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. [UX-REVIEWED] 97c923b |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 97c923b |
The test read the real clock, so on the fixture's 23rd day the banner read "23d ago" and the not.toContain("3d ago") check failed on main. Only Date is faked; ages are matched as whole words.
Fixes kirodotdev#14386
6790374 to
97c923b
Compare
|
Head Backend Tests (3.12, 3), Backend Tests (Windows) (3) and Coverage Gate fail the same way on main. Shards 3 hit |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
|
Superseded by #14398, which fixed the same main-red by asserting on the whole interpolated sentence. Closing. |
Problem / Motivation
Goal: The retained-document age test in
CrewWebviewContainment.test.tsxpasses on any date.The test read the real clock. Its fixture was published at the fixed instant
2026-09-04T05:16:00, and the republish it compares against is dated three days beforeDate.now(). On the fixture's 23rd day the banner reads "Showing the version from 23d ago", andexpect(text).not.toContain("3d ago")fails because "23d ago" contains "3d ago". It fails on main now, and it fails on every PR whose frontend shards run.Why it matters
Frontend Tests (1) is red for every open PR until the clock moves past the window, about 2026-09-28 05:16 local time. The same collision comes back at any later pair of ages where one is a substring of the other.
Not a goal
fmtRelativeformats ages.What changed (motivation → approach → change)
The two ages the test compares both moved with the real clock, so which strings they rendered depended on the day the suite ran. The test now pins "now" a week after the fixture instant with
vi.useFakeTimers({ toFake: ["Date"] })andvi.setSystemTime(...). The fixture then always reads "7d ago" and the republish "3d ago". OnlyDateis faked, sowaitForand react-query keep their real timers.afterEachcallsvi.useRealTimers().The age checks on the banner and on the bar chip match whole words, so one age can no longer pass or fail as a substring of the other.
Backwards compatibility
Compatible: test-only change in
website/src/test/.Tests
website/src/test/CrewWebviewContainment.test.tsx: all 44 tests pass locally on 2026-09-27, the day the unpinned test fails on main.Manual verification
N/A. The change is test-only and the test file is the verification.
Screenshots / video
Why no screenshot: test-only change, nothing renders differently.
Related Issues
Fixes #14386
Pattern harvest
Rule candidate: review-prompt
Pattern: a test that renders a relative age from a fixed fixture date while reading the real clock, and asserts on the rendered string.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)