Repository navigation
test: pin the repository-page clock fixture to one stored instant (#1300) - #1305
Merged
Merged
Conversation
`makeTerminalJob` takes no instant and writes `new Date()`, so `renderRepo` stamped the job at call time and the whole-page equality compared two independently stamped pages. Build one store and one job with `createdAt` and the instant the helper should store, render both pages from that job, and assert the rendered line is the literal, not "now". Red on this tip: `test/clockFixtures.test.ts` fails because `makeTerminalJob` ignores the instant, and `tsc` refuses the third argument until the helper takes it.
The helper wrote `new Date()` and returned the created row, so a caller
could not pin the stamp its page renders. Take `{ finishedAt }`, default it
to the wall clock so the existing call sites do not change, and return the
snapshot with the one stamp the caller asked for. The repository-page fixture
now builds one store and one job and reads both renders from that record.
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.
Written-by: Fledge Platform Dev-1
Fixes #1300
The defect
test/repoClockWarning.test.tscompared two whole-page renders, but the fixture built a freshStoreand a new job perrenderRepo()call.makeTerminalJob(test/helpers.ts:91-95) took no instant and wrotenew Date().toISOString(), andcreateJobfell back tonowIso()forcreated_at, so each call stamped its own page. The repository page renders the job'screated_atthroughhumanTimeShort(src/views/pages.ts:636), which truncates to whole seconds (src/lib/time.ts:34): a second boundary between the two calls changes the rendered line by one second and the equality assertion fails on unchanged code. The card records the same shape one level up —test (24)job138383429500failed attest/repoClockWarning.test.ts:96and passed on the rerun of the same sha.The assertion was right about the page. The fixture was the non-deterministic half.
The change
test/helpers.ts—makeTerminalJobtakes an optional third argument,{ finishedAt }, defaulting tonew Date().toISOString()so the existing 30 call sites are untouched. The returned snapshot carries the stamp the caller asked for. Its other fields,statusincluded, stay exactly what the created row held, so those call sites see no change beyondfinished_atnow being set.test/repoClockWarning.test.ts— one store and one job are built once withcreated_atandfinished_atboth at2026-11-23T21:25:43.500Z, and every render reads that one record. A new assertion pins the rendered text to2026-11-23 21:25:43 UTC, so a fixture that still read the wall clock cannot produce it. Every existing assertion is kept verbatim; none is removed or weakened.test/clockFixtures.test.ts— new, half 1:makeTerminalJob(..., { finishedAt })stores the instant it is given.No product code, no
src/file, no change tohumanTimeShortor the page.Red first
Commit
e4e8075is the test-only half. On that tipnpx tsx --test test/clockFixtures.test.ts test/repoClockWarning.test.tsgave 4 tests, 3 pass, 1 fail:not ok 1—a fixture written for a fixed instant keeps that instant: expected'2026-11-23T21:25:43.500Z', actualnull— the helper took no instant and returned the created row.Green at the tip
ac9a4f9a4eb4758492893819643cff08b6f2dc04(treea3136c95615e4d61655ccc5e936e712322a3584e), read from the branch API this turn; opened againstmain7a451f9242d5ef060cfe0b3693a8b1c45a37555d.Ran:
node scripts/issue-gate.mjs --issue 1300—issue-gate: ok #1300 593b457a2f88npx tsx --test test/clockFixtures.test.ts test/repoClockWarning.test.tsat the tip — 4 tests, 4 pass, 0 failnpm run checkat the tip — exit 0: lint baseline matches (11 warning(s) in 8 entries),tsc --noEmitpass,# tests 3436 / # pass 3436 / # fail 0,tsc -p tsconfig.build.jsonpassnode scripts/risk-gate.mjs --base 7a451f9242d5ef060cfe0b3693a8b1c45a37555d—risk-tier: T1; basis: test/clockFixtures.test.tsnode scripts/pr-lint.mjs --pr 1305—pr-lint: ok (#1305, T1, 3 files)Not run: Docker image, Playwright/visual suite (
npm run dev) — test-only diff, no user-visible surface.Risk
Tier computed from the diff: T1. Test-only, no
src/file, no behaviour change; merges on greenci-okalone.makeTerminalJobstill defaults to the wall clock for the other call sites; only the page fixture pins an instant. That is deliberate — the card's non-goals keep the other fixtures untouched.7a451f9242d5ef060cfe0b3693a8b1c45a37555dandmainhas not moved since (read this turn), so the branch needs no merge.Docs decision:
Docs-not-needed: test-only fixture determinism; no product behaviour, command or documented contract changes.No changelog fragment: users cannot see a test fixture.