Summary
executor.rs is 1,918 lines with at least 5 distinct responsibilities: step execution loop, RESULT-marker protocol parsing, bootstrap message construction, terminal UI output, and 1,060 lines of tests. It is the highest-coupling module in the codebase.
Severity: S2 (Medium) | Confidence: 0.95 | Blast radius: Low (structural, no runtime risk)
Technical Details
Responsibilities currently mixed in executor.rs:
| Responsibility |
Lines |
Why it should be separate |
| Step execution loop |
execute_steps() ~200 lines |
Core orchestration — the only thing that should stay |
| Protocol parsing |
parse_result_marker() line 183, parse_log_events() |
Stateless, highly unit-testable |
| Bootstrap message construction |
build_bootstrap_content() lines 250-319 |
Prompt assembly — belongs in provider layer |
| Terminal UI output |
print_step_result() line 733, print_run_summary() line 758, 25+ println! calls |
Couples I/O to execution engine |
| Tests |
Lines 858-1918 (1,060 lines, 32 tests) |
Duplicated setup boilerplate inflates file |
Key problem: The UI functions and inline println! calls mean the execution engine cannot be used without side-effecting stdout. This prevents:
- Using the executor in a library context
- Testing execution logic without stdout capture
- Replacing the UI (e.g., for a TUI or JSON progress mode)
Proposed Fix
Split into a module directory:
src/executor/
mod.rs — public API, execute_steps() orchestration
markers.rs — parse_result_marker(), parse_log_events()
bootstrap.rs — build_bootstrap_content()
display.rs — ProgressReporter trait + default terminal impl
Steps:
- Extract
parse_result_marker + parse_log_events into executor/markers.rs
- Define a
ProgressReporter trait in executor/display.rs with methods like step_started(), step_completed(), run_summary()
- Replace all
println! calls in the execution loop with reporter.method(...) calls
- Move
build_bootstrap_content into executor/bootstrap.rs or provider.rs
- Apply the same
ProgressReporter pattern to the 14 println! calls in command.rs (see F6)
Estimated effort: 1-2 days
Related
- Related to F6: UI logic in command.rs (same ProgressReporter pattern)
- Related to F9: test duplication concentrated here
- Part of refactor Bundle 6: Split executor.rs
🔍 Found by vibe-code-audit — automated codebase audit skill for Claude Code.
Summary
executor.rsis 1,918 lines with at least 5 distinct responsibilities: step execution loop, RESULT-marker protocol parsing, bootstrap message construction, terminal UI output, and 1,060 lines of tests. It is the highest-coupling module in the codebase.Severity: S2 (Medium) | Confidence: 0.95 | Blast radius: Low (structural, no runtime risk)
Technical Details
Responsibilities currently mixed in executor.rs:
execute_steps()~200 linesparse_result_marker()line 183,parse_log_events()build_bootstrap_content()lines 250-319print_step_result()line 733,print_run_summary()line 758, 25+println!callsKey problem: The UI functions and inline
println!calls mean the execution engine cannot be used without side-effecting stdout. This prevents:Proposed Fix
Split into a module directory:
Steps:
parse_result_marker+parse_log_eventsintoexecutor/markers.rsProgressReportertrait inexecutor/display.rswith methods likestep_started(),step_completed(),run_summary()println!calls in the execution loop withreporter.method(...)callsbuild_bootstrap_contentintoexecutor/bootstrap.rsorprovider.rsProgressReporterpattern to the 14println!calls incommand.rs(see F6)Estimated effort: 1-2 days
Related