Skip to content

test: guard READ_ONLY_VALIDATORS against scripts/validate-*.mjs (tests/validator-smoke-coverage.test.mjs) - #366

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-validator-smoke-coverage
Sep 21, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-validator-smoke-coverage

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/validator-smoke-coverage.test.mjs — a guard over the
READ_ONLY_VALIDATORS array in tests/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.mjs
and scripts/validate-*.mjs; it modifies neither.

Why this array matters

.github/workflows/ci.yml is the only pull_request-triggered workflow, and
its steps are npm ci, npm run test:unit, npm run build:production. It
never invokes npm run validate:*. The four data validators run directly only
in deploy-gh-pages.yml (push to main) and import-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 real
repository data. A validator added to scripts/ but forgotten in the array
runs 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.mjs leaves every existing test green.

What the test asserts

  1. The repository still ships read-only validate-*.mjs scripts (so the guard
    cannot pass vacuously).
  2. Every read-only validator on disk appears in READ_ONLY_VALIDATORS.
  3. Every entry in READ_ONLY_VALIDATORS exists in scripts/.
  4. No entry is listed twice.

"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.mjs has a --fix path and is
therefore not required to be listed; it is listed today and that stays valid.

Verification (clean checkout at 00b44df, node v26.8.1)

  • New file: 4/4 pass. Full suite: 59/59 pass (was 55).
  • Regression check: dropping a read-only scripts/validate-foo.mjs into the
    tree fails assertion 2 with actual: [ 'validate-foo.mjs' ].
  • prettier --check clean.

Disjointness from open PRs

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

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>
@hivecommons-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.

@mrbobbytables
mrbobbytables added this pull request to the merge queue Sep 21, 2026
Merged via the queue into main with commit 1b9099b Sep 21, 2026
2 checks passed
@castrojo
castrojo deleted the quality/test-validator-smoke-coverage branch September 21, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] The READ_ONLY_VALIDATORS list is the only PR-time data gate, and nothing keeps it in sync with scripts/validate-*.mjs

1 participant