Skip to content

test(coverage): reach MetricsDashboard's trends fallback with an overlay add op - #1171

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-metrics-trends-fallback
Oct 8, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-metrics-trends-fallback

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

src/components/MetricsDashboard/index.js line 76 renders the lifecycle trend
grid through Object.entries(lifecycle?.trends || {}). It is the fifth of that
file's five empty-collection fallbacks and the only one no build reached:
the variant overlay could not clear referenceArchitectureLifecycle.trends
while it also had to append a point onto trends.submissions.values for the
single-point Sparkline arm, because set runs before append.

The blocker was the overlay vocabulary, not the build count. set, append
and setWhere all require the key they name to be present, so an overlay
could reshape a record the real data already carried but never introduce one
under a keyed collection. submissions is the only trend carrying no values,
so giving it a point traded the no-values arm for the single-point one.

What changed

  • tests/tools/e2e-data-fixtures.cjs gains an add operation: the dotted
    path's parent object must exist and the leaf key must not. That is the
    fail-loud rule pointing the other way from set's — a regenerated
    data/metrics.json that grows the same key breaks the build instead of
    having the record it grew silently overwritten by the fixture. Order is now
    set, add, append, setWhere, so an overlay can add an array and then
    push onto it.
  • tests/e2e/fixtures/data/metrics.json (new) adds one trend carrying
    exactly one value, beside the real two. Both keep rendering as they did, so
    all three Sparkline arms — no values, one value, many values — render on
    the one real /metrics page in one build.
  • tests/e2e/fixtures/data-variants/metrics.json drops its append and
    clears referenceArchitectureLifecycle.trends alongside the four collections
    it already cleared, reaching line 76.
  • tests/e2e/metrics-sparkline-variant.spec.js → metrics-sparkline.spec.js
    — the arm now lives in the ordinary build, so the spec asserts all three arms
    together on the real route instead of pairing a real page against a variant
    one. Asserting the lone point alone would pass just as well if the grid had
    quietly stopped rendering the other trends.
  • tests/e2e/metrics-empty-collections-variant.spec.js covers five
    collections rather than four, and its preamble no longer says line 76 "needs
    a second variant build".
  • tests/e2e-data-fixtures.test.mjs pins add: it adds an absent key,
    rejects a key the real data already carries, rejects a missing parent, clones
    the value rather than sharing it with the overlay, and composes with
    append. Two new cases in every committed overlay still applies to its data
    file
    assert that the coverage build carries exactly one single-point trend
    and that the added trend did not displace the zero- and many-value trends
    beside it.

Verification

Playwright cannot launch in this agent's environment (libglib-2.0.so.0
missing, no root), so the browser assertions are left to CI. What was verified
locally at 03cfcfe:

  • npm run test:unit — 2030 passed, 0 failed, including the five new add
    cases and the two new overlay cases.

  • npm run check:format and npm run check:spelling — clean.

  • npm run build:e2e:coverage compiled both sites, and their server-rendered
    /metrics is the evidence that the arms switched. The real build:

    sparkline: Trend from 2024-11 to 2026-07     (publications, five points)
    sparkline: Trend from 2026-01 to 2026-01     (the added trend)
    <polyline points=50,4 .../>                  (the centred lone point)
    no-trend placeholders: 1                     (submissions, still empty)
    

    The variant build renders the lifecycle panel — heading and the static
    What is not yet measurable disclosure — with no sparkline, no
    No trend data yet placeholder and no trend label
    , which is the || {}
    arm at line 76 supplying the empty grid.

What this does not promise is that region 76 leaves the e2e report's
uncovered list: tests/tools/e2e-coverage-report.mjs keys a region on its exact
original coordinates, and the region-attribution problem tracked in #1066 /
#1079 (open PR #1163) decides whether the two builds' coordinates fold. The
browser taking the arm is pinned by the specs regardless. The CI gate is
--check-source-regions 80, which only rises; no workflow file is touched.

Related Issue

Closes #1170


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

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

…lay add op

The trend grid at src/components/MetricsDashboard/index.js line 76 renders
through `Object.entries(lifecycle?.trends || {})`. It is the fifth of the
file's five empty-collection fallbacks and the only one no build reached:
the variant overlay could not clear `referenceArchitectureLifecycle.trends`
while it also had to append a point onto `trends.submissions.values` for the
single-point Sparkline arm, because `set` runs before `append`.

The constraint was the overlay vocabulary, not the build count. `set`,
`append` and `setWhere` all require the key they name to be present, so an
overlay could reshape a record the real data carried but never introduce one
under a keyed collection. `submissions` is the only trend with no values, so
giving it a point traded the no-values arm for the single-point one.

`add` introduces a key whose parent object exists and whose leaf does not --
the fail-loud rule pointing the other way, so a regenerated data file that
grows the same key breaks the build instead of having its record silently
overwritten by the fixture. The ordinary coverage build now `add`s a trend
beside the real two, rendering all three Sparkline arms on the one /metrics
page, and the variant build clears `trends` with the four collections it
already cleared.

Verified at 03cfcfe by rendering both builds: the real /metrics carries one
`No trend data yet` placeholder, the five-point `publications` sparkline and
a lone point at `points=50,4`; the variant /metrics renders the lifecycle
panel with no sparkline, no placeholder and no trend label at all. The full
unit suite is green at 2030 tests.

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 7, 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.

@mrbobbytables
mrbobbytables added this pull request to the merge queue Oct 8, 2026
Merged via the queue into main with commit 879062d Oct 8, 2026
7 checks passed
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 trends fallback is unreachable by any build: the overlay engine cannot add a key

1 participant