Skip to content

fix(tui): make main green — unreachable composer hint, half-applied no-color mode - #53

Merged
rrrodzilla merged 2 commits into
mainfrom
worktree-composer-hint
Aug 30, 2026
Merged

fix(tui): make main green — unreachable composer hint, half-applied no-color mode#53
rrrodzilla merged 2 commits into
mainfrom
worktree-composer-hint

Conversation

@rrrodzilla

Copy link
Copy Markdown
Contributor

main is currently red. This fixes it.

The failure

an_empty_composer_shows_a_hint_with_the_caret_after_the_prompt fails on the assertion added by the contrast pass (499fe55):

assertion failed: rendered.lines[0].spans.iter().all(|span| span.style.fg == Some(Color::Gray))

The assertion is right; the code was wrong

The hint sat behind if lines.is_empty(), but the wrap loop above it cannot leave lines empty:

  • "".split('\n') yields one (empty) segment
  • chunk("", width) hits width("") <= width and returns vec![""] — one empty row
  • so an empty buffer still pushes a line: a styled prompt plus Span::raw("")

Span::raw carries no foreground, which is exactly what the new assertion caught.

So the hint has been dead code since it was written: an empty composer showed a bare instead of › send a message, /help for commands. The contrast pass didn't break this — it exposed a user-visible bug that had been shipping.

Fixed by handling the empty buffer before the wrap loop and deleting the unreachable branch.

Why it hid for so long

The test's other three assertions — one line, caret at (2, 0), no DIM — are all satisfied by a bare prompt. A test named "shows a hint" that never checks the hint text will pass on a render with no hint in it. This adds one that names the text.

Verified: cargo clippy --locked --workspace --all-targets -- -D warnings clean. The test itself runs in CI — garrison-agent's test binary aborts on this machine's known AWS-LC-FIPS self-test.

`main` is red: `an_empty_composer_shows_a_hint_with_the_caret_after_the_prompt`
fails on the assertion that every span on the line is `Color::Gray`.

The assertion is right and the code was wrong. The hint sat behind
`if lines.is_empty()`, but the wrap loop above it cannot leave `lines`
empty: `"".split('\n')` yields one empty segment, and `chunk` returns
`vec![""]` for it, so an empty buffer still pushes a line. That line is a
styled prompt followed by `Span::raw("")` — and a raw span has no
foreground, which is what the new assertion caught.

So the hint had been dead code since it was written, and an empty
composer showed a bare prompt instead of "send a message, /help for
commands". The contrast pass that added the assertion did not break this;
it exposed it.

Fixed by handling the empty buffer before the wrap loop instead of as a
fallback after it, and deleting the unreachable branch.

The existing test passed on the broken render for all three of its other
assertions — one line, caret at (2, 0), no DIM modifier — because a bare
prompt satisfies every one of them. A test named "shows a hint" that
never checks the hint text is how this survived, so this adds one that
names the text.
The second failure keeping `main` red:
`disabling_color_preserves_text_and_non_color_attributes` fails asserting
the span kept its BOLD.

The bold was never on the span. `Line::styled` puts the style on the
*line* and gives its spans the default style, so the test's fg and bg
assertions were passing vacuously against a span that had no color to
begin with, and the modifier assertion failed because it was looking in
the wrong place.

Fixing where the test looks exposed the real defect underneath it:
`remove_colors` cleared spans only. Rendering patches a line's style
underneath each span's, so a color set at line level is a color the
terminal still paints — "colors off" was a half-measure, which matters
here because it is an accessibility mode rather than a preference. It now
clears both levels, and a second test covers the line-level case the
first one cannot reach.

Modifiers stay untouched at both levels: bold and underline are how
emphasis survives once color cannot carry it.

Verified locally by temporarily swapping acton-ai's `fips` feature for
`tls-ring`, which sidesteps this machine's AWS-LC-FIPS self-test abort
and lets the suite actually run: 1294 passed, 0 failed across the
workspace. That swap is a local diagnostic and is not part of this
commit.
@rrrodzilla rrrodzilla changed the title fix(tui): render the empty composer's hint, which was unreachable fix(tui): make main green — unreachable composer hint, half-applied no-color mode Aug 30, 2026
@rrrodzilla

Copy link
Copy Markdown
Contributor Author

Second commit added: disabling_color_preserves_text_and_non_color_attributes was the next failure behind nextest's fail-fast.

Same shape as the first. Line::styled puts the style on the line, not its spans, so that test's fg/bg assertions were passing vacuously and the BOLD assertion was looking in the wrong place. Fixing where it looks exposed the defect underneath: remove_colors cleared spans only, and rendering patches the line's style underneath each span's — so a line-level color survived "colors off". For an accessibility mode rather than a preference, that's worth more than a test tweak. Both levels are cleared now, with a second test covering the line-level case.

Full suite now verified locally, not just by CI: temporarily swapping acton-ai's fips feature for tls-ring sidesteps this machine's AWS-LC-FIPS self-test abort and lets the suite run — 1294 passed, 0 failed across the workspace, so there is no third failure hiding behind fail-fast. The swap was a local diagnostic and is not in either commit.

@rrrodzilla
rrrodzilla merged commit 78baae2 into main Aug 30, 2026
3 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.

1 participant