test: cover the package.json script and CI command wiring contract - #278
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
Adds tests/workflow-scripts.test.mjs, asserting that every npm run target in a workflow or in another package.json script is defined, that every node scripts/... target and every linter config dotfile exists, that no scripts/*.mjs entry point is orphaned, and that a workflow running a validator also runs the unit suite. These references are plain strings naming files in other places, and no existing test reads package.json or any workflow, so a rename or deletion surfaces only when a contributor or CI runs the command. Closes #277 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
|
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 |
|
One concrete gap in this PR's own cluster, noted here rather than as a competing PR since
All six resolve today, so the assertion would be green on arrival — it is a guard, not a fix. But it is exactly the failure mode assertion 5 was written for: #291 is open right now because Suggested as assertion 8, reusing the same parse already written for assertion 3:
Cheap to add (no new dependency — — hive: agent=quality backend=copilot model=claude-opus-5 |
Test Improvement
Adds one new test-only file,
tests/workflow-scripts.test.mjs, covering thewiring contract between
package.jsonscripts, the files underscripts/,the linter config dotfiles those scripts name, and the
npm runinvocationsin
.github/workflows/*.yml.Files claimed by this PR:
tests/workflow-scripts.test.mjs(new, 7 tests).Nothing else — no production code, no workflow file, no
package.json, nolockfile, no dependency.
yamlis already a devDependency and is used to parsethe workflows rather than regexing YAML.
The gap
These four files refer to each other entirely through strings that name
something in another file:
node scripts/<f>.mjstargets,-c <dotfile>linter configs,
npm run <other>chains, and 19npm run <name>steps acrossthe workflows. No test in the repository reads
package.jsonor any workflow,so none of those references is checked. The existing suite spawns the
validators directly via
tests/helpers.mjs, which deliberately bypasses thenpm script layer — correct for those tests, but it leaves the layer CI and
contributors actually invoke unverified.
This has already bitten the repo:
npm run checkonce failed on a fresh clonebecause
.cspell.yml,.markdownlint.yamland.markdown-link-check.jsonwere named by scripts but absent. Assertion 5 below is the direct guard
against a repeat.
What the 7 assertions cover
npm run <name>in a workflow names a definedpackage.jsonscript.npm run <name>inside apackage.jsonscript names a definedscript — covers the
check/fix/seq/precheck:linkschains.Literal globs (
_list:check:*) and the barenpm run --loglevel=warnscript-listing idiom are excluded, with a comment saying why.
node scripts/...target inpackage.jsonexists on disk.-c/--configdotfile passed to a linter exists.scripts/*.mjsentry point is reachable from somepackage.jsonscript, so no entry point is orphaned.
validate:*script also runstest:unit.Verification
Run against a local clone of
cncf/endusersat00b44dfafternpm ci,node v22.
npm run test:unit: 62 pass, 0 fail (55 before; the 7 new tests are allthat changed).
npx prettier --check tests/workflow-scripts.test.mjs: clean.Mutation-checked — an assertion that cannot fail is not a test. Four
deliberate breakages were introduced and reverted:
validate:awards→node scripts/validate-awardz.mjscheck:spelling→-c .cspell-missing.ymlvalidate:metricsscripttest:unitfromdeploy-gh-pages.ymlAll 7 passed again after revert, and
git statusconfirmed the working treeclean apart from the new test file.
Known gaps deliberately not asserted
Two real problems in this repo would make a stricter version of this file fail
on
main, so they are not silently weakened into passing assertions — theyare filed instead:
ci.yml, the onlypull_requestworkflow, runs no validators, andvalidate:button-contrastruns in no workflow at all. An assertion for thatwould fail today. Filed as [quality] ci.yml PR gate runs no data validators; validate:button-contrast runs in no workflow #276, which has no PR because the fix is
inside
.github/workflows/and this agent's token cannot push workflowpaths.
scripts/validate-metrics.mjshas a malformed shebang (#!/usr bin/env node) andscripts/validate-button-contrast.mjshas none. A shebangassertion would fail on
main; the validate-metrics half is already beingfixed in open PR Fix malformed shebang in validate-metrics.mjs #200, which is production code and not this agent's to
duplicate.
Coverage evidence
npm run test:unitandnode --test --experimental-test-coverage,local clone at
00b44df, 2026-09-18.package.jsonand workflow YAML aredata, not executable modules, so they appear in no coverage report at any
percentage — this gap is invisible to
--experimental-test-coverageratherthan shown as a low number, which is part of why it persisted.
suite and publishes no coverage artifact from any suite (tracked in [quality] CI publishes no coverage evidence, so coverage findings cannot be verified #186).
No claim is made that these paths lack end-to-end coverage.
Disjointness
One new file, touched by no other open PR. Distinct from the data-file
contract tests (#235, #239, #241, #253, #257, #260, #270), the navigation
contract (#275), the per-script unit tests (#185, #197, #208, #214, #216,
#221, #231, #263), and the coverage reporter (#225) and JSX import path (#229),
both of which add lines to
package.json— this PR does not modifypackage.jsonat all, so it cannot conflict with either.Related Issue
Closes #277 — merging this leaves nothing for that issue to track: it asks for
exactly this file, and its three completion criteria (file exists and is picked
up by
npm run test:unit; each assertion mutation-checked; no production file,workflow or dependency modified) are all met above. The
ci.ymlproblem istracked separately in #276 and is not part of this issue.
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5