Reformat codebase and stabilize e2e tests#27
Merged
Conversation
Pure formatting, no behavioral changes. Brings the tree in line with the current stable rustfmt so `cargo fmt --check` passes cleanly. Isolated into its own commit to keep future diffs free of formatting noise. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Three fixes, all addressing flakiness against Claude Code v2.1.212: * Submit prompts in two steps (text, settle, then Enter). Newer TUIs treat a fast input burst as a bracketed paste and swallow an Enter sent in the same send-keys call, leaving the prompt unsubmitted so the session reads as New/Idle forever. This was the root cause of the working_state, input_state, and multi_pane_status failures. * Route the multi_pane and dual_pane prompt sends through send_to_session so they get the same two-step submit. * Give working_state a deterministic Working window via `sleep 10` instead of a tool-using prompt that parked at a permission prompt (Input) and never reached Idle. `sleep` is pre-authorized in create_session (via --allowedTools 'Bash(sleep *)'); all other permissions — including input_state's Write prompt — are unchanged. Full suite now passes 16/16 across repeated runs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR contains two chores: a repo-wide rustfmt reformat to keep diffs clean and cargo fmt --check passing, and targeted updates to the e2e test harness to make Claude Code TUI status-detection tests reliable against newer Claude Code versions.
Changes:
- Apply
cargo fmtformatting across the Rust codebase (no intended behavior changes). - Stabilize e2e prompt submission by routing prompts through
send_to_session(separate text + Enter with a short settle). - Make
working_statedeterministic by using an explicitsleep 10command and pre-authorizing onlyBash(sleep *)for that path.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/e2e.sh | Stabilizes e2e interactions (prompt submission + deterministic working window) and updates multi/dual-pane sends to use the helper. |
| src/view_ui.rs | Rustfmt-only reformatting of UI rendering code and tests. |
| src/ui.rs | Rustfmt-only reformatting of table UI rendering. |
| src/tmux.rs | Rustfmt-only reformatting (function formatting / indentation). |
| src/session.rs | Rustfmt-only reformatting (line wrapping / indentation). |
| src/park.rs | Rustfmt-only reformatting of path construction. |
| src/new_session.rs | Rustfmt-only reformatting of key handling match arms. |
| src/main.rs | Rustfmt-only reformatting of command matching and draw closure. |
| src/history.rs | Rustfmt-only reformatting; no logic changes intended. |
| src/config.rs | Rustfmt-only reformatting of TOML parse line wrapping. |
| src/app.rs | Rustfmt-only reformatting of view/filter code paths. |
Comments suppressed due to low confidence (1)
tests/e2e.sh:496
- In dual_pane_discovery, the Claude exit is still sent via a single
tmux send-keys ... "exit" Entercall. This reintroduces the same Enter-swallow/bracketed-paste flake thatsend_to_sessionwas added to avoid, and can leave Claude running (breaking subsequent session-id parsing). Usesend_to_sessionhere as well for consistency and reliability.
send_to_session "$S_DUAL:0.0" "say exactly: dual pane test"
wait_for_state "$S_DUAL" "Idle" 30 >/dev/null 2>&1 || true
# Exit Claude — bash shell remains in pane 0
tmux send-keys -t "$S_DUAL:0.0" "exit" Enter
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent chores, kept as separate commits for clean review.
1. Reformat codebase with cargo fmt
Pure formatting, no behavioral change — brings the tree in line with the current stable rustfmt so
cargo fmt --checkpasses cleanly. Isolated into its own commit so it doesn't muddy future diffs.2. Stabilize e2e status-detection tests
The status-detection tests (
working_state,input_state,multi_pane_status,idle_state) were failing against Claude Code v2.1.212. Root causes, empirically diagnosed by driving a live TUI and snapshotting panes:Entersent in the samesend-keyscall — the prompt sits unsubmitted in the input box, so the session reads asNew/Idleforever. Fixed by submitting in two steps (text → settle →Enter) insend_to_session, and routing the multi/dual pane sends through it too.working_stateused"wait 10 seconds and then run ls"; under the newer manual-mode default that parks at a Bash permission prompt (Input) and never reachesIdle(whichidle_statedepends on). Replaced with a deterministicsleep 10— same guaranteed ~10s Working window, independent of model speed — and pre-authorized onlysleepvia--allowedTools 'Bash(sleep *)'increate_session. Every other permission (e.g.input_state's Write prompt) is unchanged, soinput_statestill exercises a real permission prompt.pane_statusitself was confirmed correct against the new TUI (the✻ …ing…spinner and the❯ 1./Esc to cancelpermission prompt are both still detected) — no source change needed.Full suite passes 16/16 across repeated runs.
🤖 Generated with Claude Code