Skip to content

test: cover RadarReports missing-corpus fallback branches - #532

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

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

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

src/components/RadarReports/index.js renders the whole /reports page and
measured 100.00% lines but 66.67% branches. Every uncovered arm is a
missing-or-empty-corpus fallback, and data/radar-reports.json can never reach
any of them: it has generatedAt set, six reports, and a publishedAt on every
one.

This adds three tests to tests/radar-reports.test.mjs covering the three arms
named in the issue:

  1. SyncStatus's if (!data.generatedAt) return null; — no provenance line.
  2. const radarReports = data.radarReports || []; — the [] fallback, asserted
    both for an absent key and for an empty array; the <ul> itself still renders.
  3. {report.publishedAt && (...)} — an undated report renders no date row, only
    its summary paragraph.

No source file is modified.

Coverage

TZ=UTC node --test --experimental-test-coverage --test-coverage-include='src/components/RadarReports/**' tests/radar-reports.test.mjs, Node v26.8.2, at c154bd5:

file line % branch % funcs %
src/components/RadarReports/index.js 100.00 100.00 100.00

Before this branch the same command reported 100.00 / 66.67 / 100.00, with 8
tests; it now runs 11.

npm run test:unit on the branch: 914 tests, 911 pass, 0 fail, 3 todo. The
three todo entries are pre-existing and untouched here.

Why not tests/helpers-component-data.mjs

The issue expected #482's importWithData, which is now merged. It is
deliberately not used: it imports a rewritten copy of the source into a temp
directory, so the copy's coverage is attributed to that temp file and the three
branches would have stayed red on the real one — the opposite of what the issue
asks for.

Instead the test imports data/radar-reports.json through importSource, which
resolves to the same module URL the component's @site/data/radar-reports.json
specifier resolves to, so it holds the very object the component reads. A
withCorpus(patch, run) helper applies a patch around a single render and
restores every key in a finally — present with its old value, or absent — so
the order the tests run in cannot matter. This is the same approach
tests/community-people.test.mjs and #529 use.

Related Issue

Closes #506


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

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

data/radar-reports.json always has generatedAt, a non-empty radarReports
array and a publishedAt on every report, so the three fallback arms in
src/components/RadarReports/index.js were unreachable and the file sat at
66.67% branch coverage.

Patch the shared corpus module object around a single render and restore
it in a finally, so the assertions land on the real source file rather
than a rewritten copy. Branch coverage is now 100.00%.

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 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against current main: applies cleanly, targeted and full suites pass (TZ=UTC), prettier clean. Removing hold and merging per maintainer request.

@mrbobbytables
mrbobbytables added this pull request to the merge queue Sep 23, 2026
Merged via the queue into main with commit b22b76d Sep 23, 2026
5 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-radar-reports-fallbacks 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] RadarReports mirror-fallback branches (66.67% branch) are unreachable until #482 lands importWithData

1 participant