refactor(tui): split 7.8k-line app.rs into cohesive app/ modules - #402
Closed
nhogenson wants to merge 1 commit into
Closed
refactor(tui): split 7.8k-line app.rs into cohesive app/ modules#402nhogenson wants to merge 1 commit into
nhogenson wants to merge 1 commit into
Conversation
nhogenson
force-pushed
the
refactor/split-tui-app
branch
from
September 2, 2026 06:47
c6486aa to
6410bbb
Compare
Pure structural move with zero behavior change: app.rs (7,807 lines) becomes app/ with one module per responsibility — input (keys, mouse), state model (types), provider management (providers), command dispatch (commands), session lifecycle (turns, messages, run), and the test suite (tests). Public API and re-exports are unchanged; the only visibility adjustment is pub(super) on moved private methods, which restores exactly the visibility the single-module layout provided. Verified: workspace cargo check clean, full test suite green (~1,000 tests), and cargo clippy --workspace --all-targets -D warnings clean.
nhogenson
force-pushed
the
refactor/split-tui-app
branch
from
September 2, 2026 06:49
6410bbb to
ff364a4
Compare
Author
|
Closing per request — refile as SlugThugLabs when the org token is available. |
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.
Summary
tui/src/app.rswas a 7,807-line file containing the fullAppstate struct, a 5,557-line impl block, the keyboard dispatch tree, and a 950-line test suite. This PR restructures it intoapp/with one module per responsibility. Pure structural move — zero behavior change. Every function body is byte-identical to the original; no logic was touched, no warnings fixed, no style "improved" while moving.Module layout
mod.rsAppstruct, constructor, re-exports, module wiringtypes.rskeys.rsmouse.rsproviders.rscommands.rsturns.rsmessages.rsprompt.rsviews.rsrun.rstests.rsuse super::*)Public API unchanged —
crate::app::{App, ...}re-exported frommod.rsexactly as before; zero ripples intorender.rs,messages/, orlib.rs.Visibility note (the one deliberate adjustment)
Private methods moved across module boundaries became
pub(super)— restoring exactly the visibility the single-module layout provided. Of the 79 items lifted: 48 have genuine cross-module callers; 31 are used only within their defining file and are candidates to return toprivateduring the phase-two interface work below.Placement decisions
try_copy_to_clipboardstays inmod.rs— it's crate-level public API, re-exported bylib.rs(pub use app::try_copy_to_clipboard).tick_rustle_pose,cycle_agent_mode,apply_theme, …) stay near the constructor for now; their callers live insideapp, and regrouping them belongs with the interface work.views.rsmirrors the original file's conflation; splitting it out is flagged for phase two.Known follow-up (phase two, separate PRs)
Honest caveats this PR does not hide:
keys.rsremains the largest file —handle_key_eventalone is ~2,300 lines and is the next target.Appstate; phase two replaces&mut self-everywhere with narrow interfaces and encapsulated state, and privatizes the ~31 lazy lifts.cargo fmtstays advisory per repo policy — import ordering here matches the crate's existing conventions (messages/, etc.); fmt drift is at parity with upstream (156 diffs pre-split → 171 across the same volume).Verification (matches CI gates)
cargo check --workspace --locked✅cargo test --workspace --locked✅ 1,799 tests, 0 failures (tui: 708)cargo clippy --workspace --all-targets -D warnings✅ cleanapp.rsdeleted, 11 new files, +7,892 / −7,807 (the +85 is module glue)No behavior change, no test changes, no dependency changes.