Skip to content

test: let data overlays patch a root-level JSON array with setWhere - #1110

Merged
mrbobbytables merged 2 commits into
mainfrom
quality/test-overlay-root-array-setwhere
Oct 7, 2026
Merged

mrbobbytables merged 2 commits into
mainfrom
quality/test-overlay-root-array-setwhere

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

tests/tools/e2e-data-fixtures.cjs addressed data through dotted paths walked
down from a root object, so parentOf() rejected an array at every step. That
left the two data files whose root is a JSON array — data/architectures/catalog.json
and data/projects-born.json — outside the overlay mechanism entirely.

tests/tools/e2e-data-fixtures.cjs — new setWhere overlay key. It selects
one record of a top-level array by <field>=<value> and patches its fields,
keeping the fail-loud property the dotted paths have: a selector matching no
record, matching more than one, or naming a field the record does not carry is
an error rather than a silent no-op. It is keyed on a field rather than a
positional index because both files are regenerated (npm run import:architectures,
npm run collect:projects-born) and entry order is not stable.

tests/e2e/fixtures/data/architectures/catalog.json — new overlay emptying
allianz's industries, so ArchitectureCard renders the eyebrow fallback at
src/components/ReferenceArchitectures/index.js:66. This is an additive case,
not a swap: the other seven entries keep their industries, so both arms of the
|| render on the same page in the same build. No variant build is needed.

tests/e2e/data-fixtures.spec.js — one spec driving the fallback card and
the populated card on the same page, so the assertion is evidence the branch
switched rather than that every eyebrow went generic.

tests/e2e-data-fixtures.test.mjs — pins setWhere's patch semantics and
each of its six rejections; pins that both root-array data files are now
addressable against the real files; adds the catalog overlay to the
"every committed overlay still applies" case, both directions.
tests/e2e-data-fixtures.test.mjs:85-91 ("setting a leaf whose parent is an
array is rejected") is unchanged — leaf-under-array addressing stays rejected.

Verification

  • npm run test:unit — 1975 passed, 0 failed at 7ab301e + this diff.
  • npm run build:e2e:coverage — succeeds. The built coverage site server-renders
    the fallback: build/architectures/index.html contains
    <a class=card_D3WH href=/architectures/allianz>…<p class=eyebrow_MUlS>Reference architecture,
    while the other cards still render their joined industries.
  • npx prettier --check tests/ — clean.
  • The Playwright spec itself could not be executed here: this sandbox has no
    libglib-2.0.so.0, so chrome-headless-shell exits 127 before any navigation,
    and all seven pre-existing specs in that file fail identically. That is
    environmental, not diff-local; CI's End-to-end coverage job is the first run
    of the new case.

Scope

Only tests/**. No production code, no workflow file. --check-source-regions
needs no change: this adds a covered region without adding a build.

Disjoint from the open hold-gated PRs — #1090 is scripts/lib/svg-active-content.mjs,
#1104 is tests/e2e/fixtures/data-variants/members.json plus its own spec file.
Neither touches tests/tools/e2e-data-fixtures.cjs, tests/e2e-data-fixtures.test.mjs,
tests/e2e/data-fixtures.spec.js or tests/e2e/fixtures/data/architectures/.
Also disjoint from the tests/tools/e2e-coverage-report.mjs region-attribution
cluster (#1066, #1079, #1097).

Related Issue

Closes #1086


Human review required.

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

tests/tools/e2e-data-fixtures.cjs addresses data through dotted paths
walked down from a root object, so parentOf() rejected an array at every
step. That left the two data files whose root is a JSON array --
data/architectures/catalog.json and data/projects-born.json -- outside
the overlay mechanism entirely, with no path that reaches into either.

Add a setWhere overlay key that selects one record of a top-level array
by <field>=<value> and patches its fields. It keeps the fail-loud
property the dotted paths have: a selector matching no record, matching
more than one, or naming a field the record does not carry is an error
rather than a silent no-op, so a regenerated data file breaks the build
instead of quietly dropping the coverage it was written for. The
selector is keyed on a field rather than a positional index because both
files are regenerated and their entry order is not stable.

Use it to empty one catalog entry's industries in the coverage build, so
ArchitectureCard renders the 'Reference architecture' eyebrow fallback
(src/components/ReferenceArchitectures/index.js:66). Every shipped entry
carries a non-empty industries array, so that arm has never rendered in
a browser. This is an additive case rather than a swap: the other seven
entries keep their industries, so both arms of the || render on the same
page in the same build and no variant build is needed.

Closes #1086

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.

…ction

docs/architectures/index.md renders <ReferenceArchitectures /> inside a
docs page whose autogenerated sidebar links every sibling architecture
page. An unscoped a[href$="/architectures/<id>"] therefore matched the
sidebar entry as well as the card, and toHaveCount(1) saw 2.

Scope both locators to the component's own landmark, <section
aria-label="Reference architecture catalog">, and pin the populated arm
with its own toHaveCount(1): the adobe id matched three elements
page-wide, so that assertion would have tripped strict mode next.

Verified against build/architectures/index.html from a local
E2E_COVERAGE=1 build: 2 allianz hrefs page-wide, exactly 1 inside the
catalog section, and the fallback card does render the generic
"Reference architecture" eyebrow.

Signed-off-by: quality <quality@hive.kubestellar.io>
This was referenced Oct 6, 2026
@mrbobbytables
mrbobbytables added this pull request to the merge queue Oct 7, 2026
Merged via the queue into main with commit e713042 Oct 7, 2026
7 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-overlay-root-array-setwhere branch October 7, 2026 15:18
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] data overlays cannot patch a root-level JSON array, so catalog.json and projects-born.json are outside the e2e fixture mechanism

1 participant