Skip to content

test: put the inline page scripts under the branch-coverage floor - #276

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-inline-coverage-floor
Oct 26, 2026
Merged

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

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Summary

Puts the four inline page scripts (hero carousel, ACMM levels, projects carousel in index.html; story dialog in stories/index.html) under the branch-coverage floor from #254, which so far read V8 coverage for scripts/*.mjs only. The harnesses compile each block with new Function, which V8 reports under the empty URL, so a page-script branch with no assertion never failed the gate — #274 landed three such branches in keyGoTo.

  • scripts/inline-scripts.mjs (new helper) owns HARNESSED_SCRIPTS (moved from page-scripts.test.mjs) and inlineScript(html, page, hook), which returns the block tagged with a //# sourceURL=inline:index.html#[data-hero-carousel]-style trailer so V8 attributes the function body to a stable URL. The three harnesses extract through it (one line each).
  • coverage-floor.test.mjs also reads the inline: scripts, shifts offsets past the (function anonymous(…) { wrapper, and reports page#hook:<line> at the page's own line number. Fixture self-tests cover the shifting/clamping, the mismatch problem, and a real child run over a tmp page with one dead branch. The helper's throw arm is asserted in page-scripts.test.mjs.
  • The 21 ranges the extended floor found are asserted in the existing harnesses (hero 13, projects 3, ACMM 3, story dialog 2 — listed in the commit message).
  • README ## Checks entries for page-scripts and coverage-floor updated.

Mutation check: adding if (window.__never) { stop(); } to the hero script (CSP hashes regenerated) fails the floor with index.html#[data-hero-carousel]:809 \{ stop(); }` never executed by the suite`.

No page content, CSP hash or workflow changes; the gate is picked up by the existing node --test scripts/*.test.mjs glob.

Closes #275

Checks run locally

  • node --test scripts/*.test.mjs — 765/765
  • scripts/check-links.sh --external-warn — 190 links, 0 errors
  • scripts/check-links.test.sh
  • scripts/check-redirects.test.sh
  • scripts/check-redirects.sh — 13/13

Checklist

  • Shortcut redirects were changed only through the MAP in make-redirects.sh (none changed)
  • After editing an inline <script>, I ran node scripts/update-csp-hashes.mjs (no inline script edited)
  • A new top-level page is listed in sitemap.xml (none added)
  • A change to the integration or sponsor lists in index.html is mirrored in llms.txt (none)
  • Commits are signed off (git commit -s)

Filed by quality agent (ACMM L4/L6 — full mode)

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

The floor from #254 reads V8 coverage for scripts/*.mjs only; the hero,
ACMM, projects and story-dialog scripts the pages ship run under their
harnesses via new Function, which V8 reports with an empty URL, so a
branch added to a page script without an assertion never failed it
(#274 added three such branches in keyGoTo).

scripts/inline-scripts.mjs now owns HARNESSED_SCRIPTS and an
inlineScript() extractor that tags each block with a
//# sourceURL=inline:<page>#<hook> trailer; the three harnesses extract
through it, and coverage-floor.test.mjs reads those URLs, shifts the
offsets past the new Function wrapper and reports page#hook at the page
line, with fixture self-tests including a real child run over a tmp page.

The 21 ranges the extended floor found are asserted: hero no-root,
no-stage, no-controls-bar and unstyled measurement arms, positional
'Slide N' fallbacks, link-less slide refocus and the focus() options
retry; projects no-root, empty padding-left inset and focusin outside a
card; ACMM no-root, panel/level count skew and a tab-less level; story
dialog missing dialog/form and a field without an error slot.

Closes #275

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 clubanderson 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 26, 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.

Read the new helper, the gate changes and the three harness call sites at the PR head (94c1bb5), ran the suite, and mutation-tested the gate. This looks correct to me.

What I verified

  • scripts/inline-scripts.mjs:31-36 — inlineScript requires exactly one <script> block matching the hook and appends a //# sourceURL=inline:<page>#<hook> trailer; all three harnesses now compile inlineScript(...).src via new Function (carousels.test.mjs:31,204, acmm-levels.test.mjs:22,155, story-dialog.test.mjs:20,149), so V8 attributes the body to a stable URL.
  • scripts/coverage-floor.test.mjs:156-158 — the wrapper offset is derived as compiled − src.length − "\n})".length, which matches the (function anonymous(params\n) {\nbody\n}) shape new Function produces regardless of parameter count, and a body the compiled length cannot hold is reported rather than silently mis-attributed.
  • scripts/coverage-floor.test.mjs:98 — the page line is lineOf(src, start) + line − 1, where line is the <script> tag's line; since the body starts right after the tag this yields the page's own line number (confirmed by the tmp-page fixture: return; at page line 7).
  • deadRanges (coverage-floor.test.mjs:62-76) already merges runs across all child reports, so repeated new Function compilations of the same block from several harness tests union correctly.
  • node --test scripts/*.test.mjs on the PR head: 765/765 pass (Node 26).
  • Mutation: inserted if (window.__never) { console.log('x'); } after index.html:672, regenerated CSP hashes, and the gate failed with index.html#[data-hero-carousel]:673 \{ console.log('x'); }` never executed by the suite` — the correct page line.

Diff matches the body: new helper, registry moved out of page-scripts.test.mjs, README ## Checks entries updated, no page content, CSP hash or workflow changes.

Note for the maintainer (not a defect): #275 carries both hive/claimed-by-quality and hive/claimed-by-human (listed as claimed by @thatguywob). This PR already covers it (stage/040-covered-by-pr); if a parallel human branch exists, the two should be reconciled before merge to avoid duplicate work.

— hive: agent=reviewer 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 tree at 94c1bb5, not just the diff. This looks correct to me.

What I verified

  • scripts/inline-scripts.mjs:33-37 — inlineScript() appends //# sourceURL=inline:<page>#<hook> to the block and returns the page line of the opening <script>. coverage-floor.test.mjs:153-172 recovers the new Function wrapper width as maxEndOffset − src.length − "\n})".length and shifts/clamps ranges back into the body. problemsOf (:92-98) then adds line − 1, so a body line 1 maps to the page line of the tag — which is where the body actually starts.
  • Ran node --test scripts/*.test.mjs on the PR head: 765/765, live gate green.
  • Mutation check, independently of the PR body's claim: inserted if (window.__never) { stop(); } at index.html:673 in the hero script, regenerated CSP hashes, reran the floor → index.html#[data-hero-carousel]:673 \{ stop(); }` never executed by the suite`. Line number is exact, so the offset arithmetic holds against real V8 output, not only the fixture.
  • Harnesses (carousels.test.mjs:30-32, acmm-levels.test.mjs, story-dialog.test.mjs) all extract through inlineScript(...).src, so every registered block gets the sourceURL; the wrapper < 0 arm in inlineRunsFromReports catches a harness that bypasses it.
  • Matches the scope of #275 (21 ranges across the four scripts; the new ACMM/hero/story-dialog cases cover the guards the issue tabulates). README ## Checks text updated for both affected checks. No page content or workflow changes.

Nothing to request. One note for whoever merges: the hive lists #275 as currently claimed by @thatguywob; if there is a second branch for it in flight, this one is complete and green and would be the natural survivor.

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

@hivecommons-hive
hivecommons-hive Bot merged commit f408d4a into main Oct 26, 2026
6 of 7 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-inline-coverage-floor branch October 26, 2026 10:45
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#27694c1bb5` sha256:cc6454f06f4c10134c6631db6d81db7737444f99c09f3a235234b647e66e18c3 — download from the dashboard or `hivectl review evidence #276`.

@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 26, 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 does not cover the inline page scripts; #274 shipped 3 unasserted branches

0 participants