Skip to content

test: cover MetricsDashboard's four empty-collection fallbacks end to end - #1117

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-metrics-empty-collections
Oct 7, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-metrics-empty-collections

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

src/components/MetricsDashboard/index.js maps over four document-level
collections of data/metrics.json through a fallback that supplies an empty
one, and the e2e report lists all four as uncovered:

line expression collection
65 (lifecycle?.cards || []).map(...) lifecycle cards
85 (lifecycle?.omitted || []).map(...) lifecycle "what is not yet measurable" items
124 Object.entries(metricsData.series || {}) line charts
174 Object.entries(metricsData.breakdowns || {}) bar charts

The checked-in document always carries four cards, three omitted indicators,
two series and two breakdowns, so none of the fallbacks is reachable in the
browser. They are ordinary shapes rather than defensive dead code:
data/metrics.json is regenerated by npm run collect:metrics, and a
collector run that cannot reach one of its sources emits the document without
that collection.

What this changes

  • tests/e2e/fixtures/data-variants/metrics.json — the existing variant
    overlay additionally clears referenceArchitectureLifecycle.cards,
    referenceArchitectureLifecycle.omitted, series and breakdowns.
  • tests/e2e/metrics-empty-collections-variant.spec.js (new) — pairs
    /metrics with /e2e-coverage-variant/metrics. The real route must render
    every collection; the variant route must render none of them while the
    lifecycle section, its heading, both trend labels and the Last updated
    line still render. Pairing the two is what makes this evidence that the arms
    switched rather than that one page happens to look a certain way.

Emptying the collections in the ordinary coverage build would trade every
rendered card, disclosure item, line chart and bar chart for the fallback
rather than add a case, which is why they belong to the variant build —
the same reason AwardsTimeline's provenance paragraph does.

Deliberately out of scope

referenceArchitectureLifecycle.trends (line 76) is left alone. The same
overlay appends a point to trends.submissions.values for
tests/e2e/metrics-sparkline-variant.spec.js, and applyOverlay in
tests/tools/e2e-data-fixtures.cjs applies set before append, so clearing
trends would make that append throw and fail the build. Reaching line 76
needs a second variant build, not a second entry in this overlay. The fixture
and the spec both say so in place.

Verification

  • npm run build:e2e:coverage at 7ab301e with this change applied, then both
    rendered documents read directly:

    build/metrics/index.html build/e2e-coverage-variant/metrics/index.html
    lifecycleCard elements 4 0
    <p> inside the lifecycle <details> 3 0
    labelled section per series id 2 0
    labelled section per breakdowns id 2 0
    lifecycle section, heading, both trend labels, Last updated present present
  • npm run test:unit — 1966 passed, 0 failed (the overlay is validated by
    tests/e2e-data-fixtures.test.mjs, which loads every committed overlay).

  • npx prettier --check and npx eslint clean on both files.

  • The Playwright run itself could not be executed in this agent's
    environment: chrome-headless-shell fails to start with
    error while loading shared libraries: libglib-2.0.so.0, and the sandbox has
    no root to install it. Every assertion in the new spec is instead verified
    above against the HTML the two builds actually emit; the browser run is left
    to the End-to-end coverage job on this PR.

Coordination

Touches only tests/e2e/fixtures/data-variants/metrics.json and the new
tests/e2e/metrics-empty-collections-variant.spec.js. It does not edit
tests/e2e-data-fixtures.test.mjs (#1113, #1110),
tests/e2e/data-fixtures.spec.js or tests/tools/e2e-data-fixtures.cjs
(#1110), or tests/e2e-coverage-report.test.mjs (#1114). The cases list in
tests/e2e-data-fixtures.test.mjs is hardcoded and not exhaustive, so a new
set entry needs no edit there. No workflow file is involved: the gate
--check-source-regions 80 only rises.

This PR does not promise the four regions leave the report's uncovered list.
tests/tools/e2e-coverage-report.mjs keys a region on its exact original
coordinates and the two builds' generated code does not always map back to the
same ones — that is the region-attribution problem tracked in #1066 and #1079.
Where it folds, these fold with no further change here.

Related Issue

Closes #1116


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

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

… end

The component maps over four document-level collections of data/metrics.json
through a fallback that supplies an empty one -- lifecycle cards (line 65),
lifecycle omitted indicators (line 85), series (line 124) and breakdowns
(line 174). The checked-in document always carries all four, so no fallback is
reachable in the browser, and the e2e report lists every one as uncovered.

Emptying the collections in the ordinary coverage build would trade every
rendered card, disclosure item, line chart and bar chart for the fallback
rather than add a case, so they go to the variant build: the existing
metrics.json variant overlay now clears all four, and a new spec pairs
/metrics with /e2e-coverage-variant/metrics so the arms are asserted to switch
rather than one page happening to look a certain way.

referenceArchitectureLifecycle.trends (line 76) is deliberately left alone: the
same overlay appends to trends.submissions.values, and applyOverlay runs set
before append, so clearing it would fail the build.

Closes #1116

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive hivecommons-hive Bot added the hold label Oct 6, 2026
@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 keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

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] MetricsDashboard's four empty-collection fallbacks have no end-to-end coverage

1 participant