fix(rspec): skip JSON parsing for non-JSON output#1510
Open
mcampbell wants to merge 1 commit intortk-ai:developfrom
Open
fix(rspec): skip JSON parsing for non-JSON output#1510mcampbell wants to merge 1 commit intortk-ai:developfrom
mcampbell wants to merge 1 commit intortk-ai:developfrom
Conversation
Collaborator
📊 Automated PR Analysis
SummaryFixes a false warning emitted when rspec runs with its default text formatter by adding a Review Checklist
Linked issues: #1506 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
Don't attempt JSON parsing if rspec output doesn't start with '{'.
Eliminates false 'JSON parse failed' warnings on text-only output
while preserving JSON parsing for actual JSON output.
Fixes rtk-ai#1506
e6a4f21 to
f024b5f
Compare
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
Fixes #1506 — RTK emits a false
[rtk] rspec: JSON parse failedwarning whenever rspec runs with its default text formatter (no--format json).starts_with('{')guard infilter_rspec_output()so JSON parsing is only attempted on JSON-shaped outputeprintln!()warningtest_filter_rspec_text_output_no_warningto document and lock in the fixRoot Cause
filter_rspec_output()unconditionally attemptedserde_json::from_stron all rspec output. When rspec runs without--format json(the common case), output is plain text, which always fails the parse and emits:The fallback worked correctly, but the warning was noise.
Fix
Testing
cargo clippy --all-targetscleancargo fmt --all -- --checkclean