Repository navigation
test: put the inline page scripts under the branch-coverage floor - #276
Conversation
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>
|
[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 |
There was a problem hiding this comment.
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—inlineScriptrequires exactly one<script>block matching the hook and appends a//# sourceURL=inline:<page>#<hook>trailer; all three harnesses now compileinlineScript(...).srcvianew 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 ascompiled − src.length − "\n})".length, which matches the(function anonymous(params\n) {\nbody\n})shapenew Functionproduces 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 islineOf(src, start) + line − 1, wherelineis 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 repeatednew Functioncompilations of the same block from several harness tests union correctly.node --test scripts/*.test.mjson the PR head: 765/765 pass (Node 26).- Mutation: inserted
if (window.__never) { console.log('x'); }afterindex.html:672, regenerated CSP hashes, and the gate failed withindex.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
There was a problem hiding this comment.
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-172recovers thenew Functionwrapper width asmaxEndOffset − src.length − "\n})".lengthand shifts/clamps ranges back into the body.problemsOf(:92-98) then addsline − 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.mjson the PR head: 765/765, live gate green. - Mutation check, independently of the PR body's claim: inserted
if (window.__never) { stop(); }atindex.html:673in 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 throughinlineScript(...).src, so every registered block gets the sourceURL; thewrapper < 0arm ininlineRunsFromReportscatches 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
## Checkstext 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
Summary
Puts the four inline page scripts (hero carousel, ACMM levels, projects carousel in
index.html; story dialog instories/index.html) under the branch-coverage floor from #254, which so far read V8 coverage forscripts/*.mjsonly. The harnesses compile each block withnew 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 inkeyGoTo.scripts/inline-scripts.mjs(new helper) ownsHARNESSED_SCRIPTS(moved frompage-scripts.test.mjs) andinlineScript(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.mjsalso reads theinline:scripts, shifts offsets past the(function anonymous(…) {wrapper, and reportspage#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'sthrowarm is asserted inpage-scripts.test.mjs.## Checksentries forpage-scriptsandcoverage-floorupdated.Mutation check: adding
if (window.__never) { stop(); }to the hero script (CSP hashes regenerated) fails the floor withindex.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.mjsglob.Closes #275
Checks run locally
node --test scripts/*.test.mjs— 765/765scripts/check-links.sh --external-warn— 190 links, 0 errorsscripts/check-links.test.shscripts/check-redirects.test.shscripts/check-redirects.sh— 13/13Checklist
MAPinmake-redirects.sh(none changed)<script>, I rannode scripts/update-csp-hashes.mjs(no inline script edited)sitemap.xml(none added)index.htmlis mirrored inllms.txt(none)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