Repository navigation
test: cover GroupLinkStatus' absent-collection fallback in the browser - #1742
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
data/community-groups.json is rewritten in one pass by `npm run check:community-group-links`, so an interrupted run can leave the Community page a document carrying no `groups` collection. GroupLinkStatus guards that with `(groupsData?.groups || [])`, and no build reached the fallback: the ordinary coverage build and the variant build both carry the collection, and the variant build needs two drifted groups for its plural arms, so the cleared shape cannot share it. Clear `groups` on the existing data-no-revision build, which reads nothing from community-groups.json today, so the shape costs no additional Docusaurus compile. The collection is set to null rather than [] because an empty array is truthy and would take the left operand. The new spec asserts the real route beside the no-revision one, so a dropped warning is evidence of the fallback rather than of a route that 404d. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
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. Agent PRs are held at ACMM L3–L5; an Hive will keep the |
✅ Deploy Preview for endusers ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Read the component and fixture tooling at this head, not just the diff. This looks correct to me.
Verified:
src/components/GroupLinkStatus/index.js:13is the arm under test:(groupsData?.groups || []).filter(...). The last-updated line (line 18–20) renders fromgeneratedAtindependently ofgroups, so the spec's pairing —UPDATED_LINEvisible,DRIFT_WARNINGcount 0 — does distinguish "fallback supplied an empty collection" from "component/route never rendered".- The overlay sets
groupstonullon a path that must already exist in the real file (tests/tools/e2e-data-fixtures.cjs:308-312throws on absent paths), so the fixture fails loudly if the real file's shape changes.nullrather than[]is right:[] || []takes the left operand and the fallback stays unreached. - Riding
data-no-revisionis safe for its existing consumers: the other no-revision overlays and specs readmembers.json/metrics.json(DirectoryFreshness arms), and no existing spec asserts oncommunity-groups.jsonin that build — onlygroup-link-status-variant.spec.js(variant build) anddata-fixtures.spec.js(ordinary coverage build) touch it. - The
EXPECTEDentry intests/e2e-data-fixture-validity.test.mjsdeclares exactly the one new validator error (groups must be a non-empty array), consistent with the pattern of the neighbouring entries; the validity test and the full e2e-coverage job pass in CI at this head. - The disclosed region-count dip (97.05% → 96.92%) matches the documented span-union behaviour the PR cites and clears the
--check-source-regions 96gate.
Test-only, additive, body matches the code. The Refs #1736 (needs-human: …) link semantics are deliberate and explained. No findings.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
|
Closing as not planned with explicit maintainer authorization from the prioritized queue review. ADR 0007 (https://github.com/cncf/endusers/blob/main/adr/0007-scope-end-to-end-coverage-to-user-reachable-states.md) leaves unit-covered build-time data-shape guards to unit tests. This fixture sets groups to null, which the production validator rejects; it does not identify a user-reachable production state. Reusing a fixture build avoids another compile but does not change that scope decision. #1736 is being narrowed to the separate reporter-correctness decision, not more fixture coverage. |
Test Improvement
Adds browser coverage for the one arm of
src/components/GroupLinkStatus/index.jsthat no build reaches:
npm run check:community-group-linksrewritesdata/community-groups.jsonin onepass, so an interrupted or truncated run can leave the Community page a document
with no
groupscollection. The|| []operand is what makes that render the pagewithout the drift warning instead of throwing on
undefined.filterand taking theroute down.
Files claimed by this PR — no overlap with the open held PRs (#1739 case-studies
sourceUrl/id-dedup, #1735 mutation harness):tests/e2e/fixtures/data-no-revision/community-groups.json(new overlay)tests/e2e/group-link-status-absent-groups.spec.js(new spec)tests/e2e-data-fixture-validity.test.mjs(oneEXPECTEDentry)tests/e2e-coverage-describe-gate.test.mjs(oneCOVERAGE_GATEDentry)The shape rides the existing
data-no-revisionbuild rather than a new fixturedirectory, so it costs no additional Docusaurus compile in the
e2e-coveragejob.It cannot share
data-variant, which appends a second drifted group to reach theplural
stale.lengtharms.groupsis set tonullrather than[]because anempty array is truthy and would take the left operand.
Verification
Run locally at
3bbac0d+ this commit, Node v26.12.0, Playwright chromium:npm run test:unit— 2983 passed, 0 failednpm run test:e2e:coverage— 363 passed (362 before; the new spec is theextra case), full run against the real build and all three fixture builds
npm run check:lint,npm run check:duplication,prettier --check— cleannpm run report:e2e:coverage ... --check-source 100 --check-source-regions 96— exit 0
The region number goes slightly down, on purpose — please read before merging
This is disclosed rather than buried, because it looks backwards.
src filesregionsFour more regions are covered, but five more exist. The e2e report unions regions
across builds by span, and V8 only emits a deviation range: a build that
takes an arm records nothing at that arm's span, while a build that skips it
records a zero there. So a sibling build taking an arm cannot retire the zero —
and the new build, which never runs the filter callback on line 14, contributes
fresh zeros of its own.
tests/e2e-coverage-report.mjsdocuments this directly("Lines do union across builds; regions of this shape do not"), and
tests/e2e-coverage-gate.test.mjsrecords it as the reason there is no per-fileregion floor in this lane.
Both numbers clear the gate's
--check-source-regions 96, and the gate passes.Node v26 is not the pinned major (
MEASURED_ON_NODE_MAJOR = '22'), so the absolutedenominators will differ in CI; the direction is what matters here.
If the 0.13-point margin loss is not a trade you want, say so and I will close this
— the spec's value is behavioural (a degraded data file still renders a page), not
metric.
Related Issue
Refs #1736 (needs-human: the issue's remaining 19 regions are not a test gap at
all — they are already executed in a browser and the reporter cannot credit them,
so no fixture or spec can close them; and its final item, raising
--check-source-regionsto100in.github/workflows/ci.yml, is both unreachablefor this lane's token and would permanently red-line a required job. Evidence is in
a comment on #1736.)
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88