Skip to content

test: pin parentOf's empty-prefix fallback in the overlay machinery - #1078

Merged
castrojo merged 1 commit into
mainfrom
quality/test-overlay-root-path
Oct 6, 2026
Merged

castrojo merged 1 commit into
mainfrom
quality/test-overlay-root-path

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Pins the || dottedPath fallback in parentOf()
(tests/tools/e2e-data-fixtures.cjs:130) — the only uncovered region in that
file.

parentOf() rejects an overlay naming a path the real data does not have:

`${label}: "${walked.join('.') || dottedPath}" is not an object in the real data`

tests/e2e-data-fixtures.test.mjs:78 reaches the walked.join('.') arm only.
Its case, applyOverlay({ a: [1] }, { set: { 'a.b.c': 1 } }), walks one
segment before the array stops it, so walked is ['a']. Nothing reached the
fallback, which is the arm taken when the first segment fails and there is
no prefix to name — without it the overlay is rejected with
"" is not an object in the real data, naming nothing a reader can act on.

It is reachable rather than defensive: applyOverlay() validates that the
overlay is a JSON object (e2e-data-fixtures.cjs:158) but never validates
the real data, and overlaySource() passes whatever JSON.parse returned for
the data file. A data file regenerated as a top-level array lands here on its
first segment.

What this adds

One case, beside the existing non-object-parent test, driving [], null,
'text' and 7 — each disjunct of the guard, all of which fail on the first
segment — and asserting the message names the whole dotted path.

No change to tests/tools/e2e-data-fixtures.cjs. The fallback is correct; it
was simply unpinned.

Evidence

  • Before, at main 900592b: npm run test:unit:coverage
    (TZ=UTC node tests/tools/coverage-report.mjs, node v26.10.0) reports
    tests/tools/e2e-data-fixtures.cjs 100.00% lines / 98.59% regions,
    uncovered region at line 130.
  • After: 100.00% lines / 100.00% regions. src files is unchanged at
    100.00% / 99.84%, since no src/** file is touched.
  • npm run test:unit:coverage:check exits 0.
  • npx prettier --check and npx eslint both clean on the changed file.
  • Mutation check: replacing ${walked.join('.') || dottedPath} with
    ${walked.join('.')} leaves all 22 pre-existing tests in the file passing
    and fails only the new one
    (actual: Error: f: "" is not an object in the real data). That is the
    evidence the case pins the region rather than merely passing beside it.

End-to-end coverage is not applicable and is not claimed either way: this
module runs inside the webpack build, not the browser, so it carries no
source-mapped regions in the End-to-end coverage report.

Coordination

Touches exactly one file, tests/e2e-data-fixtures.test.mjs, and one function
under test, parentOf(). Disjoint from every open hold-gated PR: the e2e
reporter cluster (#1040, #1051, #1070, #1072), the coverage CLI (#1048), the
svg/mdx/asset scanners (#1039, #1042, #1044, #1056, #1063, #1068) and the
e2e specs (#1054, #1058, #1060, #1065, #1075). #1034 is the only open PR that
edits this same file; its diff is confined to the
the variant build clears the fields the ordinary build keeps test and does
not touch parentOf or any of its error messages, so the two do not overlap
textually.

Branch cut from a fresh origin/main at 900592b.

Related Issue

Closes #1077


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

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

parentOf() rejects an overlay path the real data does not have with

  `${label}: "${walked.join('.') || dottedPath}" is not an object ...`

and the `|| dottedPath` arm was the file's only uncovered region:
npm run test:unit:coverage reported tests/tools/e2e-data-fixtures.cjs at
100.00% lines but 98.59% regions, uncovered at line 130.

The existing non-object-parent test walks one segment before the array
stops it, so it only ever reaches the `walked.join('.')` arm. The
fallback is what the message uses when the *first* segment fails and
there is no prefix to name; without it the overlay is rejected with
"" is not an object in the real data, which identifies no path.

It is reachable rather than defensive: applyOverlay validates the
overlay document but never the real data, so a data file parsed as a
top-level array lands here on its first segment.

Adds one case driving an array, null and two non-object primitives --
each disjunct of the guard -- and asserting the message names the whole
dotted path. tests/tools/e2e-data-fixtures.cjs is now 100.00% regions.
No source change: the fallback was correct, only unpinned.

Closes #1077

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 5, 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 automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@castrojo
castrojo added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit 34d60bb Oct 6, 2026
7 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-overlay-root-path 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] parentOf's empty-prefix fallback in e2e-data-fixtures.cjs is the file's only uncovered region

1 participant