Skip to content

Reformat codebase and stabilize e2e tests#27

Merged
gavraz merged 2 commits into
mainfrom
gavra/chore/fmt-and-e2e-stabilization
Jul 17, 2026
Merged

Reformat codebase and stabilize e2e tests#27
gavraz merged 2 commits into
mainfrom
gavra/chore/fmt-and-e2e-stabilization

Conversation

@gavraz

@gavraz gavraz commented Jul 17, 2026

Copy link
Copy Markdown
Owner

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 --check passes 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:

  • Unsubmitted prompts. The newer TUI treats a fast input burst as a bracketed paste and swallows an Enter sent in the same send-keys call — the prompt sits unsubmitted in the input box, so the session reads as New/Idle forever. Fixed by submitting in two steps (text → settle → Enter) in send_to_session, and routing the multi/dual pane sends through it too.
  • Permission-prompt trap. working_state used "wait 10 seconds and then run ls"; under the newer manual-mode default that parks at a Bash permission prompt (Input) and never reaches Idle (which idle_state depends on). Replaced with a deterministic sleep 10 — same guaranteed ~10s Working window, independent of model speed — and pre-authorized only sleep via --allowedTools 'Bash(sleep *)' in create_session. Every other permission (e.g. input_state's Write prompt) is unchanged, so input_state still exercises a real permission prompt.

pane_status itself was confirmed correct against the new TUI (the ✻ …ing… spinner and the ❯ 1. / Esc to cancel permission prompt are both still detected) — no source change needed.

Full suite passes 16/16 across repeated runs.

🤖 Generated with Claude Code

gavraz and others added 2 commits July 17, 2026 21:36
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>
@gavraz
gavraz requested a review from Copilot July 17, 2026 18:59
@gavraz gavraz self-assigned this Jul 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 fmt formatting 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_state deterministic by using an explicit sleep 10 command and pre-authorizing only Bash(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" Enter call. This reintroduces the same Enter-swallow/bracketed-paste flake that send_to_session was added to avoid, and can leave Claude running (breaking subsequent session-id parsing). Use send_to_session here 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.

@gavraz
gavraz merged commit d953e8a into main Jul 17, 2026
1 check 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.

2 participants