test: guard READ_ONLY_VALIDATORS against scripts/validate-*.mjs (tests/validator-smoke-coverage.test.mjs) - #366
Merged
Conversation
tests/validators-smoke.test.mjs holds a hand-maintained array of validator filenames. It is the only path by which the data validators run on a pull request: ci.yml is the sole pull_request-triggered workflow and it runs test:unit and build:production, never npm run validate:*. A validator added to scripts/ but forgotten in that array runs on no pull request and first fails post-merge on the push-to-main deploy. Add tests/validator-smoke-coverage.test.mjs, which parses the READ_ONLY_VALIDATORS literal and asserts in both directions that it matches the read-only scripts/validate-*.mjs files on disk. Read-only status is detected from the script source so the guard does not go stale when a validator gains a write mode. 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 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
tests/validator-smoke-coverage.test.mjs— a guard over theREAD_ONLY_VALIDATORSarray intests/validators-smoke.test.mjs.Files/functions/cluster claimed by this PR:
tests/validator-smoke-coverage.test.mjs(new file, the only file changed). It reads
tests/validators-smoke.test.mjsand
scripts/validate-*.mjs; it modifies neither.Why this array matters
.github/workflows/ci.ymlis the onlypull_request-triggered workflow, andits steps are
npm ci,npm run test:unit,npm run build:production. Itnever invokes
npm run validate:*. The four data validators run directly onlyin
deploy-gh-pages.yml(pushtomain) andimport-architectures.yml(
schedule) — both post-merge.So the validators gate a pull request exclusively through
validators-smoke.test.mjs, which executes each listed script against realrepository data. A validator added to
scripts/but forgotten in the arrayruns on no pull request; its first failure lands post-merge on the deploy,
blocking an already-merged change.
Nothing keeps the list in sync — it is a literal list of strings, so adding
scripts/validate-foo.mjsleaves every existing test green.What the test asserts
validate-*.mjsscripts (so the guardcannot pass vacuously).
READ_ONLY_VALIDATORS.READ_ONLY_VALIDATORSexists inscripts/."Read-only" is derived from the script source (no
fetch/write/spawn call)rather than hard-coded, so the guard does not go stale when a validator gains a
write mode.
validate-architecture-assets.mjshas a--fixpath and istherefore not required to be listed; it is listed today and that stays valid.
Verification (clean checkout at
00b44df, node v26.8.1)scripts/validate-foo.mjsinto thetree fails assertion 2 with
actual: [ 'validate-foo.mjs' ].prettier --checkclean.Disjointness from open PRs
tests/workflow-scripts.test.mjs— assertsnpm runtargets named inworkflows/
package.jsonresolve to defined scripts and existing files. Itdoes not read
validators-smoke.test.mjsand does not model which validatorsexecute on a pull request.
tests/ci-supply-chain.test.mjs— action pinning and token permissions.package.json,tests/tools/coverage-report.mjs— coverage reportingfor fixture-sandbox runs.
tests/helpers.mjs,tests/validate-architecture-assets.test.mjs;test(metrics): cover validate-metrics optional-section branches #263
tests/validate-metrics.test.mjs; [quality] test: cover scripts/lib/validate-utils.mjs error and warning paths #185tests/validate-utils.test.mjs—different test files, different validators' internals.
tests/validators-smoke.test.mjsor adds a file underthis name.
No production files are changed.
Related Issue
Closes #365
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5