Skip to content

test: cover collecting a subtree of errors and grouping a nested anyOf - #218

Merged
alexander-akait merged 1 commit into
mainfrom
claude/filter-errors-quadratic-sibling-dos-1tqe2l
Sep 8, 2026
Merged

test: cover collecting a subtree of errors and grouping a nested anyOf#218
alexander-akait merged 1 commit into
mainfrom
claude/filter-errors-quadratic-sibling-dos-1tqe2l

Conversation

@alexander-akait

Copy link
Copy Markdown
Member

Follow up to #217, which merged before this landed.

codecov reported 5 lines of #217 without coverage. Four of them are in the instance path index
that filterErrors uses above 24 errors: it was only exercised by errors that share an instance
path or have none in common, so the branch that walks into the children of a node and the comparator
that puts the collected errors back in the order they were reported were never reached.

An error that arrives after the errors nested inside it collects a whole subtree at once and covers
both - a value failing an anyOf whose object branch reports an error per property:

{ a: { anyOf: [{ type: "object", properties: { p0: , p29:  } }, { type: "string" }] } }

The second test covers groupChildrenByFirstChild putting the errors of an inner anyOf under it
rather than listing every branch flat, which is the path findAllChildren was changed for in #217.

src/validate.js goes from 97.84% to 100% of lines, statements and functions. What is left there is
branch coverage for the guards of environments without process or globalThis, which cannot be
taken on the Node.js the tests run on.

Tests only, no source changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK


Generated by Claude Code

`codecov` reported the instance path index was only exercised by errors
that share a path or have none in common, so the branch that walks into
the children of a node and the comparator that puts the collected errors
back in the order they were reported were never reached. An error
arriving after the errors nested inside it covers both.

The second test covers `groupChildrenByFirstChild` putting the errors of
an inner `anyOf` under it, which is the path that `findAllChildren` was
changed for.

`src/validate.js` goes from 97.84% to 100% of lines, what is left are the
guards for environments without `process` or `globalThis`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.78%. Comparing base (17c4e3a) to head (1d45c17).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #218      +/-   ##
==========================================
+ Coverage   95.36%   95.78%   +0.42%     
==========================================
  Files           9        9              
  Lines         949      949              
  Branches      387      387              
==========================================
+ Hits          905      909       +4     
+ Misses         40       36       -4     
  Partials        4        4              
Flag Coverage Δ
integration 95.78% <ø> (+0.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alexander-akait
alexander-akait merged commit 1d0404e into main Sep 8, 2026
33 checks passed
@alexander-akait
alexander-akait deleted the claude/filter-errors-quadratic-sibling-dos-1tqe2l branch September 8, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant