Skip to content

fix: convert KeyPathTraverser recursion to iterative DFS - #263

Merged
Yuta-K19418 merged 2 commits into
mainfrom
fix/keypath-traverser-recursion
Aug 3, 2026
Merged

fix: convert KeyPathTraverser recursion to iterative DFS#263
Yuta-K19418 merged 2 commits into
mainfrom
fix/keypath-traverser-recursion

Conversation

@Yuta-K19418

Copy link
Copy Markdown
Owner

Summary

  • Replaces KeyPathTraverser's mutual recursion with an explicit-stack iterative DFS, so traversal depth is bounded by the heap instead of the call stack.
  • Splits responsibilities across three files to keep each under the project's 300-line limit and avoid circular dependencies: KeyPathTraverser (traversal entry point + iterative descent), KeyPathLeafCollector (leaf row collection / extraction / synthesis), and JsonByteExtractor (shared value-byte extraction primitive). Dependencies flow one-directionally: FullAggregationScanner → KeyPathTraverser → KeyPathLeafCollector, both depending on JsonByteExtractor.
  • Adds depth-25 and branching-index regression tests pinning the pre-refactor aggregation behavior.

Closes #253

Test plan

  • dotnet format clean
  • dotnet build — 0 warnings / 0 errors
  • dotnet test — 1533/1533 passing (KeyPathTraverserTests 21/21)
  • Two rounds of CodeReviewer review (Approved)

Yuta-K19418 and others added 2 commits August 3, 2026 15:29
…write

Adds depth-25 regression tests for key- and index-segment descent, plus
a branching-index test pinning forward DFS order across nested array
elements.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Yuta-K19418
Yuta-K19418 merged commit 77a0bcc into main Aug 3, 2026
6 checks passed
@Yuta-K19418
Yuta-K19418 deleted the fix/keypath-traverser-recursion branch August 3, 2026 08:25
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.

Unbounded recursion in KeyPathTraverser can crash on deeply nested JSON

1 participant