You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The proposed commit message follows Conventional Commits.
Bugs / Features
Related issue(s) linked. Reproduced directly on main.
Tests for the changes have been added.
Docs have been added or updated.
A patch changeset for @voltagent/rag has been added.
What is the current behavior?
JsonChunker.chunk('{"tags":[],"settings":{}}') returns no chunks. Empty arrays and objects also disappear from the flattened text and field metadata when other values are present.
What is the new behavior?
Emit [] or {} as a leaf at each nested empty path. A document with tags: [] and settings: {} now retains both fields. An empty root still has zero fields.
Notes for reviewers
The new test file on upstream main produced 2 failures and 2 passing controls.
vitest run --typecheck passed all 51 RAG tests in 20 files after the fix.
The modified source and test passed a scoped strict TypeScript check. CommonJS, ESM and declaration builds passed.
Changed-file Biome, changeset Prettier and whitespace checks passed.
OpenAI Codex assisted with reproduction, implementation and local validation.
Summary by cubic
Fixes JsonChunker so nested empty arrays and objects no longer disappear from flattened chunk text and field metadata.
{"tags":[],"settings":{}} now produces chunks containing tags: [] and settings: {} instead of returning no chunks.
Empty entries inside arrays are kept as leaves alongside populated entries, e.g. items.1: [].
An empty root ({} or []) still yields zero fields.
Written for commit f495be6. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Empty objects and arrays nested in JSON documents are now retained when the documents are split into chunks, including empty entries within otherwise populated arrays.
Empty root objects and arrays continue to produce no chunks.
Tests
Added coverage for preserving nested empty containers and handling empty root values.
No actionable comments were generated in the recent review.
Walkthrough
The JSON chunker now preserves empty nested arrays and objects as path/value records. Empty root arrays and objects still produce no chunks. Tests cover these cases, and a patch changeset documents the update.
The chunker records empty non-root arrays and objects. Tests cover empty containers and populated arrays with empty entries, and verify that empty root containers produce no chunks. The changeset declares a patch release for @voltagent/rag.
The JSON chunker now keeps empty nested arrays and objects in its output, and empty root containers still produce no chunks. I found no concrete merge-blocking risk.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the actual change: a fix in the rag package that preserves nested empty JSON containers. The changeset, the JsonChunker source change, and the new tests all target that behavior. The t…
Description check
The description follows the repository template. It includes the PR checklist, the bugs/features checklist, the current and new behavior sections, and the notes for reviewers. It explains the bug with…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the actual change: a fix in the rag package that preserves nested empty JSON containers. The changeset, the JsonChunker source change, and the new tests all target that behavior. The title uses a Conventional Commits prefix and is short and specific.
Full details: Description check
Explanation
The description follows the repository template. It includes the PR checklist, the bugs/features checklist, the current and new behavior sections, and the notes for reviewers. It explains the bug with a concrete example (JsonChunker.chunk on a document with empty tags and settings) and states the expected new behavior. The checklist marks tests and a patch changeset as done. Two gaps remain: the 'fixes (issue)' line has no linked issue, and the docs item is unchecked, which the author does not explain. The 'Related issue(s) linked' item is unchecked and the note says 'Reproduced directly on main' without an issue link.
Resolution
Link the related issue in the 'fixes (issue)' line or state that no issue exists. Confirm whether docs need an update, or explain why none are needed.
Finishing Touches
Generate unit tests (beta)
Create a new PR
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 88ddf244-dab1-482f-ba13-25a30e395214
Commits
Reviewing files that changed from the base of the PR and between e9fc599 and f495be6.
Files selected for processing: 3
.changeset/preserve-empty-json-fields.md
packages/rag/src/chunkers/json-chunker.spec.ts
packages/rag/src/chunkers/json-chunker.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
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
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.
PR Checklist
Bugs / Features
@voltagent/raghas been added.What is the current behavior?
JsonChunker.chunk('{"tags":[],"settings":{}}')returns no chunks. Empty arrays and objects also disappear from the flattened text and field metadata when other values are present.What is the new behavior?
Emit
[]or{}as a leaf at each nested empty path. A document withtags: []andsettings: {}now retains both fields. An empty root still has zero fields.Notes for reviewers
vitest run --typecheckpassed all 51 RAG tests in 20 files after the fix.OpenAI Codex assisted with reproduction, implementation and local validation.
Summary by cubic
Fixes
JsonChunkerso nested empty arrays and objects no longer disappear from flattened chunk text and field metadata.{"tags":[],"settings":{}}now produces chunks containingtags: []andsettings: {}instead of returning no chunks.items.1: [].{}or[]) still yields zero fields.Written for commit f495be6. Summary will update on new commits.
Summary by CodeRabbit