Skip to content

test: cover docs/ and blog/ MDX component import and prop contract (tests/mdx-components.test.mjs) - #298

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-mdx-components
Open

kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-mdx-components

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds one new test-only file, tests/mdx-components.test.mjs (5 tests), the
first test in the repo that reads MDX component imports or JSX props out of
docs/ and blog/. It uses only node:test, node:assert/strict, node:fs
and node:path.

Files claimed by this PR: tests/mdx-components.test.mjs (new). Nothing
else — no production code, no content, no workflow file, no package.json, no
lockfile, no dependency.

What is asserted

  • Every capitalized JSX tag used in a file is imported in that same file.
    MDX renders an un-imported capitalized tag as an unknown element.
  • Every @site/ import specifier resolves to a file on disk, with
    index.js/.jsx/.tsx directory resolution.
  • Every <CNCFProjectCard /> supplies name and href. name is
    dereferenced unconditionally (name.slice(0, 1) in the fallback-logo branch)
    and href is the card's only navigation target, so neither has a usable
    default.
  • No <CNCFProjectCard /> passes a prop the component does not destructure.
    The accepted set is parsed out of src/components/CNCFProjectCard/index.js
    itself, so renaming a prop there cannot silently diverge from the 50
    hand-authored usages in docs/architectures/*.md.
  • The scan is non-empty, so none of the above can pass vacuously.

Fenced and inline code is stripped before scanning — otherwise the literal
`src/components/<Name>/index.js` in docs/skills/ui-standards.md reads as
a component usage.

Why this is not already covered

.github/workflows/ci.yml runs npm run build:production on every PR, so an
un-imported tag or a moved component directory is caught — but late, as a
webpack error wall after npm ci plus a full production build, rather than a
named assertion.

A misspelled prop is caught by nothing at all. MDX passes unknown props
straight through and CNCFProjectCard destructures a fixed set, so
descripton="..." or url="..." is dropped silently: the card renders without
the text or the link, the build stays green, and no validator reports it.

Verification

node --test at rev 00b44df: 60 tests pass, 0 fail (55 existing + 5 new).
Every assertion was mutation-checked to confirm it bites — removing the
AwardsTimeline import from docs/awards/index.md, repointing that import at a
nonexistent @site/src/components/NopeTimeline, and renaming name= to nmae=
and href= to hrefx= on a card in docs/architectures/adobe.md each turned
the corresponding test red. The working tree was restored clean after each.
npx prettier --check tests/mdx-components.test.mjs passes.

Scope / non-overlap

Claims exactly one file and one cluster: MDX component import and prop wiring in
docs/ and blog/. It deliberately does not assert markdown-link or frontmatter
integrity (#296), navbar/sidebar wiring (#275), /img static asset resolution
(#289), the data/architectures catalog-to-docs contract (#260), blog/
frontmatter (#270), or package.json/workflow command wiring (#278). It adds no
JSX transpilation helper and does not import any src/ React module, so it does
not touch the component-test infrastructure in #229 or #268.

Related Issue

Closes #297 — this PR lands every box on that issue's task list, so nothing is
left for it to track.


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-opus-5

Adds tests/mdx-components.test.mjs (5 tests) over every docs/**/*.md{,x} and
blog/**/*.md{,x}:

- every capitalized JSX tag used in a file is imported in that same file
- every @site/ import specifier resolves to a file on disk
- every <CNCFProjectCard /> supplies name and href
- no <CNCFProjectCard /> passes a prop the component does not destructure
- the scan is non-empty, so the assertions cannot pass vacuously

Fenced and inline code is stripped before scanning so the literal
src/components/<Name>/index.js in docs/skills/ui-standards.md is not read as a
component usage.

The accepted CNCFProjectCard prop set is parsed out of the component's own
destructuring rather than hardcoded, so renaming a prop there cannot silently
diverge from the 50 hand-authored usages in docs/architectures/.

Test-only: no production code, no content, no workflow, no package.json, no
lockfile and no new dependency.

Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
@kubestellar-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 automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@kubestellar-hive kubestellar-hive Bot added quality Approved by a Hive merger/owner for auto-merge on green CI testing Approved by a Hive merger/owner for auto-merge on green CI agent/quality Approved by a Hive merger/owner for auto-merge on green CI hive/hosted-available-lke648397-260827-5n31 Approved by a Hive merger/owner for auto-merge on green CI labels Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/quality Approved by a Hive merger/owner for auto-merge on green CI hive/hosted-available-lke648397-260827-5n31 Approved by a Hive merger/owner for auto-merge on green CI hold quality Approved by a Hive merger/owner for auto-merge on green CI testing Approved by a Hive merger/owner for auto-merge on green CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] docs/ and blog/ MDX component imports and CNCFProjectCard props have no unit coverage

0 participants