fix(tui): rune-safe truncation and hide the contradicting cloud-init bar - #24
Conversation
Three truncation sites sliced strings by byte index. A multi-byte rune at the cut produced invalid UTF-8 and rendered as mojibake. list.go's brokenReason, provstep.go's provLine, and progressbar.go's progressLabel now call ansi.Truncate, which cuts on rune and cell boundaries. cloudInitBar drew a full bar for the "error", "disabled" and "not-run" states, next to a red "failed" or dim status label. It now draws no bar for those three terminal non-success states, and keeps the bar for "waiting", "running" and "done". Removed a dead branch in cloudInitBar whose outer "done" check duplicated the switch's own fallthrough.
|
Warning Review limit reached
Next review available in: 35 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
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. Comment |
Two rendering bugs from the TUI review (spec: 2026-08-09-tui-layout-fixes).
Rune-splitting truncation.
brokenReason(list.go),provLine(provstep.go), andprogressLabel(progressbar.go) truncated with a byte-index slices[:n-1] + "…". A multi-byte rune at the cut rendered as mojibake, andlen()counted bytes, not display cells. Each now usesansi.Truncate(s, budget, "…")with its existing width budget, matching access.go.Cloud-init bar contradicted its label.
cloudInitFractionreturns 1 forerror,disabled, andnot-run, so a failed setup drew a full 100% bar next to a red "failed" label.cloudInitBarnow draws a bar only forwaiting,running, anddone; the three terminal non-success states draw none. Removed a deadif status == "done"branch the switch already handled.Tests:
TestTruncationKeepsValidUTF8(multi-byte input stays valid UTF-8 within the cell budget — fails on all three sites before the fix), and a cloud-init test asserting a failed state renders no bar.just checkandjust testpass.