test: assert the data/architectures catalog ↔ records ↔ docs contract (tests/architecture-catalog-contract.test.mjs) - #260
Open
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
scripts/import-architectures.mjs writes data/architectures/catalog.json, data/architectures/records/<id>.json and docs/architectures/<id>.md in a single run, but nothing re-checks that they still agree once committed: validate-architectures.mjs reads only catalog.json and validate-architecture-assets.mjs reads only static/img/architectures. Add tests/architecture-catalog-contract.test.mjs, which reads the committed data with no fixtures and no network, and fails on: a catalog entry with no doc page, a doc page with no catalog entry, a records file drifted from its catalog entry, a doc title that differs from the record title, a missing sidebar_label, a doc that no longer cites its record's sourceCommit or drops the CC BY 4.0 attribution, a sourceUrl not pinned to sourceCommit, an asset outside its record's namespace, and an orphan asset directory. Frontmatter is parsed with the yaml devDependency rather than by regex: the generated pages use both single- and double-quoted YAML scalars. Signed-off-by: kubestellar-hive[bot] <kubestellar-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 18, 2026
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 one new test file,
tests/architecture-catalog-contract.test.mjs, and nothing else.scripts/import-architectures.mjswrites three artifacts in a single run —data/architectures/catalog.json,data/architectures/records/<id>.json, anddocs/architectures/<id>.md— but nothing re-checks that they still agree once committed.validate-architectures.mjsreads onlycatalog.json;validate-architecture-assets.mjsreads onlystatic/img/architectures; no test intests/loadsdata/architectures/records/ordocs/architectures/at all.The new file reads the committed data directly (no fixtures, no sandbox, no network) and asserts, in 11 tests:
catalog.jsonis a non-empty array with unique lowercase-slug idssourceCommitis a full 40-hex SHA, andsourceUrlis acncf/architectureURL pinned to that SHAdata/architectures/records/*.jsonare one-to-onerecords/<id>.jsondeep-equals its catalog entrydocs/architectures/*.md(excludingindex.md) are one-to-onetitleequals the record title;sidebar_labelis present and non-blanksourceCommitand retains the CC BY 4.0 attribution required by the upstream importdocs/architectures/index.mdexists and has a title/img/architectures/<id>/and present instatic/static/img/architectures/Frontmatter is parsed with the
yamldevDependency already inpackage.json— the generated pages use both'single'and"double"quoted YAML scalars, so a regex reader reports false mismatches onzeiss.mdandswisscom-cloud-native-telco.md. No dependency is added andpackage.jsonis not touched.Verification
npm cithennode --teston a clean clone at parent revision00b44df: 66 tests pass, 0 fail (55 before, 11 added).npx prettier --checkis clean on the added file.Mutation-checked rather than merely green — on a scratch copy with
records/zeiss.jsondeleted,docs/architectures/adobe.mddeleted, and onesourceCommitcorrupted toabc, 6 of the 11 tests fail with messages naming the offending id.Coverage evidence
node --test --experimental-test-coverage, local clone ofcncf/endusersat00b44dfafternpm ci, 2026-09-17. Baseline: 55 tests;data/architectures/records/anddocs/architectures/never read by any test. After: 66 tests.Disjointness
Claimed ground is the single new file
tests/architecture-catalog-contract.test.mjs. It overlaps no open PR: #216 claimstests/import-architectures.test.mjs+tests/helpers-import-sandbox.mjs(script behaviour in a sandbox); #231 claimstests/helpers.mjs+tests/validate-architecture-assets.test.mjs(--fixwrite mode); #229 claims the JSX import path undertests/tools/; #225 claims coverage reporting for fixture-sandbox runs. None of them assert anything about the relationship between the committed catalog, records, and doc pages.tests/helpers.mjsis deliberately left untouched so this cannot conflict with #231.Related Issue
Closes #259
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5