Convert Runner CLI subprocess tests to in-process calls #486

Closed
opened 2026-08-23 13:48:30 +00:00 by jared · 2 comments
Owner

Context

~56 tests (Runner::CliNextInstructionTest, CliSubagentStartTest, CliSubagentStopTest, GateCliTest) each fork a fresh ruby subprocess of the real binary via Open3.capture3 (tests/support/cli_next_instruction_helpers.rb:113, subagent_start_cli.rb:14, subagent_stop_cli.rb:33), ~55-60s of the 83s suite. Routing/payload logic does not need the process boundary.

Tasks

  • Convert the bulk to in-process calls using Db.connect(":memory:") as db_migration_test.rb already does.
  • Keep 3-5 true black-box subprocess smoke tests per CLI proving the shipped binary boots and round-trips.
  • Keep real in-memory-DB tests for the db.rb adapter itself (migrations, SCHEMA_VERSION recreate) — do not stub the adapter's own tests.

Acceptance criteria

suite time drops by roughly 40s; smoke subset still spawns the real binary.

Origin

  • Trigger: manual full-suite run of plugins/os-sdlc tests on 2026-08-23 (77.9s, 1 failure) prompting a root-cause probe session
  • Improvised: none
  • Chain: 78s suite ← per-test ruby subprocess spawn paying full require chain + file-backed sqlite ← test helpers designed around the binary — DESIGN (tests/support/cli_next_instruction_helpers.rb)
  • Root candidate: this ticket
## Context ~56 tests (Runner::CliNextInstructionTest, CliSubagentStartTest, CliSubagentStopTest, GateCliTest) each fork a fresh ruby subprocess of the real binary via Open3.capture3 (tests/support/cli_next_instruction_helpers.rb:113, subagent_start_cli.rb:14, subagent_stop_cli.rb:33), ~55-60s of the 83s suite. Routing/payload logic does not need the process boundary. ## Tasks - [ ] Convert the bulk to in-process calls using Db.connect(":memory:") as db_migration_test.rb already does. - [ ] Keep 3-5 true black-box subprocess smoke tests per CLI proving the shipped binary boots and round-trips. - [ ] Keep real in-memory-DB tests for the db.rb adapter itself (migrations, SCHEMA_VERSION recreate) — do not stub the adapter's own tests. ## Acceptance criteria suite time drops by roughly 40s; smoke subset still spawns the real binary. ## Origin - Trigger: manual full-suite run of plugins/os-sdlc tests on 2026-08-23 (77.9s, 1 failure) prompting a root-cause probe session - Improvised: none - Chain: 78s suite ← per-test ruby subprocess spawn paying full require chain + file-backed sqlite ← test helpers designed around the binary — DESIGN (tests/support/cli_next_instruction_helpers.rb) - Root candidate: this ticket
Author
Owner

Work started: converting Runner CLI subprocess tests to in-process calls (batch session 2026-08-23).

Work started: converting Runner CLI subprocess tests to in-process calls (batch session 2026-08-23).
Author
Owner

Resolution

Done: Converted the bulk of the Runner CLI subprocess tests to in-process calls via a new InProcessRunnerCli shim delegating to RoundCommands (no production changes needed); kept 3 black-box subprocess smoke tests per CLI; db adapter tests untouched.

Evidence: Commit 3871ecb: 8 test files, 215 insertions. Targeted runs green (18/14/14/9/6 runs, 0 failures). Full suite 1035 runs, 2692 assertions, 0 failures, wall time 51.9s vs ~83s baseline (~31s saved).

Follow-ups: Dropped: converting the remaining Open3 users (cli_implementation_open_target_test.rb, gate_commands_test.rb) — residual wait is addressed by the parallelization ticket #488 in this same batch. Dropped: namespacing InProcessRunnerCli — matches existing flat support-class convention.

## Resolution **Done:** Converted the bulk of the Runner CLI subprocess tests to in-process calls via a new InProcessRunnerCli shim delegating to RoundCommands (no production changes needed); kept 3 black-box subprocess smoke tests per CLI; db adapter tests untouched. **Evidence:** Commit 3871ecb: 8 test files, 215 insertions. Targeted runs green (18/14/14/9/6 runs, 0 failures). Full suite 1035 runs, 2692 assertions, 0 failures, wall time 51.9s vs ~83s baseline (~31s saved). **Follow-ups:** Dropped: converting the remaining Open3 users (cli_implementation_open_target_test.rb, gate_commands_test.rb) — residual wait is addressed by the parallelization ticket #488 in this same batch. Dropped: namespacing InProcessRunnerCli — matches existing flat support-class convention.
jared closed this issue 2026-08-23 14:44:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#486
No description provided.