Repository navigation
test: cover scripts/collect-radar-reports.mjs offline (tests/collect-radar-reports.test.mjs) [quality] - #407
Merged
Conversation
scripts/collect-radar-reports.mjs is the only writer of data/radar-reports.json and had no test file at all. The riskiest untested path is summary preservation: cncf.io publishes no excerpt for these reports, so each entry carries a hand-written summary that the script re-attaches across refreshes by report id, and a regression there would silently replace maintainer prose with the placeholder. Add tests/collect-radar-reports.test.mjs, driving the script through the existing runScriptInSandbox harness with a prior data/radar-reports.json seeded as a sandbox fixture so the preservation path runs for real. Coverage: summary preservation and placeholder fallback, the lf-report-type radar term lookup and its hard-fail guard, apiUrl built from the resolved term id, x-wp-totalpages pagination, the empty-batch stop, the 400-past-the-last-page break against a genuine API error, HTML entity decoding, slug fallback for a blank title, null publishedAt, and the newest-first sort. 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/collect-radar-reports.test.mjs, the first test of any kind forscripts/collect-radar-reports.mjs— the only writer ofdata/radar-reports.json, which backs/resources/radar-reports.The script did not appear in the
node --test --experimental-test-coveragereport at all because nothing loaded it. The new file drives it through the existingtests/helpers-script-sandbox.mjsharness (runScriptInSandbox), so the run is fully offline and deterministic — no new test infrastructure and no network.The headline case is summary preservation. cncf.io publishes no excerpt for these reports, so each entry carries a hand-written
summarythat the script re-attaches across refreshes by matching report id. The test seeds a priordata/radar-reports.jsoninto the sandbox and asserts that a real summary survives, that a blank one falls back to the placeholder, and that an id no longer published upstream is dropped — so a regression can no longer silently overwrite maintainer prose withSummary needed.Eight tests covering, in
scripts/collect-radar-reports.mjs:lf-report-typelookup for the term withslug === 'radar', its hard-fail guard when cncf.io stops exposing that term, andapiUrlbuilt from the resolved term id rather than a hard-coded one.fetchAllPages—x-wp-totalpagespagination across two pages, the empty-batch stop, thestatus === 400 && page > 1break, and genuine failures (500 on the posts request, 400 on the first taxonomy page) that must exit non-zero and write no output.decodeEntities(&,&,’,–,—), slug fallback for a blank or missingtitle.rendered,nullpublishedAt, the emitted envelope, the stdout count line, and the newest-firstpublishedAtsort.Tests only; no production file is touched.
node --test tests/collect-radar-reports.test.mjspasses 8/8 on node v26.8.2. Output is prettier-formatted.Related Issue
Closes #406 — that issue asks for exactly one deliverable,
tests/collect-radar-reports.test.mjs, and this PR lands it in full. Nothing is left for it to track.Disjoint from every open hold-gated PR: #216 covers
scripts/import-architectures.mjs, #225 covers coverage reporting for fixture-sandbox runs (this PR adds a consumer of that harness, not a change to it), #291 coverscheck:links, and #195/#212/#266 are security fixes to the architecture import path. It is also disjoint from its sibling #405, which coversscripts/collect-case-studies.mjsin a separate file for a separate issue. No file, function, or issue cluster overlaps.Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5