Skip to content

test: put the gates' own top-level functions under the branch-coverage floor - #288

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-floor-test-helpers
Oct 28, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-floor-test-helpers

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Why

scripts/coverage-floor.test.mjs guards the scripts/*.mjs helpers 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 at 1d0251e finds 179 zero-count ranges across 24 gates (page-meta 20, page-images 19, issue-forms 15, …), many of them problems.push(...) / throw / return null arms 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 following test() body). deadRanges(src, runs, within) confines the search to those spans, so a test() callback is never a finding.
  • testHelperSources(root) over scripts/*.test.mjs (this file excepted — the child never loads it), problemsByFile (per-file grouping; problemsOf keeps its shape by flattening it) and ratchetProblems against an exported TEST_HELPER_BASELINE.
  • Ratchet semantics: a file may carry at most its baseline count (0 when absent); fewer fails too, with the number to lower it to, so the map only shrinks; a baseline entry for a file that is not a gate fails. End state is {} and the same 100 % floor the helpers already meet.
  • New live test every branch of every gate's own top-level functions is executed by the suite, down to TEST_HELPER_BASELINE; three fixture self-tests, including a real child run over a tmp gate with one dead branch whose test() body also contains an unexecuted if.
  • README entry updated.

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.sh 114/114, scripts/check-redirects.test.sh 32/32.
  • Ratchet is exact at the baseline in both directions at 1d0251e.
  • Mutation check: an if (globalThis.__never) { return ["mutant"]; } inserted into owners-file.test.mjs's first helper turns the new live test red with scripts/owners-file.test.mjs: 5 dead ranges, baseline allows 4 plus the offending line.
  • Every branch of the code added here is executed by the floor's own run (checked with functionSpans + deadRanges over 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

…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>
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no findings from this perspective.

— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no findings from this perspective.

— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 calls collect(ROOT, suiteFiles(ROOT)) again with the identical file list the existing live test already ran at :480. Both tests read the same NODE_V8_COVERAGE reports via runsFromReports; 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 shared collect (one live test asserting both problemsOf(...) and ratchetProblems(...), 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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no findings from this perspective.

— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) requires start >= s && end <= e, so a whole-function zero-count range (V8 starts it at the declaration, inside m.index) is still a finding; the fixture at :412 and the real-child run at :449 cover both the positive and the test()-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

@hivecommons-hive
hivecommons-hive Bot merged commit 0d44eb7 into main Oct 28, 2026
6 of 7 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-floor-test-helpers branch October 28, 2026 05:00
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#288b0840c9` sha256:b6b9d798ee57f8523a8b97f67c5ca29dbe1bada5c43673c3bbba40f7e0968769 — download from the dashboard or `hivectl review evidence #288`.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off dco-signoff: yes size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] Branch-coverage floor skips the top-level functions of the *.test.mjs gates — 179 unasserted ranges in 24 gates

0 participants