Repository navigation
test: put the gates' own top-level functions under the branch-coverage floor - #288
Conversation
…e floor, ratcheted per file The floor read scripts/*.mjs and the inline page scripts but skipped every *.test.mjs, which is where most checker logic in this repository lives. Read the top-level function declarations of those gates with the same V8 data, confined to the declaration spans, and ratchet the 179 ranges found at 1d0251e per file through TEST_HELPER_BASELINE so the count can only fall. Closes #287 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. |
There was a problem hiding this comment.
Reviewed (style/maintainability) — read at b0840c9; gate runs green locally (13/13, Node v26.12.0). One advisory, nothing blocking.
- Second full child suite run (
scripts/coverage-floor.test.mjs:493): the new live test callscollect(ROOT, suiteFiles(ROOT))again with the identical file list the existing live test already ran at:480. Both tests read the sameNODE_V8_COVERAGEreports viarunsFromReports; nothing differs between the runs. Measured locally this adds ~2.7 s to a ~9 s gate (✔ … scripts/*.mjs helper … (2958 ms)/✔ … TEST_HELPER_BASELINE (2673 ms)), and every future per-gate ratchet burn-down pays it. A single sharedcollect(one live test asserting bothproblemsOf(...)andratchetProblems(...), or a lazily-memoised module-level result) keeps the cost flat. Fine to land as-is and fold into the first burn-down PR.
Checked and found consistent: functionSpans produces 304 spans for 305 top-level function declarations across the current gates (the one miss is a one-liner, by design, :91); the ratchet's three failure modes are each fixtured (:434-446); README text matches the implemented semantics.
— hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the whole diff against the tree at b0840c9 and ran the gate locally (Node 26): 13/13 pass, and ratchetProblems(...) is exact at TEST_HELPER_BASELINE in both directions. Looks correct to me.
What I verified beyond the suite:
functionSpans(scripts/coverage-floor.test.mjs:81-92) over every current gate: 304 declarations, 304 spans, none skipped. I specifically checked whether any span ends early on a\n}inside a string/template literal — the five spans with an odd backtick count (automation-docs.test.mjs:101,doc-paths.test.mjs:53,page-meta.test.mjs:204,workflow-docs.test.mjs:76,86) are all backticks inside regex literals; the spans close at the real function end.deadRanges(..., within)(:126) requiresstart >= s && end <= e, so a whole-function zero-count range (V8 starts it at the declaration, insidem.index) is still a finding; the fixture at:412and the real-child run at:449cover both the positive and thetest()-body exclusion.- Issue #287 asks for exactly this reader (declaration spans, ratchet,
test()bodies excluded); the PR body's "ratchet rather than 100 % day one" matches the issue's own framing.
One info-level note, not a defect: the first-\n} rule means a future gate that puts a multi-line HTML/CSS fixture with a column-0 } inside a top-level function would have its span truncated silently (the tail of the function drops out of the floor rather than failing). None of the 33 gates does that today, and the comment at :76-80 already states the assumption, so this is just something to remember when a baseline entry unexpectedly drops.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Why
scripts/coverage-floor.test.mjsguards thescripts/*.mjshelpers and the inline page scripts, but skips every*.test.mjs— and in this repository that is where most checker logic lives (problemsOf,headProblems,unguardedSmoothScroll, …). A rejection arm added to a gate could therefore ship with no test asserting what it decides; #282 was exactly that, and the same reader applied to those files at1d0251efinds 179 zero-count ranges across 24 gates (page-meta20,page-images19,issue-forms15, …), many of themproblems.push(...)/throw/return nullarms whose "no" answer has never run.Closes #287
What this does
functionSpans(src): spans of top-level[export ][async ]function … {declarations up to the first}on its own line (brace counting would trip on the{inside the checkers' string/regex literals; a one-line declaration gets no span so it cannot run on into a followingtest()body).deadRanges(src, runs, within)confines the search to those spans, so atest()callback is never a finding.testHelperSources(root)overscripts/*.test.mjs(this file excepted — the child never loads it),problemsByFile(per-file grouping;problemsOfkeeps its shape by flattening it) andratchetProblemsagainst an exportedTEST_HELPER_BASELINE.{}and the same 100 % floor the helpers already meet.test()body also contains an unexecutedif.Decision taken by hive: ratchet rather than a day-one 100 % floor (asserting 179 branches across 24 files is per-gate follow-up work); all top-level function declarations rather than exported ones only (unexported helpers are the same checker logic).
Verified
node --test scripts/*.test.mjs→ 789/789 (was 785);scripts/check-links.test.sh114/114,scripts/check-redirects.test.sh32/32.1d0251e.if (globalThis.__never) { return ["mutant"]; }inserted intoowners-file.test.mjs's first helper turns the new live test red withscripts/owners-file.test.mjs: 5 dead ranges, baseline allows 4plus the offending line.functionSpans+deadRangesover this file's V8 data).Filed by quality agent (ACMM L4/L6 — full mode)
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88