Skip to content

refactor(tui): split app/mod.rs monolith into focused submodules#4938

Merged
bug-ops merged 1 commit into
mainfrom
refactor/4918-tui-app-mod-split
Jun 6, 2026
Merged

refactor(tui): split app/mod.rs monolith into focused submodules#4938
bug-ops merged 1 commit into
mainfrom
refactor/4918-tui-app-mod-split

Conversation

@bug-ops

@bug-ops bug-ops commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

Splits crates/zeph-tui/src/app/mod.rs (4235 lines) into focused submodules, continuing the monolith-refactor convention and joining the existing draw/events/keys split.

File Lines Responsibility
mod.rs 660 Type definitions (App, Panel, AgentViewTarget, TuiTranscriptEntry, TranscriptCache, SubAgentSidebarState, ConfirmState, ElicitationState) + shared free functions + module wiring
state.rs 610 App construction, builder configuration, accessors/setters, metrics polling
transcript.rs 171 Sub-agent transcript loading, polling, reload-on-change, projection into chat messages
tests.rs 2835 The 188-test #[cfg(test)] module (~67% of the original file)

The single 4235-line file was dominated (~67%) by its test module; extracting it plus the impl App accessor/transcript groups brings mod.rs down to 660 lines and shortens incremental compile times.

Notes

  • The shared impl App block is now split across files, so three previously-private cross-module methods (trim_messages, auto_scroll, maybe_reload_transcript) are bumped to pub(super).
  • Production code is moved byte-identical (only visibility bumps and explicit per-submodule imports added; no use super::* in non-test modules per the workspace clippy::pedantic gate).
  • No public API change.

Verification

  • cargo +nightly fmt --check
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked
  • cargo clippy --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler -- -D warnings
  • cargo nextest run --workspace --features full --lib --bins → 11021 passed
  • cargo doc --no-deps --all-features -p zeph-tui (broken intra-doc links denied) + cargo test --doc -p zeph-tui → 71 passed

Closes #4918

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes refactor Code refactoring without functional changes size/XL Extra large PR (500+ lines) labels Jun 6, 2026
Split crates/zeph-tui/src/app/mod.rs (4235 lines) into focused submodules,
joining the existing draw/events/keys split:

- state.rs: App construction, builder configuration, and accessors
- transcript.rs: sub-agent transcript loading, polling, and projection
- tests.rs: the 188-test #[cfg(test)] module (~67% of the file)

mod.rs (660 lines) retains the type definitions (App, Panel, AgentViewTarget,
TuiTranscriptEntry, TranscriptCache, SubAgentSidebarState, ConfirmState,
ElicitationState) and the shared free functions. The shared impl App block is
now split across files, so three cross-module methods (trim_messages,
auto_scroll, maybe_reload_transcript) are pub(super). Production code is
byte-identical; no public API change.

Closes #4918
@bug-ops
bug-ops force-pushed the refactor/4918-tui-app-mod-split branch from e1c82c1 to 6560be3 Compare June 6, 2026 15:53
@bug-ops
bug-ops merged commit 896027e into main Jun 6, 2026
32 checks passed
@bug-ops
bug-ops deleted the refactor/4918-tui-app-mod-split branch June 6, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation refactor Code refactoring without functional changes rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(tui): zeph-tui/src/app/mod.rs is 4235 lines — split into focused submodules

1 participant