Base red: cmux-tui panic ratchet indexing_slicing (834 -> 861 > 833): rewrite the new hits without panics

Merged
TE
7d ago
+106-38

Base-red fix: the Rust panic ratchet step of cmux-tui.yml is red for crate cmux-tui on feat-cmux-next: cmux-tui: clippy::indexing_slicing 834 > baseline 833 at 7f97b8485c1 (fast-checks run 41050016507), growing to 854 and then 861 as more landed. This PR rewrites each hit added since the baseline was measured (ccd5f60bd042) so it can't panic and behaves the same, then lowers the baseline to the measured count.

Where the hits came from (blame), and what replaced them

commitfilehitsnow
7a2d52d3bc8c (cmux team invite alias)cli/app.rs1rest.get(1..).unwrap_or_default() (the arm matches only when rest[0] is invite)
3c7024f570cd (#28085)cli/mcp/code_mode.rs, cli/mcp/placement.rs, cli/mcp/v2_tools.rs19get / pointer reads; JsonSet::set / set_path writes; block_end walks the bytes with get
7f97b8485c1e (#27976)cli/mcp/upstream.rs1init.get("instructions")
8f5dfe06ee58 (#28248)cli/mcp.rs, cli/mcp/v2_tools.rs8get / pointer reads, JsonSet::set for the anchored wait pattern

A missing value read through get / pointer compares the same as the Null that indexing returned. block_end stops at the end of input exactly as the old i < len checks did, including an escape or comment cut off at the end.

Baseline

cmux-tui measured at the merged head ed262bc (fast-checks run 41078934160): indexing_slicing 831, with no new hits since the merge-base. While this PR was open, #28169 raised the baseline to 861, so this PR lowers it 861 -> 831. Its other lints are unchanged.

Tests

  • cli::app::tests::a_bare_team_invite_runs_the_home_action_with_no_arguments
  • cli::mcp::code_mode::block_end_tests::block_end_skips_quoted_and_commented_braces_and_stops_at_the_end (strings, template literals and comments, plus input cut off at the end)
  • cli::mcp::code_mode::block_end_tests::compact_keeps_required_and_hints

Observed / Not run

  • At 8f805d919b5c (fast-checks run 41069289790): cargo test -p cmux-tui --lib -- cli::app::tests cli::mcp gave 216 passed and 0 failed. The workspace panic ratchet printed no cmux-tui: line. The only RED lines are acpmux's (indexing_slicing 716 > 693, string_slice 98 > 94), which #28134 fixes.
  • The cli.rs resource-API-boundary red from #28248 / #28252 is a base red owned elsewhere. This PR doesn't touch it.
  • At ed262bcd2c3d (after merging feat-cmux-next, fast-checks run 41078934160): cargo clippy --locked --keep-going -p cmux-tui --all-targets -- -D warnings was clean, the 216 cli::app::tests and cli::mcp tests passed, and the panic ratchet printed no RED lines.
  • Review (gpt-6.1-sol, high, fast): SHIP at 8f805d919b5cdbd606252c933027caa05a86fad1, with no findings. After the base merge (it conflicted only in the baseline json, and the cmux-tui source hunks are unchanged), the delta review gave SHIP at 316caf9220cebcc15732aaca4cce421f5a36618c, with no findings.
  • Not run: the full cmux-tui test suite (CI covers it) and macOS builds (no Swift change).

Changelog

none

risk:low (panic-free rewrites with the same output, tests, and a lower baseline).

Agent session: agent session

šŸ¤– Generated with Claude Code