Skip to content

fix(tui): rune-safe truncation and hide the contradicting cloud-init bar - #24

Merged
NovusEdge merged 1 commit into
mainfrom
tui-fix-truncation-cloudinit
Aug 9, 2026
Merged

fix(tui): rune-safe truncation and hide the contradicting cloud-init bar#24
NovusEdge merged 1 commit into
mainfrom
tui-fix-truncation-cloudinit

Conversation

@NovusEdge

Copy link
Copy Markdown
Owner

Two rendering bugs from the TUI review (spec: 2026-08-09-tui-layout-fixes).

Rune-splitting truncation. brokenReason (list.go), provLine (provstep.go), and progressLabel (progressbar.go) truncated with a byte-index slice s[:n-1] + "…". A multi-byte rune at the cut rendered as mojibake, and len() counted bytes, not display cells. Each now uses ansi.Truncate(s, budget, "…") with its existing width budget, matching access.go.

Cloud-init bar contradicted its label. cloudInitFraction returns 1 for error, disabled, and not-run, so a failed setup drew a full 100% bar next to a red "failed" label. cloudInitBar now draws a bar only for waiting, running, and done; the three terminal non-success states draw none. Removed a dead if 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 check and just test pass.

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.
@NovusEdge NovusEdge added the bug Something isn't working label Aug 9, 2026
@NovusEdge NovusEdge self-assigned this Aug 9, 2026
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@NovusEdge, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 792f2112-6ec5-4134-948d-ea7ba2d5f724

📥 Commits

Reviewing files that changed from the base of the PR and between 5736794 and de8cb57.

📒 Files selected for processing (6)
  • internal/tui/cloudinit.go
  • internal/tui/cloudinit_test.go
  • internal/tui/list.go
  • internal/tui/progressbar.go
  • internal/tui/provstep.go
  • internal/tui/truncate_test.go

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.

❤️ Share

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

@NovusEdge
NovusEdge merged commit a63448f into main Aug 9, 2026
8 checks passed
@NovusEdge
NovusEdge deleted the tui-fix-truncation-cloudinit branch August 9, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant