Repository navigation
fix/ preserve JSON output for empty search results - #394
Open
ammarkaskar wants to merge 3 commits into
Open
ammarkaskar wants to merge 3 commits into
ammarkaskar wants to merge 3 commits into
Conversation
Added a test case to handle empty search results, ensuring valid JSON output for empty results.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Shadow auto-approve: would not auto-approve because issues were found.
Reply to a comment to ask cubic a question or push back. It learns from your replies.
Click Fix with cubic on a comment, or reply @cubic-dev-ai fix this, and cubic writes the fix.
View guided diff | Re-trigger cubic
Refactor test for empty search results to improve clarity and maintainability.
Contributor
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Shadow auto-approve: would auto-approve. Focused fix: empty search results now produce valid JSON under --json/--pretty, while default text output is unchanged; regression tests cover both modes.
View guided diff | Re-trigger cubic
This branch has not been deployed
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.
Problem
When a search returns no results, the CLI prints
No results found.even when--jsonor--prettyis specified. This breaks JSON parsing in scripts and prevents empty results from being written to the requested output file.Fix
Only return the plain text message when neither JSON nor pretty output is requested. The default human readable behavior remains unchanged.
Testing
Added regression tests for empty search results with both
--jsonand--pretty.All seven CI checks passed on my fork, including formatting, type checking, build, unit tests, binary tests and npm package smoke tests across Linux, macOS and Windows.
Summary by cubic
Fixes the search command so empty results return valid JSON when
--jsonor--prettyis set, instead of printing "No results found." and breaking JSON parsing in scripts.--jsonand--pretty.Written for commit 3b75390. Summary will update on new commits.