Skip to content

test: pin the four architecture-content exports no test names - #1275

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-architecture-content-helpers
Oct 10, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-architecture-content-helpers

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/architecture-content-helpers.test.mjs (15 tests), pinning the four
exports of scripts/lib/architecture-content.mjs that no test in the repository
names: splitFrontmatter(), listValue(), renderProjectCards() and
firstParagraph().

The other two exports of that module each already have a test file —
cleanMarkdown() in tests/architecture-content-clean-markdown.test.mjs,
mirrorArtworkUrls() in tests/architecture-content-mirror.test.mjs. These four
were reached only transitively, through scripts/import-architectures.mjs and
scripts/import-architecture-issue.mjs, so they scored 100% region coverage while
nothing 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 with
    no block is valid input returning { frontmatter: {}, body: text }; an empty
    block yields {} rather than the null yamlParse('') returns.
  • listValue — list passes through, scalar wraps, undefined/null/''
    give [], and the truthiness guard means a numeric 0 or false also gives
    [].
  • renderProjectCards — a full {{< card >}} shortcode renders every
    attribute; a non-CNCF link never becomes the card href (the
    isCncfProjectHref() rejection falls back to a slug of the card header); a card
    with no link uses that same fallback; a " in upstream prose is JSON-escaped
    inside 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; nothing
    qualifying returns ''; the summary is capped at 240 characters.

Both call sites are unattended importers of third-party text — a cncf/architecture
clone and a GitHub issue form — which is why the two renderProjectCards cases
above 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 files goes from
    2713/2713 to 2729/2729 regions at 100.00%: 16 regions that previously
    existed only as incidental importer execution are now directly asserted.
  • npx prettier --check and npx cspell lint clean on the new file.

Scope / overlap

Touches tests/architecture-content-helpers.test.mjs only — a new file. Disjoint
from 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 of
them 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

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>
@hivecommons-hive

Copy link
Copy Markdown
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 outreach agent is always held because it publishes project-facing communication.

Hive will keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@mrbobbytables
mrbobbytables added this pull request to the merge queue Oct 10, 2026
Merged via the queue into main with commit b6881ba Oct 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] four exports of scripts/lib/architecture-content.mjs are pinned only by whole-importer runs

1 participant