Skip to content

refactor: extract inline test blocks to dedicated tests modules#4932

Merged
bug-ops merged 1 commit into
mainfrom
refactor/4924-extract-test-blocks
Jun 6, 2026
Merged

refactor: extract inline test blocks to dedicated tests modules#4932
bug-ops merged 1 commit into
mainfrom
refactor/4924-extract-test-blocks

Conversation

@bug-ops

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

Copy link
Copy Markdown
Owner

Summary

Extracts the inline #[cfg(test)] blocks from two oversized files into dedicated tests submodules, matching the monolith-refactor convention (#4878, #4914#4922). The production code in both files was already well-sized — the outsized totals were entirely inline tests.

File Before After (production)
crates/zeph-subagent/src/manager/mod.rs 4118 527
crates/zeph-orchestration/src/scheduler/tick.rs 2200 772 (tick/mod.rs)

Changes

  • zeph-subagent/src/manager — the three top-level test modules move to manager/tests.rs. The main tests module is de-indented to file top level (so its super:: / super::super:: paths resolve identically); worktree_predicate_tests and worktree_cleanup_guard_tests (no super:: usage) become submodules of tests. mod.rs ends at #[cfg(test)] mod tests;.
  • zeph-orchestration/src/scheduler/tick.rs — converted to a tick/ directory: tick/mod.rs (production) + tick/tests.rs. scheduler/mod.rs's mod tick; resolves to the new directory unchanged; tick/tests.rs keeps use crate::scheduler::tests::*; and use super::*;. The directory form is used because the repo has no #[path] precedent and scheduler/tests.rs is already taken by the shared-helpers module.

Verification

  • Production code is byte-identical in both files (diff against HEAD on the production line ranges).
  • Test-function count unchanged: manager 113 → 113, tick 46 → 46.
  • cargo nextest run -p zeph-subagent -p zeph-orchestration: 770 passed, 0 skipped; nested manager::tests::worktree_* modules execute.
  • cargo +nightly fmt --check, cargo clippy -p zeph-subagent -p zeph-orchestration --all-targets -- -D warnings, RUSTFLAGS="-D warnings" cargo check: all clean.

No behavior change; pure mechanical move.

Closes #4924

@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
@bug-ops
bug-ops enabled auto-merge (squash) June 6, 2026 14:56
Move the inline #[cfg(test)] blocks out of two oversized files into
dedicated test submodules, matching the monolith-refactor convention.

- zeph-subagent/src/manager/mod.rs (4118 -> 527 lines): the three
  top-level test modules move to manager/tests.rs; the main `tests`
  module is de-indented to file top level, while worktree_predicate_tests
  and worktree_cleanup_guard_tests become submodules of tests.
- zeph-orchestration/src/scheduler/tick.rs (2200 lines) becomes a
  directory: tick/mod.rs holds production code, tick/tests.rs the tests.

Production code is byte-identical in both files; pure mechanical move
with no behavior change. All 159 moved tests (113 + 46) still pass.

Closes #4924
@bug-ops
bug-ops force-pushed the refactor/4924-extract-test-blocks branch from e082356 to 2fa281a Compare June 6, 2026 14:58
@bug-ops
bug-ops merged commit be01cd8 into main Jun 6, 2026
32 checks passed
@bug-ops
bug-ops deleted the refactor/4924-extract-test-blocks branch June 6, 2026 15:05
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: extract inline test blocks to tests.rs in manager/mod.rs and scheduler/tick.rs

1 participant