Repository navigation
test: pin the four architecture-content exports no test names - #1275
Merged
Merged
Conversation
scripts/lib/architecture-content.mjs exports six transforms; only cleanMarkdown() and mirrorArtworkUrls() have a test file of their own. splitFrontmatter(), listValue(), renderProjectCards() and firstParagraph() are named by no test: their only assertions are whole-importer runs of scripts/import-architectures.mjs and scripts/import-architecture-issue.mjs. They read 100% region coverage that way, so the lines execute while nothing states what they return. Both callers are unattended importers of third-party text, and two of the contracts are load-bearing: renderProjectCards() resolves the card href through isCncfProjectHref() and falls back to a slug of the card header, so a hostile link cannot become the published destination; and it emits every attribute through jsxElement() as an expression attribute, so a quote in upstream prose cannot terminate the attribute and open a live prop. Closes #1274 Signed-off-by: quality <quality@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 keep the |
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
Adds
tests/architecture-content-helpers.test.mjs(15 tests), pinning the fourexports of
scripts/lib/architecture-content.mjsthat no test in the repositorynames:
splitFrontmatter(),listValue(),renderProjectCards()andfirstParagraph().The other two exports of that module each already have a test file —
cleanMarkdown()intests/architecture-content-clean-markdown.test.mjs,mirrorArtworkUrls()intests/architecture-content-mirror.test.mjs. These fourwere reached only transitively, through
scripts/import-architectures.mjsandscripts/import-architecture-issue.mjs, so they scored 100% region coverage whilenothing stated what they return. A behavioural change inside them moved no test as
long as the importer still finished.
What is now asserted:
splitFrontmatter— a---block parses and the body is trimmed; text withno block is valid input returning
{ frontmatter: {}, body: text }; an emptyblock yields
{}rather than thenullyamlParse('')returns.listValue— list passes through, scalar wraps,undefined/null/''give
[], and the truthiness guard means a numeric0orfalsealso gives[].renderProjectCards— a full{{< card >}}shortcode renders everyattribute; a non-CNCF link never becomes the card
href(theisCncfProjectHref()rejection falls back to a slug of the card header); a cardwith no link uses that same fallback; a
"in upstream prose is JSON-escapedinside the expression attribute rather than terminating it and opening a new
prop; an unresolvable logo is omitted rather than left pointing off-site; several
cards are all rewritten with surrounding prose untouched; a body with no
shortcode is returned unchanged.
firstParagraph— headings, images and markup are skipped; nothingqualifying returns
''; the summary is capped at 240 characters.Both call sites are unattended importers of third-party text — a
cncf/architectureclone and a GitHub issue form — which is why the two
renderProjectCardscasesabove are the load-bearing ones.
No production code changes; one new test file.
Verification
Revision
365e11f(main), clean checkout,npm ci, node v26.10.0:node --test tests/architecture-content-helpers.test.mjs→ 15 passed, 0 failed.npm run test:unit:coverage:check→ passes.src filesgoes from2713/2713to2729/2729regions at 100.00%: 16 regions that previouslyexisted only as incidental importer execution are now directly asserted.
npx prettier --checkandnpx cspell lintclean on the new file.Scope / overlap
Touches
tests/architecture-content-helpers.test.mjsonly — a new file. Disjointfrom every open hold-gated PR: #1250 (
package.json,tests/coverage-gate-thresholds.test.mjs), #1252, #1262, #1266, #1269, #1273,#1260 and the three
fix(security)PRs touch no file in this cluster, and none ofthem names
architecture-content.Related Issue
Closes #1274
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88