fix(pr): cap the needs-repair reason on pr repair and pr dash - #535
Merged
Merged
Conversation
The reason is built from subprocess error text, so it can be any length, and both human sinks printed it whole. A new termsafe.SafeLineMax caps escaped output at a rune count, cuts only between whole escapes, and ends a cut value with a visible marker. One helper, repairReasonLine, feeds both sinks, so they show the same 200-rune text. The --json output still carries the full value. Closes #506 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wfuj7jLb8eNvEHdxurJgt9
|
Warning Review paused — included plan limit reachedKeep your review moving with free on-demand reviews.
On-demand reviews are free for the next 14 days.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Promotion and pricing detailsOn-demand reviews are free for the next 14 days. After that, they cost $0.25 per reviewed file. Review limit detailsOr wait 11 minutes for your next included review. Limit details: You’ve used the included review currently available. Your 83 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (5)
Comment |
Review nits on #535: assert the 200-rune cap in the CLI test, drop a no-op clause in the inert-output test, and say the cap counts runes, not columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wfuj7jLb8eNvEHdxurJgt9
staticcheck ST1018 rejects a raw U+202E or U+2028 inside a string literal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wfuj7jLb8eNvEHdxurJgt9
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
RepairReasonis built from subprocess error text, so it can be any length.pr repairandpr dashboth printed it whole. That's one physical line, but it can wrap the terminal many times.termsafe.SafeLineMax(s, maxRunes): this isSafeLinecapped by rune count.TruncatedMarker(… [truncated]).repairReasonLine, feeds both sinks, sopr repairandpr dashshow the same 200-rune text.pr repair --jsonstill carries the full value.SafeLinenow shares a per-runesafeRunehelper withSafeLineMax. Its output is unchanged.Tests
TestSafeLineMax: under/at/over the cap, zero means no cap, never splits an escape, counts escaped runes.TestSafeLineMaxOutputIsInert: capped output carries no unsafe rune and respects the cap.TestRepairReason_CappedTheSameOnDashAndRepair: both sinks print the identical capped string.go test ./...green. Localgolangci-lintis v2.5.0 and can't load a Go 1.26 config, so CI's lint run is the check.Closes #506
Release notes
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Wfuj7jLb8eNvEHdxurJgt9
Generated by Claude Code