Skip to content

test: cover the blog/ frontmatter contract (tests/blog-frontmatter.test.mjs) - #270

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

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

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/blog-frontmatter.test.mjs — the first test in this repository that reads
anything under blog/.

Docusaurus fails build outright when a post names an author key absent from
blog/authors.yml or a tag key absent from blog/tags.yml. npm run check (prettier,
markdownlint, cspell, markdown-link-check) never resolves frontmatter keys, so until now
a typo in an author key first appeared as a red deploy.

What it asserts, against the committed content

assertion why it matters
every post authors: key resolves in blog/authors.yml unresolved key is a fatal build error
every post tags: key resolves in blog/tags.yml unresolved key is a fatal build error
post has title + slug, slug matches the filename after the YYYY-MM-DD- prefix filename/slug drift silently changes the published URL
post slugs are unique two posts at one URL
post has a {/* truncate */} (or <!-- truncate -->) marker without it the blog index renders entire posts
each authors.yml entry has name, title, url, image_url, both URLs https these are exactly the fields the author card renders
each tags.yml entry has label and description rendered on the tag pages

Inline author objects (legal in Docusaurus) are skipped for key lookup rather than
rejected, so the test does not forbid a valid authoring style it does not need to check.

Verification

  • node --test tests/blog-frontmatter.test.mjs — 8/8 pass at 00b44df.
  • Mutation-checked, not just run green: pointing a post at a ghost-author key, at a
    nonexistent-tag key, and stripping a tags.yml description each fail the
    corresponding test with a message naming the offending file and key (3 failures, 5
    still passing). Working tree restored afterwards.
  • Full suite npm run test:unit: 63/63 pass (55 before, +8).
  • npx prettier --check clean.

Scope

One new file, tests/blog-frontmatter.test.mjs. No production code, no CI change, no
package.json or lockfile change — parsing uses the yaml ^2.9.0 devDependency the
repo already declares and already uses in scripts/collect-metrics.mjs and
scripts/import-architectures.mjs.

Disjoint from every open quality PR by construction: this is the only one that touches
blog/. It does not add or modify tests/helpers.mjs (#231), tests/helpers-jsx.mjs
or @swc/core (#229), tests/tools/ (#225), any scripts/ test (#185, #197, #208,
#214, #216, #221, #263), or any data/*.json contract test (#235, #239, #241, #253,
#257, #260).

Related Issue

Closes #269


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

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

Adds tests/blog-frontmatter.test.mjs, asserting that every blog post's
authors: and tags: keys resolve in blog/authors.yml and blog/tags.yml,
that slugs are present, unique and match the filename, that each post
carries a truncate marker, and that the authors/tags entries themselves
carry the fields the blog renders.

Docusaurus fails the build outright on an unresolved author or tag key,
and npm run check never resolves frontmatter keys, so a typo first
surfaced at deploy time.

Parsing uses the yaml devDependency already present and already used by
scripts/collect-metrics.mjs.

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.

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] No test covers the blog/ frontmatter contract (blog/*.md authors & tags vs blog/authors.yml, blog/tags.yml)

0 participants