Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

test(scripts): hoist the whole-repository scan out of check-unused-dependencies' timed window - #8543

Merged
baozhoutao merged 1 commit into
mainfrom
claude/issue-8479-coverage-shard-1-red
Sep 8, 2026
Merged

baozhoutao merged 1 commit into
mainfrom
claude/issue-8479-coverage-shard-1-red

Conversation

@baozhoutao

Copy link
Copy Markdown
Contributor

Fixes #8479

The failing test, named

main's push-lane coverage gate has been unevaluated since 2026-09-07T08:28:39Z. The card and the triage comment both stop at "which test fails inside the coverage shard is not established". It is:

FAIL  |unit| scripts/__tests__/check-unused-dependencies.test.ts > this repository > is green: every gated declaration has a consumer
Error: Test timed out in 15000ms.
 ❯ scripts/__tests__/check-unused-dependencies.test.ts:378:3

FAIL  |unit| scripts/__tests__/check-unused-dependencies.test.ts > this repository > scans a population big enough for the verdict to mean something
Error: Test timed out in 15000ms.
 ❯ scripts/__tests__/check-unused-dependencies.test.ts:394:3

FAIL  |unit| scripts/__tests__/check-unused-dependencies.test.ts > this repository > keeps the non-gated fields VISIBLE rather than absorbed
Error: Test timed out in 15000ms.
 ❯ scripts/__tests__/check-unused-dependencies.test.ts:401:3

Three timeouts. ⛔ The gate itself is green — findings is [] on every pass that completes. Nothing is wrong with check-unused-dependencies.mjs.

Why the log never carried that summary

⚠️ Worth recording, because the card, the triage comment and the dispatch note all read this as the Actions log API windowing the failure summary out. It is not.

The shard step runs with --reporter=blob as its only reporter, so no vitest failure summary is ever written to stdout. The full job log for 101973830157 is 397 lines end to end and contains a 15-minute silence between the ##[group]Run line and the first test stdout. The summary was never emitted; no download channel would have produced it. Reproducing locally is the only way to get the name — which is what this PR did.

(The check-vi-mock-specifiers / check-vi-mock-inherit "the population COLLAPSED — sources: found 0, floor is 1000" text in that log's tail is fixture output from those gates' self-tests, exactly as the dispatch note cautioned. It is not the failure.)

The cause

The three tests each call analyze(repoRoot) and then read one field of the result — findings, counters, measured. That is the same whole-repository walk (47 manifests, >1000 files) paid for three times, each pass inside a bounded assertion window.

On PRs the suite runs uninstrumented and each pass fits inside vitest's 15 s testTimeout. The push lane runs the same 4-way shard split under v8 coverage (if: github.event_name == 'push'), and there a single pass crosses it. That is the entire difference between the two lanes.

Because coverage.thresholds live only on the merged 4-shard report — the shard legs override them to zero — one red shard skips the merge and the thresholds are not evaluated at all. The sentinel has been reporting exactly that, correctly.

The fix

Hoist the scan to module scope as REPOSITORY_SCAN, where the cost lands in the import phase that no testTimeout governs.

Not a beforeAll, which would trade the 15 s testTimeout for the narrower 10 s hookTimeout. This is the same defect class and the same remedy as #8419, which moved check-doc-links.test.ts's corpus walk to ANCHOR_CORPUS last night.

⛔ No timeout was raised. ⛔ No threshold was lowered. ⛔ No continue-on-error. The three tests read the same three fields of the same verdict they read before; a real finding still reds them.

Verification — same box, same command, before and after

The workflow's own command, copied from the job's ##[group]Run line, with --reporter=default added so failures are named. Both legs ran under the shared heavy-verify lock.

pnpm test:coverage --reporter=blob --reporter=default --shard=1/4 \
  --coverage.thresholds.lines=0 --coverage.thresholds.functions=0 \
  --coverage.thresholds.branches=0 --coverage.thresholds.statements=0
leg tree result that file
before 3bc187b7f (origin/main) exit 1 — Tests 3 failed | 8943 passed (37 tests | 3 failed) 82977ms
after e4af215f1 (this branch) exit 0 — Test Files 682 passed (682), Tests 8946 passed | 1 skipped (37 tests) 1992ms

Single-file run after the fix shows where the cost moved: Duration 7.89s (import 7.06s, tests 454ms).

Control, so "shard 1 is green" is a reading and not an artefact of a query that cannot see red: the same command on the same tree without --coverage was already green before the fix (682 passed, exit 0, 12m04s) — the failure is coverage-lane-specific, and the instrumented leg is the one that changed verdict.

Gates run locally: check-changeset-presence (exit 0 — "No source or published contract of a released package changed in this range, so no changeset is owed"), check-control-bytes (exit 0, 6746 files), eslint on the changed file (exit 0). No changeset is owed and none is added; ⛔ no skip-changeset label, which this repository does not use.

Corrections to the readings this card was dispatched with

⚠️ Each of these was measured here; the numbers in the card, the triage comment and the dispatch note were explicitly flagged as predictions.

  • "66 consecutive failures" → 81. Re-derived over 400 branch=main&event=push runs of ci.yml. Control in the same window: 119 successes, so the query returns green when green exists. Last green is unchanged: 3c6394cb2 @ 2026-09-07T08:28:39Z.
  • "It is coverage shard 1/4 on all six" holds for that six-run window but not for the streak. The streak's first failure, run 34107014367 @ 272ea0302 @ 2026-09-07T09:36:56Z, failed on Test (coverage shard 2/4) alone; shard 1 first joined four runs later, at 0ea7054f8 @ 09:52:35 — the commit that landed this gate (feat(tooling): gate a DECLARED-but-never-imported dependency, and remove the 37 this repository had #8304). Walking the streak, the failing shard is 2, then 1, then both, oscillating. Consistent with a per-test timeout whose file moves between shards as the file list grows.
  • "The vitest failure summary is absent from what the API returned — the same windowing." No. See above: with --reporter=blob alone it is never produced.
  • The raw log download being 403 at this container's proxy is confirmed, and so is the artifact download: GET /actions/artifacts/{id}/zip fails CONNECT tunnel failed, response 403 on its redirect to blob storage. The REST listing endpoints themselves work fine.

Not fixed here, and deliberately not widened

Test (coverage shard 2/4) failed intermittently earlier in the streak and is not named by this PR — the last seven completed runs on main show shard 1 as the only red shard, so this change is what the live blocker needs. If shard 2 reds again after this lands, the gate still will not run, and that is a separate name to read. ⛔ Not folded in here.

🤖 Generated with Claude Code


Generated by Claude Code

…pendencies' timed window

The three tests in `check-unused-dependencies.test.ts`'s `this repository` block
each called `analyze(repoRoot)` and then read one field of the result. That is
the same whole-repository walk — 47 manifests, >1000 files — paid for three
times, each pass inside a bounded assertion window.

On the push lane the suite runs under v8 coverage instrumentation, and there a
single pass crosses vitest's 15 s `testTimeout`. All three tests then fail with
`Test timed out in 15000ms` while the gate they exercise is green. Because the
coverage thresholds live only on the merged 4-shard report — the shard legs
override them to zero — one red shard skips the merge and the thresholds are
never evaluated on that commit at all.

Hoist the scan to module scope as `REPOSITORY_SCAN`, where the cost lands in the
import phase that no `testTimeout` governs. Not a `beforeAll`, which would trade
the 15 s `testTimeout` for the narrower 10 s `hookTimeout` — the same reasoning
that moved `check-doc-links.test.ts`'s corpus walk to `ANCHOR_CORPUS`.

No timeout was raised and no assertion was weakened: the three tests read the
same three fields of the same verdict they read before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
@claude

claude Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

LANDED — 83d4fda16 on origin/main. domain:devx @ objectui execution seat, PM session session_01FhBNJcLRZLe8M87VcUgpKr, R47, 2026-09-08T09:45Z. PR #8543 (card objectui#8479), merged first pass.

Landing probe, on a re-fetched origin/main (83d4fda16)

Every row is git grep -c -F … origin/main -- scripts/__tests__/check-unused-dependencies.test.ts.

probe expect read
REPOSITORY_SCAN > 0 4 (the declaration + three readers)
} = REPOSITORY_SCAN; — the readers 3 3
negative — } = analyze(repoRoot);, a per-test walk 0 0
⭐ firing control — this repository, present before and after > 0 4
⭐ nonsense control — zzq-not-a-real-token-8479 0 0

⚠️ Both zeros were re-taken because the first attempt ran the probe from the wrong directory and returned exit 128 — not a git repository — which prints as no output and would have read as a clean zero if the exit code had not been captured. ⇒ Re-run from the repository, both zeros are exit 1 (a real no-match). ⭐ That is the same class as the $-anchor case on objectui#8465 today: a zero that is not a reading.

⛔ The merge is NOT the proof, and this card does not close on it

main's CI push run for 83d4fda16 is 34209955709, still in progress at 09:44Z. The claim this card makes is that the coverage gate has not been evaluated for 84 consecutive push runs; the only thing that falsifies that going forward is a green main push run, ⛔ not a merged PR.

⇒ This seat will read 34209955709 to completion and report the verdict here. Two outcomes, both stated in advance so neither can be narrated after the fact:

  • Green ⇒ the coverage thresholds are evaluated on main again for the first time since 2026-09-07T08:28:39Z, and this card is done.
  • Still red ⇒ there is a second failure behind the one that was fixed, and its name is the next deliverable. ⚠️ The dev flagged exactly this possibility rather than assuming its fix was sufficient: Test (coverage shard 2/4) failed on many runs across the streak — including the streak's first four, where it was the only red shard — and it never reproduced that one, so it has no name for it. ⇒ If shard 2 reds now, that is a new card, ⛔ not this one re-opened.

What is now on main

Three tests that each ran the same whole-repository walk (47 manifests, >1000 files) inside a bounded assertion window now read one hoisted REPOSITORY_SCAN computed at module scope, where the cost lands in the import phase that no timeout governs. ⛔ Not beforeAll, which would have traded the 15 s testTimeout for the narrower hookTimeout default. ⛔ No assertion changed, ⛔ no timeout raised, ⛔ no threshold lowered, ⛔ no continue-on-error, ⛔ no test skipped.

⭐ The class behind it is objectui#8545, and the same instance — same file, same assertion — was already filed weeks ago as objectui#8380, whose own suggested remedy was the timeout raise this PR deliberately refused.


Generated by Claude Code

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

main's CI workflow has failed 66 consecutive runs — the coverage gate has not been evaluated on any commit since 2026-09-07T08:28Z

2 participants