Skip to content

v0.8.63: Extract inline tests from the largest Rust files before deeper refactors #3307

@Hmbown

Description

@Hmbown

Problem

Several of the largest Rust files are inflated by very large inline test modules. This makes production code harder to navigate and creates unnecessary merge conflict surface.

The analysis estimated that moving tests out of seven files can reduce visible production file size by roughly 47% with no behavior change.

Candidate files

  • crates/tui/src/mcp.rs
  • crates/tui/src/config.rs
  • crates/config/src/lib.rs
  • crates/tui/src/runtime_api.rs
  • crates/tui/src/runtime_threads.rs
  • crates/tui/src/tui/history.rs
  • crates/tui/src/tui/app.rs

Proposed shape

Move inline #[cfg(test)] modules into adjacent test files using explicit module paths where needed, for example:

#[cfg(test)]
#[path = "mcp_tests.rs"]
mod tests;

Use the repo's existing Rust module/test conventions where they already exist.

Acceptance criteria

  • Tests are moved out of the listed files without changing assertions or behavior.
  • Production modules expose only the minimum additional visibility required for moved tests.
  • Any new pub(crate)/#[doc(hidden)] visibility is justified in code review.
  • cargo test passes after the extraction.
  • No production logic is refactored in the same PR beyond mechanical test movement.

Notes

This is intentionally the first phase because it lowers later refactor risk and gives reviewers smaller production files before domain extraction begins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cleanupCode cleanup, refactor, or maintenance workdocumentationImprovements or additions to documentationenhancementNew feature or requestreliabilityReliability, flaky behavior, retries, fallbacks, and robustnessrustPull requests that update rust codev0.8.63Targeting v0.8.63

    Projects

    Status
    Backlog

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions