test(import-architectures): cover the seven uncovered sub-line regions - #678
Closed
hivecommons-hive[bot] wants to merge 1 commit into
Closed
hivecommons-hive[bot] wants to merge 1 commit into
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
scripts/import-architectures.mjs scored 100.00% line coverage but only
92.22% region coverage -- the lowest region score of any shipped source
file. Seven executable regions never ran, three of them fail-closed
paths whose regression would leave the line score untouched.
Adds tests/import-architectures-fallbacks.test.mjs covering:
L183 the '?? {}' fallback in splitFrontmatter for an empty block
L234 both arms of cleanMarkdown's image rewrite -- a non-artwork
remote image demoted to a plain link, and an artwork image
rewritten to its mirrored /img/cncf-projects path
L249 the 'continue' in mirrorProjectAssets for an artwork URL with
no derivable mirror name, asserted to skip before any fetch
L280 the "?? ''" fallback in firstParagraph for a body with no prose
L305 the false arm of walkFiles' 'entry.isFile() ? [path] : []',
reached with a FIFO in images/
L338 both dimension ternaries in sanitizeArchitectureAssets -- an SVG
L339 with no viewBox and no width/height gains no NaN viewBox, while
a sized SVG still gains a real one
Adds an upstreamFifos option to runImportArchitectures; a named pipe is
the only entry kind that is neither symlink, directory nor regular file.
scripts/import-architectures.mjs now reports 100.00% region coverage and
source region coverage rises from 97.95% to 98.39%.
Closes #677
Signed-off-by: hivecommons-hive[bot] <hivecommons-hive@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
This was referenced Sep 26, 2026
Closed
Member
|
Superseded by #750, which consolidates this and 14 other test-only coverage PRs into a single reviewable change (commit cherry-picked unmodified, authorship and DCO preserved). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
scripts/import-architectures.mjsscored 100.00% line coverage but only 92.22% region coverage — the lowest region score of any shipped source file. Region coverage (#640) scores a maximal run of offsets sharing one V8 count, so it sees the??fallbacks, ternary arms andcontinueguards that line coverage hides whenever the rest of the line runs.Seven executable regions never ran. Three of them are fail-closed paths (no hot-linking, no unmirrorable fetch, no special files) whose regression would have left the line score at 100%.
This PR adds
tests/import-architectures-fallbacks.test.mjs(8 tests) and one new option ontests/helpers-import-sandbox.mjs. No production code is touched.yamlParse(...) ?? {}insplitFrontmattertitle/organizationfall back to the directory idcleanMarkdown[alt](url)and asserted to carry no![...]; an artwork image is rewritten to/img/cncf-projects/...and mirroredif (!relativeDestination) continue;inmirrorProjectAssetsCould not mirrorwarning the stubbed fetch would otherwise produceparagraph?... ?? ''infirstParagraph''entry.isFile() ? [path] : []inwalkFilesimages/is dropped by the walk, asserted via the absence of the extension warning it would otherwise triggersanitizeArchitectureAssetsviewBoxand nowidth/heightgains noviewBoxand noNaN; a sized SVG still gainsviewBox="0 0 320 240"The
234,338/339rows each pair the new arm with its opposite arm, so "no hot-link" cannot be satisfied by dropping every image and "noNaNviewBox" cannot be satisfied by never adding one.Helper change
runImportArchitecturesgains anupstreamFifosoption. A named pipe is the only directory entry that is neither a symlink, a directory, nor a regular file, so it is the only way to reachwalkFiles' final rejection arm — the one that backstops the symlink defence from #548.cp -Rin the existinggit clonestub recreates a FIFO as a FIFO, so it reaches the importer exactly as an upstream special file would.Verification
src filesregion coverage rises 97.95% → 98.39%;scripts/import-architectures.mjsreaches 100.00%.npx prettier --checkandnpx cspellare clean on both changed files.Claimed ground
Files:
tests/import-architectures-fallbacks.test.mjs(new),tests/helpers-import-sandbox.mjs.Functions under test:
splitFrontmatter,cleanMarkdown,mirrorProjectAssets,firstParagraph,walkFiles,sanitizeArchitectureAssetsinscripts/import-architectures.mjs.Disjoint from #676 (
scripts/lib/mdx-active-content.mjs,tests/mdx-active-content.test.mjs) and from #674 (package.jsoncoverage gate) — no file, function or threshold overlaps. This PR is a beneficiary of #674: it raises the source region number that #674 proposes to gate.Related Issue
Closes #677
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88