Add streaming JSON split input - #15
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds opt-in --split support for streaming root or nested JSON arrays/objects through existing output pipelines.
Changes:
- Adds JSON Pointer navigation and bounded parallel batch processing.
- Preserves map keys as string
idfields and arbitrary-precision numbers. - Adds CLI, Elasticsearch, fixture, documentation, and OpenSpec coverage.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/fixtures/split_root_map.json | Updated as part of this pull request. |
| tests/fixtures/split_nested_array.json | Updated as part of this pull request. |
| tests/file_output.rs | Updated as part of this pull request. |
| tests/elasticsearch.rs | Updated as part of this pull request. |
| src/main.rs | Updated as part of this pull request. |
| src/json_split.rs | Updated as part of this pull request. |
| src/input.rs | Updated as part of this pull request. |
| README.md | Updated as part of this pull request. |
| openspec/specs/json-split-input/spec.md | Updated as part of this pull request. |
| openspec/changes/add-streaming-json-split/tasks.md | Updated as part of this pull request. |
| openspec/changes/add-streaming-json-split/specs/json-split-input/spec.md | Updated as part of this pull request. |
| openspec/changes/add-streaming-json-split/proposal.md | Updated as part of this pull request. |
| openspec/changes/add-streaming-json-split/design.md | Updated as part of this pull request. |
| openspec/changes/add-streaming-json-split/.openspec.yaml | Updated as part of this pull request. |
| examples/steam-games/readme.md | Updated as part of this pull request. |
| CHANGELOG.md | Updated as part of this pull request. |
| Cargo.toml | Updated as part of this pull request. |
Suppressed comments (2)
src/json_split.rs:439
- A malformed array element fails in
next_elementbeforePendingDocument::Arrayis created, so the reported error has the source/path and parser location but no zero-based element index. The split contract promises child-context diagnostics; wrap this error with the currentindexbefore propagating it.
while let Some(raw) = sequence.next_element::<Box<RawValue>>()? {
src/json_split.rs:425
- If a selected object property is syntactically malformed,
next_valuereturns directly and the outer context only includes the source and split path; the property key is lost. This violates the child-context error contract and makes large catalogues hard to diagnose (the transform-time shape errors do include the key). Wrap this deserialization error withobject property '{key}'while retaining the parse location.
let raw = map.next_value::<Box<RawValue>>()?;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
src/json_split.rs:332
- Cancellation is not observed while this navigator consumes unmatched values with
IgnoredAny(and the array branch has the same gap). If the output receiver is dropped after a selected batch has been emitted, the parser can continue reading a potentially huge trailing/preceding sibling—or block on stdin—until it reaches EOF, because no worker is sending another result to setcancelled. Propagate consumer disconnect into the parser or use cancellation-aware skipped-value traversal so split ingestion stops promptly after output failure.
} else {
map.next_value::<IgnoredAny>()?;
src/json_split.rs:364
- This skipped-array path has the same cancellation gap as the object branch:
IgnoredAnyis consumed without checking whether the output receiver has disconnected. After a downstream failure, a large remainder of the wrapper/array can still be parsed before the parser notices cancellation, defeating prompt shutdown and potentially blocking on stdin. Use the same cancellation-aware handoff/traversal fix here as for skipped object members.
} else {
sequence.next_element::<IgnoredAny>()?.is_some()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--split <JSON_POINTER>for streaming root or nested JSON arrays and objectsidand arbitrary-precision JSON numbersTesting
cargo fmt --all -- --checkcargo test(146 passed, 5 ignored)cargo clippy(0 errors; 13 existing warnings)openspec validate add-streaming-json-split --strictopenspec validate json-split-input --type spec --strictCloses #14