Skip to content

test: cover validate-radar-reports sourceUrl, title and entry-url checks - #496

Merged
mrbobbytables merged 2 commits into
mainfrom
quality/test-validate-radar-reports-branches
Sep 23, 2026
Merged

mrbobbytables merged 2 commits into
mainfrom
quality/test-validate-radar-reports-branches

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Extends tests/validate-radar-reports.test.mjs to cover the checks in
scripts/validate-radar-reports.mjs that no test executed. Only that one test
file changes — no production code, no new helper, no dependency.

scripts/validate-radar-reports.mjs gates data/radar-reports.json, which
src/components/RadarReports/index.js renders as the whole /reports page.
Three of its seven checks were unguarded:

lines check consequence if it regressed
16-21 sourceUrl present and https:// the SyncStatus provenance link renders href="undefined", or downgrades to plaintext
39-44 entry title present a report renders an empty <h3> link
45-50 entry url present and https:// a target="_blank" card link renders href="undefined", or downgrades to plaintext

Two branch-only gaps sat alongside them and are also closed: the
!Array.isArray(data.radarReports) term was only ever reached through its
!length sibling, and the entry.id ?? entry.slug ?? 'unknown' label fallback
was unreachable while every fixture supplied an id — that label is what a
maintainer reads to find the offending record.

Eight assertions added, all through the existing runScriptWithFixtures
helper and the existing validData fixture.

Verification

Node's own --experimental-test-coverage reports this file at 51.51%, but that
figure is a subprocess artifact — runScriptWithFixtures copies the script into
a mkdtempSync directory, so V8 records the run under a /tmp/endusers-test-*
URL that node --test discards (tracked by #224, tooling in open PR #225).
The numbers below are measured with NODE_V8_COVERAGE, which follows the child
processes, with the sandbox URLs remapped back to repo paths:

NODE_V8_COVERAGE=/tmp/cov npm run test:unit
# rewrite file:///tmp/endusers-test-*/scripts/ -> file://<repo>/scripts/
npx c8 report --temp-directory /tmp/cov2 --src . --exclude 'node_modules/**' --exclude 'tests/**'
lines branch
before, at 8c089a0 81.81% 53.84%
after 100% 100%
  • npm run test:unit — 726 tests, 724 pass, 0 fail, 2 pre-existing todo.
  • node --test tests/validate-radar-reports.test.mjs — 14/14 pass.
  • npx prettier --check tests/validate-radar-reports.test.mjs — clean.

One check deliberately left uncovered

A truthy non-array radarReports (for example an object) crashes the
validator with an unhandled TypeError: object is not iterable at line 30,
because data.radarReports || [] does not guard a truthy non-array, instead of
reporting the collected error. Asserting that would cement a defect, so the
branch is exercised with null instead. The crash is a production-code fix and
is outside this lane; it is reported separately rather than worked around here.

Related Issue

Closes #495 — every box in that issue's scope list is covered by this diff, so
merging leaves nothing for the issue to track.

Disjointness

Touches only tests/validate-radar-reports.test.mjs. No other open PR names
that file or scripts/validate-radar-reports.mjs: #225 touches
tests/tools/coverage-report.mjs and package.json, #435 ArchitectureFilters,
#476 pr-queue-hygiene, #479 ProjectsBorn, #482 GroupLinkStatus/
PeopleFreshness, #486 CommunityPeople, #490 ReferenceArchitectures.
This PR adds no shared helper and modifies none, so it cannot collide with them.


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

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

Three of the seven checks in scripts/validate-radar-reports.mjs were never
executed by any test: the sourceUrl https guard, the entry title guard and
the entry url https guard. Two branch-only gaps sat alongside them -- the
!Array.isArray term of the radarReports guard, only ever reached through its
!length sibling, and the entry.id ?? entry.slug ?? 'unknown' label fallback,
unreachable while every fixture supplied an id.

Measured with NODE_V8_COVERAGE so the fixture-sandbox subprocesses are
counted: the file was 81.81% lines / 53.84% branch and is now 100% / 100%.

Closes #495

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.

# Conflicts:
#	tests/validate-radar-reports.test.mjs
@mrbobbytables
mrbobbytables added this pull request to the merge queue Sep 23, 2026
Merged via the queue into main with commit cd959e5 Sep 23, 2026
2 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-validate-radar-reports-branches branch September 25, 2026 17:53
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] scripts/validate-radar-reports.mjs: sourceUrl, title and entry-url checks are never exercised

1 participant