Skip to content

v0.8.6 refactor: shrink App state — group fields into typed sub-states #377

@Hmbown

Description

@Hmbown

Pitch

`crates/tui/src/tui/app.rs::App` is now ~200+ public fields, many of which group naturally:

  • `onboarding_*` (4 fields)
  • `approval_*` (3 fields)
  • `composer_*` (5+ fields)
  • `runtime_turn_*` (3 fields)
  • `subagent_*` (4 fields)
  • `transcript_*` (5 fields)
  • ...

Each cluster could be its own struct (`OnboardingState`, `ApprovalCache`, `ComposerState`, `TurnState`, `SubagentTracker`, `TranscriptViewport`) with focused methods. `App` becomes a thin top-level container of these. Easier to read, easier to test, easier to refactor later.

Acceptance

  • No behavior change — every existing call site continues to compile and pass.
  • App's field count drops by at least 30%.
  • At least 3 new sub-state structs land with their own `#[cfg(test)]` coverage.
  • Standard verification gates pass.

Why now

Acquisition-readiness: a future maintainer reading `App` for the first time should see structure, not a flat 200-field god struct. This refactor pays for itself within a few PRs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestv0.8.6Targeting v0.8.6

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions