Repository navigation
Conversation
The split-to-result pass-through fires whenever ResultChunks is empty, which also covers the case where the postprocess filter legitimately dropped every chunk. Gate it on whether a postprocess stage ran.
|
@coderabbitai review |
|
Ping for CI: workflows on fork PRs stay unqueued until a maintainer approves them, so no |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Gate split-chunk fallback on postprocessing internal/parser/chunk/execute.go, internal/parser/chunk/execute_test.go |
Run uses whether a postprocess stage is configured to decide whether to fall back to split chunks. Tests verify that an empty filtered result stays empty, qualifying chunks remain, and split-only pipelines return split chunks. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested labels: 🐞 bug, parsing, go
Merge Risk: 
Minimal · up to 8bb92
-
No merge-blocking issue was identified in the fallback change.
Pre-merge checks: 
5
-
Full details: Description check
-
Explanation
The description clearly explains the bug, the implementation, the expected behavior, test coverage, verification results, and scope. It does not use the template's exact "### Summary" heading, but it provides the required information in equivalent sections.
Full details: Linked Issues check
-
Explanation
Issue
#21551requires an empty postprocess result whenFilterMinLengthdrops every chunk.Runnow gates the split-chunk fallback with!hasPostprocess, so the empty filtered result remains empty. The fallback remains for split-only pipelines. Added tests cover all-drop filtering, selective filtering, and split-only pass-through.
Full details: Out of Scope Changes check
-
Explanation
The diff changes only
internal/parser/chunk/execute.goand its tests. The code change directly implements#21551. The added tests verify the required behavior. No unrelated implementation changes are present.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 2 files.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks each chunk in line,
The filter keeps what fits its sign.
If none pass through, none return,
Split-only paths still hold their turn.
The rabbit hops; the tests confirm.
Comment @coderabbitai help to get the list of available commands.
|
|
Small CI ping: head Could a maintainer approve the workflow run? Nothing has changed since the approval request two days ago. |
What this fixes
chunk.Runhanded the split chunks back as the final result wheneverResultChunkswas empty:That pass-through is meant for a pipeline with no postprocess stage, where the split output is the answer. It cannot tell that apart from the case where the postprocess stage ran and its filter legitimately dropped every chunk — so
filter_min_lengthabove every chunk's length silently became a no-op, and the dropped chunks (whitespace-only ones included) came back as the result.ResultChunksis written only byPostprocessOperator.Execute, so the empty-vs-not distinction is the whole signal the fallback was reading.How
Gate the fallback on whether a postprocess stage was built (
hasPostprocess, the same condition that adds the stage). Split-only pipelines keep passing through; a postprocess stage's empty output is now the answer.Repro (pre-fix,
0cfa864cc)Run("a b c", ChunkOptions{SplitStrategy: "char", FilterMinLength: 5})— five 1-rune chunks, all below the limit:After the change:
result=0.Tests
TestRun_FilterDroppingEveryChunkYieldsNoChunks— the case above, with the 5-split-chunk premise pinned so the fixture cannot rot.TestRun_FilterKeepsOnlyQualifyingChunks— the filter selects rather than passes everything through.TestRun_SplitOnlyPipelineStillYieldsChunks— guards the pass-through this change narrows.Verified red/green: removing the
!hasPostprocessguard makes the first test fail withgot 5 chunks, want none.Real-sample smoke
108 runs over 12 checked-in documents (
docs/**.md,agent/schema/**.json) × 3 split strategies × 3filter_min_lengthvalues, comparing pre- and post-fix output counts. All 36 differences sit in themin_lengthabove every chunk (the case this PR fixes); the 72 realistic cases (min_length1 and 40) are identical, so no currently-working configuration changes.Scope
Only the fallback condition and its tests. Not touched: the
Sizeunit inconsistency inpostprocess.go:97(bytes vs the documented runes), which #20747 already covers, and themergeChunksmetadata aliasing, which is a separate contract question.Fixes #21551