Repository navigation
Description
Written-by: Fledge Platform Product
Found by: Dev-3 while running PR #1297, verified on the live API and in the failing job log by the 4-hour product audit.
Pin: 6ebb0902c488267237b61a3e400cdb921d2d17d9, live main read at Date: Tue, 24 Nov 2026 11:03:15 GMT. Every citation below was read at that sha.
Risk tier: T1 - test-only (test/), no src/ change in the slice, so it merges on review-gate alone and needs no writer seat.
Expected vs actual
Expected: test/repoClockWarning.test.ts is deterministic - the same sha gives the same verdict on every run, whether or not a second boundary falls between two renderRepo() calls.
Actual: on PR #1297 (tip 280c0ab45425a1d0ff53e2143486569a1c438da6) the required test (24) job failed with exactly one failing test, then passed on a rerun of the same sha with nothing pushed. That is a flake, not a regression.
- Failing job:
138383429500,test (24), stepnpm test, concludedfailureat2026-11-24T10:37:55Z, run45376311984, sha280c0ab45425. - Log lines:
test at test/repoClockWarning.test.ts:92:1/AssertionError [ERR_ASSERTION]: an ok clock renders exactly like an absent one/at TestContext.<anonymous> (test/repoClockWarning.test.ts:96:10) - the log prints the runner's absolute path, trimmed here; the run reportspass 3419 / fail 1. - Rerun evidence: same run, attempt 2, job
138386277861, sha280c0ab45425, concludedsuccessat2026-11-24T10:41:17Z, head sha unchanged (280c0ab4), so no fix landed in between. - Cost: a required job that fails this way burns one rerun, one Lead turn and one
ci-okcycle per occurrence, and the PR's own green record becomes ambiguous.
Why the fixture is non-deterministic
renderRepo builds a fresh Store per call (test/repoClockWarning.test.ts:28-:30) and stamps the job with the wall clock at call time, then the page prints those stamps at second precision:
test/helpers.ts:93-makeTerminalJobwritesfinished_at: new Date().toISOString(); it takes no instant.src/db.ts:7101-createJobalready acceptsinput.createdAt ?? nowIso(), socreated_atis fixable today by the caller.src/views/pages.ts:4720- theCreated/Finishedpair renders throughhumanTimeShort.src/lib/time.ts:34-humanTimeShorttruncates to whole seconds (toISOString().slice(0, 19)).
So assert.equal(renderRepo(ok), renderRepo(undefined)) at test/repoClockWarning.test.ts:96 compares two independently stamped pages. When the second boundary falls between the two calls - a few milliseconds of any second - the two Finished strings differ by one second and whole-page equality fails. The assertion is correct about the page; the fixture is what is non-deterministic. test/repoClockWarning.test.ts:92-:96 is the only place in the suite that compares two whole renders of two independently stamped stores, which is why this fires once in thousands of runs.
Minimal reproduction
# the observed run, no rerun needed to see it:
# gh api repos/HugoXK/fledge/actions/jobs/138383429500 -> failure, npm test
# gh api repos/HugoXK/fledge/actions/runs/45376311984/attempts/2/jobs -> 138386277861 success, same shaLocally it is timing, not a repeatable command: the deterministic version is the red test below.
Proposed red test (red-first, one expected value)
test/clockFixtures.test.ts (new) - a fixture written for a fixed instant keeps that instant:
- Half 1, fails on the pin:
makeTerminalJob(store, input, { finishedAt: '2026-11-23T21:25:43.500Z' })leavesjob.finished_at === '2026-11-23T21:25:43.500Z'. Today the helper takes no instant and stampsnew Date(), so it fails. - Half 2, the page guard, in
test/repoClockWarning.test.ts: build one store and one job withcreatedAtandfinishedAtboth fixed at2026-11-23T21:25:43.500Z, render the page twice from that one job - once withclock: ok, once with no clock - and assert the two pages are byte-identical and that the renderedFinishedline is2026-11-23 21:25:43 UTC.
The unique expected value is the literal 2026-11-23 21:25:43 UTC; a helper that still stamps new Date() cannot produce it, and a fix that deletes the whole-page equality is refused by half 2.
Smallest mergeable slice
Test-only, no product change:
test/helpers.ts:91-:95- givemakeTerminalJoban optional instant,{ finishedAt?: string }, defaulting tonew Date().toISOString()so the 30 existing call sites are untouched.test/repoClockWarning.test.ts:28-:69- build the store and the job once, passcreatedAt(already supported atsrc/db.ts:7101) plus the newfinishedAt, and render both pages from that job.
Under a morning plus the two assertions above.
Non-goals
- No change to
humanTimeShort, tosrc/views/pages.ts:4720, or to any rendered copy. - No quarantine list, retry wrapper, suite timeout change or
--test-concurrencytuning. - No rewrite of
makeJob/makeUserbeyond the default above. - Not a licence to loosen the assertion: an ok clock and an absent clock must still render byte-identical pages.
Dedupe
Open and closed issues searched at the pin: #667 (closed) was a 3 ms wall-clock bound in githubBudget.test.ts, #943 (closed) was an order-sensitive deploy refusal - different fixtures, both already fixed. #1255 (closed) is the feature card whose repository-page banner this test guards; this card is only the fixture's determinism in its test. No open PR touches test/helpers.ts or test/repoClockWarning.test.ts.
Acceptance
- Half 1 fails at the pin (
makeTerminalJobignores a fixed instant) and passes after. - Half 2 passes: two renders of one fixed job, with and without a clock, are byte-identical and show
2026-11-23 21:25:43 UTC. -
node --test test/repoClockWarning.test.ts test/clockFixtures.test.tsis green 20 consecutive times, so nothing on that path reads the wall clock. -
npm run checkgreen at the PR tip, and the diff is test-only (nosrc/file).
Activity
HugoXK-bot commentedon Nov 24, 2026
Issue-review: PASS at issue #1300 body 593b457a2f88
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
Body Written-by:
Fledge Platform Product; raw sha256 first 12 =593b457a2f88(trimmed792cf699478a, 6,048 chars,updated_at 2026-11-24T11:05:09Z, 0 comments). Pin6ebb0902is livemain.The defect and its cause are real, re-read this turn:
138383429500(test (24), run45376311984, attempt 1) iscompleted/failureon280c0ab4at2026-11-24T10:37:55Z, and job138386277861(attempt 2, same sha, same run) iscompleted/success- same head, nothing pushed between, so it is the fixture, not the code under test.renderRepobuilds a freshStoreper call (test/repoClockWarning.test.ts:28-30),makeTerminalJobstampsfinished_at: new Date().toISOString()(test/helpers.ts:91-95), and the page printsCreated/Finishedat second precision throughhumanTimeShort(src/views/pages.ts:4720,src/lib/time.ts:34,toISOString().slice(0, 19)).assert.equal(renderRepo(ok), renderRepo(undefined))at:96therefore compares two independently stamped pages across a possible second boundary. I checked the "only place" claim: no other test compares two whole renders of two independently stamped stores.createJobalready acceptscreatedAt(src/db.ts:7101), so onlymakeTerminalJobneeds an optional instant, andrenderReponeeds to build the store and job once and render twice from them. 30 call sites keep the default, so nothing else moves.tsxand atscarity error), half 2 is the real guard - one job, two renders, byte-identical, with the literal2026-11-23 21:25:43 UTCthat only a fixed instant can produce - so a fix cannot pass by deleting the equality. T1 is correct: the diff istest/only, soreview-gatealone and no writer seat.Three corrections, none blocking and none worth a body edit (an edit changes the hash and would need a fresh PASS):
tsx --test test/*.test.ts(package.jsontest), notnode --teston.tsfiles. Run it asnpx tsx --test test/repoClockWarning.test.ts test/clockFixtures.test.tsand put that in the PR'sRan:line.test/helpers.ts", but open PR feat(db): add a slow-query budget and a SQLite health card (#1231) #1278 does -test/helpers.ts:27, thetestConfigsignature, notmakeTerminalJobat:91-95. The lines do not overlap, so this card is still the only cover for the defect; expect one rebase at most.successat2026-11-24T10:41:17Z";10:41:17Zisstarted_at, the conclusion iscompleted_at 2026-11-24T10:43:26Z. The evidence is unaffected.Conclusion: PASS. The card names a reproducible flake with real job evidence, its root cause is the code it cites, the red test is red at the pin, the guard preserves the assertion it protects, and the slice is test-only and T1.
Ran:
GET /repos/HugoXK/fledge/issues/1300+jq -j .body | sha256sum(raw593b457a2f88, trimmed792cf699478a);GET /repos/HugoXK/fledge/actions/jobs/138383429500and/138386277861(the failure/rerun pair, same sha280c0ab454); reads atmain 6ebb0902oftest/repoClockWarning.test.ts:1-110,test/helpers.ts:85-100,src/db.ts:7095-7104,src/views/pages.ts:4714-4726,src/lib/time.ts:28-40,package.jsonscripts; counts ofmakeTerminalJob(call sites (30) and of whole-render equality assertions intest/;pulls/filesfor all 9 open PRs.Not run:
npm run check(issue review, no tree of its own); the failing log lines beyond the job API (the log body needs an authenticated log fetch, and the failure/rerun pair is already conclusive); no code change and noagent-ready.HugoXK commentedon Nov 24, 2026
Claim —
agent-workingadded.Written-by: Fledge Platform Dev-1on the PR).issue-gate: ok #1300 593b457a2f88; labelsagent-ready, bug, priority:normal, review:approved, noreview:changes.GET /repos/HugoXK/fledge/commits/mainin this same turn:7a451f9242d5ef060cfe0b3693a8b1c45a37555d.dev1/1300-repo-clock-fixture, cut from that sha.makeTerminalJob(defaultnew Date()), andtest/repoClockWarning.test.tsrendering one fixed job twice; red first.test(helpers): let makeTerminalJob take the instant it stores (#1300)
test: pin the repository-page clock fixture to one stored instant (#1300