Skip to content

fix(pr): cap the needs-repair reason on pr repair and pr dash - #535

Merged
cameronsjo merged 3 commits into
mainfrom
claude/cadence-open-issues-9z9lqo
Sep 26, 2026
Merged

cameronsjo merged 3 commits into
mainfrom
claude/cadence-open-issues-9z9lqo

Conversation

@cameronsjo

Copy link
Copy Markdown
Owner

Summary

RepairReason is built from subprocess error text, so it can be any length. pr repair and pr dash both printed it whole. That's one physical line, but it can wrap the terminal many times.

  • New termsafe.SafeLineMax(s, maxRunes): this is SafeLine capped by rune count.
    • The cap counts escaped output, so a run of control characters can't grow past it.
    • It cuts only between whole escapes. A `` is kept or dropped entire, never split into misleading text.
    • A cut value ends in TruncatedMarker ( … [truncated]).
  • One helper, repairReasonLine, feeds both sinks, so pr repair and pr dash show the same 200-rune text.
  • pr repair --json still carries the full value.
  • SafeLine now shares a per-rune safeRune helper with SafeLineMax. 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. Local golangci-lint is 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

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
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Warning

Review paused — included plan limit reached

Keep your review moving with free on-demand reviews.

  • Run this review for free

On-demand reviews are free for the next 14 days.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Promotion and pricing details

On-demand reviews are free for the next 14 days. After that, they cost $0.25 per reviewed file.

Review limit details

Or wait 11 minutes for your next included review.

Check out review usage here.

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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Essentials

Run ID: aae7f161-6ca3-4e38-9eb3-37d883a9dd2b

📥 Commits

Reviewing files that changed from the base of the PR and between 3d3dc75 and 9664915.

📒 Files selected for processing (5)
  • internal/cli/pr_dash.go
  • internal/cli/pr_dash_test.go
  • internal/cli/pr_repair.go
  • internal/termsafe/termsafe.go
  • internal/termsafe/termsafe_test.go

Comment @coderabbitai help to get the list of available commands.

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
@cameronsjo
cameronsjo merged commit 292fc15 into main Sep 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RepairReason is printed untruncated by pr repair and pr dash

2 participants