Repository navigation
Description
Part of #2948.
Observed
bun scripts/ci-timings.ts report --out <dir> reads snapshots in directory-listing order (readSnapshots, readOperationalData in scripts/ci-timings.ts), and deduplicate keeps the later-read copy when two copies of one attempt have the same collectedAt. The hourly collector rewrites seeded snapshots with new PR attribution but keeps their collectedAt. Across the 39 retained artifacts created before 2026-10-24, 146 of 1,080 run attempts have same-time copies that differ in run.prs and run.attribution.
The same 39 artifacts, extracted into sibling directories and reported directly, gave coverage.unattributedCIAttempts 87 and pairedPRs 57. The archive built from them (#2955) gave 1 and 84, because compaction orders equal-time copies deterministically and lets the attributed copy win. Readdir order is filesystem-dependent, so the directory report can change between machines without any change in its inputs.
Context pointers (main 9e7429a91)
deduplicate(scripts/ci-timings.ts:202-215): at equalcollectedAt,Date.parse(old) <= Date.parse(new)picks the later-read copy. It only back-fillsrun.prsfrom the older copy when the newer one has none and the older one was attributed by exact merged squash SHA.readSnapshots(scripts/ci-timings.ts:352-360) andreadOperationalData(scripts/ci-timings.ts:403-428) iteratereaddirresults in the order the filesystem returns them.
Scope
- Make the directory report's result independent of listing order. Either sort what it reads deterministically, or make
deduplicate's tie-break independent of input order. In both cases, at equalcollectedAtthe PR-attributed copy of an attempt wins. - Apply the same rule to the operational records
readOperationalDatamerges, wherever their deduplication also depends on read order.
Out of scope
- Archive compaction (ci: archive CI evidence beyond GitHub retention and backfill the current artifacts #2955), which already orders equal-time copies deterministically.
- The hourly collector rewriting seeded snapshots without updating
collectedAt. - Any change to report fields or their definitions.
Acceptance criteria
- The directory report gives the same summary for the same files whatever the listing order, proven by a test that reverses or shuffles the read order.
- At equal
collectedAt, the PR-attributed copy of an attempt wins, as it does in the archive.
Verification
- A test in
tests/ci-timings.test.tsthat reads the same snapshot set in forward and reversed or shuffled order and gets the same summary. It fails on main before the change. bun run test tests/ci-timings.test.ts tests/ci-timings-collection.test.ts.
Contract impact
None.
2026-11-17 triage: added source pointers, Scope, Out of scope and Verification from the observed behaviour. The acceptance criteria are unchanged.
Activity