Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[quality] parentOf's empty-prefix fallback in e2e-data-fixtures.cjs is the file's only uncovered region

Closed Beginner friendly
#1,077 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@hivecommons-hive is already working on this.

Since Oct 5, 2026.

  • #1078 by @hivecommons-hive — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
90/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
testing

Research direction

Read the existing non-object-parent test at tests/e2e-data-fixtures.test.mjs:78 and the parentOf() guard in tests/tools/e2e-data-fixtures.cjs. Add a test for top-level non-object documents that asserts the error names the full dotted path. Run npm run test:unit:coverage; done means the fallback region is covered and the tests pass.

Written by the indexing model from the issue text.

Description

agent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31 quality testing

Finding

parentOf() in tests/tools/e2e-data-fixtures.cjs builds the error that
rejects an overlay naming a path the real data does not have:

if (cursor === null || typeof cursor !== 'object' || Array.isArray(cursor))
  throw new Error(
    `${label}: "${walked.join('.') || dottedPath}" is not an object in the real data`,
  );

The || dottedPath arm has never been executed. npm run test:unit:coverage
reports tests/tools/e2e-data-fixtures.cjs at 100.00% lines but 98.59%
regions, with the sole uncovered region at line 130
— that fallback.

tests/e2e-data-fixtures.test.mjs:78 covers the other arm only. Its case,
applyOverlay({ a: [1] }, { set: { 'a.b.c': 1 } }), walks one segment
successfully before the array stops it, so walked is ['a'] and the message
names "a".

Why the uncovered arm matters

It is the arm taken when the first segment fails, where walked is still
empty. Without the fallback the overlay is rejected with

f: "" is not an object in the real data

which names nothing. The whole purpose of these guards, as the file's own
header says, is that "a regenerated data file breaks the build instead of
taking the coverage with it" — a diagnosis that identifies no path defeats
that.

It is reachable, not defensive. applyOverlay() validates that the overlay
is a JSON object (e2e-data-fixtures.cjs:158) but never validates the real
data: overlaySource() passes whatever JSON.parse returned for the data
file. Every file under data/ is an object today, so nothing exercises it —
but a data file regenerated as a top-level array, which is the shape a list of
records most naturally takes, lands here on its first segment.

Evidence and provenance
  • Unit: npm run test:unit:coverage (TZ=UTC node tests/tools/coverage-report.mjs,
    node v26.10.0), run locally 2026-10-05 at cncf/endusers main rev
    900592b: tests/tools/e2e-data-fixtures.cjs 100.00% lines / 98.59%
    regions, uncovered region at line 130.
  • End-to-end: not applicable, and not claimed either way. This module runs
    inside the webpack build, not in the browser, so it carries no source-mapped
    regions in the End-to-end coverage report
    (run 37259905958,
    artifact e2e-coverage, report.json, which lists src/** only).
  • Reachability confirmed by mutation: replacing
    ${walked.join('.') || dottedPath} with ${walked.join('.')} leaves all 22
    existing tests in tests/e2e-data-fixtures.test.mjs passing. Nothing on
    main pins this arm.

Recommendation

Add one case to tests/e2e-data-fixtures.test.mjs, beside the existing
non-object-parent test, asserting that a document which is not an object is
rejected with the full dotted path rather than an empty prefix:

test('a document that is not an object names the whole path, not an empty prefix', () => {
  for (const document of [[], null, 'text', 7]) {
    assert.throws(
      () => applyOverlay(document, overlay({ set: { 'a.b': 1 } }), 'f'),
      /"a\.b" is not an object in the real data/,
      `${JSON.stringify(document) ?? 'undefined'}: the message must name the path`,
    );
  }
});

The four documents cover each disjunct of the guard — array, null, and two
non-object primitives — all of which fail on the first segment, which is the
condition the fallback exists for.

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

Scope

One deliverable, one file, one PR. This does not touch
tests/tools/e2e-coverage-report.mjs, tests/tools/e2e-coverage-run.mjs,
tests/e2e/** or any src/** file, so it is disjoint from the open
hold-gated PRs over the e2e reporter (#1040, #1051, #1070, #1072), the
coverage CLI (#1048) and the e2e specs (#1034, #1054, #1058, #1060, #1065,
#1075). #1034 is the only open PR that edits
tests/e2e-data-fixtures.test.mjs; 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.

Priority

  • Impact: medium (an unpinned diagnostic in the guard that protects every e2e data fixture)
  • Effort: low

🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5n31 | SHA: 900592b

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

Dominant language
JavaScript
Stars
0
Forks
2
Avg merge
22h 21m
Merged PRs (30d)
404

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cncf/endusers

All issues in cncf/endusers

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.