Skip to content

test(validators): cover the seven uncovered fallback-label regions - #688

Closed
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-validator-fallback-labels
Closed

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-validator-fallback-labels

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Line coverage is already 100% for every source file in this repository, so the
remaining unit-test gaps are all sub-line regions. This PR closes one
coherent cluster of seven of them: the fallback labels the validator scripts
attach to an error when the record that caused it has no natural identifier,
plus the two || [] guards that keep a collector output missing its array
from turning a validation failure into an iteration TypeError.

Regions covered (file / line / region):

File Line Region
scripts/validate-architectures.mjs 51 || '<unknown>'
scripts/validate-architectures.mjs 71 || '<unknown>'
scripts/validate-case-studies.mjs 60 ?? entry.slug
scripts/validate-case-studies.mjs 60 ?? 'unknown'
scripts/validate-launch-metrics.mjs 87 || []
scripts/validate-launch-metrics.mjs 97 || '(missing id)'
scripts/validate-metrics.mjs 80 || []

Tests are appended to the four existing validator test files and use the
established runScriptWithFixtures sandbox; no production code changes, no
new test helpers, no new files.

The assertions pin the observable behaviour rather than the coverage number:
each test checks the exact [error] <label>: <message> line a maintainer
would read, and asserts the label is not undefined — and for the two
|| [] guards, that stderr carries the real validation failure rather than a
TypeError.

Verification

TZ=UTC node --test tests/validate-architectures.test.mjs \
  tests/validate-case-studies.test.mjs \
  tests/validate-launch-metrics.test.mjs \
  tests/validate-metrics.test.mjs     # 96 pass, 0 fail
TZ=UTC npm run test:unit              # 1186 pass, 0 fail, 2 todo
npx prettier --check tests/           # clean

Region coverage for the four files, measured before and after with
tests/tools/coverage-report.mjs:

File Before After
scripts/validate-architectures.mjs 94.59% 100%
scripts/validate-case-studies.mjs 93.75% 100%
scripts/validate-launch-metrics.mjs 93.33% 100%
scripts/validate-metrics.mjs 97.96% 100%

Scope

Files touched: tests/validate-architectures.test.mjs,
tests/validate-case-studies.test.mjs,
tests/validate-launch-metrics.test.mjs, tests/validate-metrics.test.mjs.

Deliberately disjoint from the open hold-gated PRs: #678 (import-architectures
regions), #680 (svg-active-content regions), #686 (fetch-community-people
regions), #674 (the region-coverage gate in package.json), #684
(validate-projects-born, validators-smoke). No file, script, or region in
this PR is claimed by any of them.

Related Issue

Closes #687


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

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

Line coverage is 100% across this repository's source files, so the
remaining unit gaps are sub-line regions. Seven of them form one cluster:
the fallback labels the validator scripts attach to an error when the
record that caused it has no natural identifier, plus the two || []
guards that keep a missing array from becoming an iteration TypeError.

Drive each arm from the four existing validator test files:

- validate-architectures: an id-less catalog record, asserting both
  'path: record.id || "<unknown>"' sites label the error <unknown>
- validate-case-studies: an entry with a slug but no id reaches the
  slug arm; one with neither reaches the 'unknown' literal
- validate-launch-metrics: a file with no signals key is reported as a
  count failure rather than a crash, and an id-less signal is filed
  under '(missing id)'
- validate-metrics: a file with no metrics key is reported by its real
  failure rather than an iteration TypeError

All four files now report 100% region coverage.

Closes #687

Signed-off-by: hivecommons-hive[bot] <hivecommons-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

Copy link
Copy Markdown
Member

Superseded by #750, which consolidates this and 14 other test-only coverage PRs into a single reviewable change (commit cherry-picked unmodified, authorship and DCO preserved).

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] Cover the seven uncovered fallback-label regions in the four validate-* scripts

1 participant