Run os-sdlc CLI and other spawning tests in-process #1331

Closed
opened 2026-10-25 19:48:31 +00:00 by jared · 3 comments
Owner

Problem

Many os-sdlc tests outside tests/crc/ and tests/detector/ still start our own bin scripts with Open3. This slows the suite, which runs 65.8 s against a 60 s budget. Some bins have no callable entry: bin/lint-concept-cycles has an inline body, and dup-sweep and dead-code-sweep define a class inside the bin file.

Approach

Call the in-process entry for each bin:

  • lint_sweep_test: OsSdlc::Lint::Sweeping.run(argv:, cwd:).
  • concept_cycle_check_test: extract the body of bin/lint-concept-cycles into a ConceptCycleCheck class, then call it.
  • procman_bin_list_test: it crosses the Gemfile boundary. Keep it as the smoke test for that bin.
  • fast_gate_bin_test, ticket_growth_cli_test, cli_project_config*.
  • remediation_*cli: OsSdlc::Lint::Remediation.run.
  • evidence: OsSdlc::Evidence::Collection.start.
  • bin/os-sdlc: OsSdlc::Boot::Onboarding.start.
  • lsp-probe: OsSdlc::Daemon::Navigation.start.
  • dup-sweep and dead-code-sweep: move the class from the bin file to lib/, then call it.
  • Support helpers: subprocess_dispatch_runner.rb, sdlc_executable_helpers.rb, evidence_bin_helpers.rb, fast_gate_scenario, lint_changed_hook_scenario.
    Expected saving: 5 to 10 s.

Behavior is unchanged. The existing suite is the proof. Each bin keeps exactly one smoke test, in a file named <bin>_bin_smoke_test.rb. The smoke test runs the bin as a subprocess to prove the plain-ruby boot (ADR-0166) and the shebang. Calls to external tools (git, rubocop, likec4) stay as subprocess calls. The ADR-0232 os-sdlc-<command> contract (stdin, argv, stdout byte-identical; harness errors on stderr with exit 3) must stay asserted by the in-process tests or the smoke tests.

Required work:

  1. Extract the body of bin/lint-concept-cycles into a ConceptCycleCheck class under lib/; the bin calls it.
  2. Move the class in bin/dup-sweep and in bin/dead-code-sweep to lib/; each bin calls it.
  3. Convert the listed tests and support helpers to call their in-process entry.
  4. Add one <bin>_bin_smoke_test.rb file per converted bin; procman_bin_list_test stays as the smoke test for its bin and is renamed to match.
  5. Remove the Open3 spawn of our own bins from the support helpers — check: absent Open3 in plugins/os-sdlc/tests/support/subprocess_dispatch_runner.rb

Acceptance criteria

  1. Given the converted tests, when the suite runs, then no test outside a *_bin_smoke_test.rb file starts a plugin bin/ script as a subprocess.
  2. Given each converted bin, when its smoke test runs, then it boots with plain ruby and exits 0 on --help.
  3. Given bin/dup-sweep, bin/dead-code-sweep, and bin/lint-concept-cycles, when read, then each has a one-line body that calls a class in lib/.

Owner sketch

OsSdlc::Lint::Sweeping.run(argv:, cwd:), OsSdlc::Lint::Remediation.run, OsSdlc::Evidence::Collection.start, OsSdlc::Boot::Onboarding.start, OsSdlc::Daemon::Navigation.start, and a new ConceptCycleCheck.

Non-goals

The crc and detector bin tests. Other tickets cover them.

Origin

  • Trigger: ruby plugins/os-sdlc/tests/all.rb took 65.8 s against a 60 s budget. About 70% of summed test time is tests that start our own bin scripts with Open3.
  • Improvised this session: none
  • Chain: suite over budget ← tests start our own Ruby bin, hook, or CLI as a subprocess (Ruby boot cost per call) ← no rule says to call the in-process entry (Jared ruling, 2026-10-25; habit, no ADR)
  • Root candidate: none found; searched Open3, subprocess, in-process, bin_test, run_bin, Boot.run, ProcessIO
  • Where: plugins/os-sdlc/tests, plugins/os-sdlc/bin
  • Session: 01c29715-c945-43b4-86fc-6c5fc6c4dd3f
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/01c29715-c945-43b4-86fc-6c5fc6c4dd3f.jsonl
## Problem Many os-sdlc tests outside `tests/crc/` and `tests/detector/` still start our own bin scripts with Open3. This slows the suite, which runs 65.8 s against a 60 s budget. Some bins have no callable entry: `bin/lint-concept-cycles` has an inline body, and `dup-sweep` and `dead-code-sweep` define a class inside the bin file. ## Approach Call the in-process entry for each bin: - `lint_sweep_test`: `OsSdlc::Lint::Sweeping.run(argv:, cwd:)`. - `concept_cycle_check_test`: extract the body of `bin/lint-concept-cycles` into a `ConceptCycleCheck` class, then call it. - `procman_bin_list_test`: it crosses the Gemfile boundary. Keep it as the smoke test for that bin. - `fast_gate_bin_test`, `ticket_growth_cli_test`, `cli_project_config*`. - `remediation_*cli`: `OsSdlc::Lint::Remediation.run`. - `evidence`: `OsSdlc::Evidence::Collection.start`. - `bin/os-sdlc`: `OsSdlc::Boot::Onboarding.start`. - `lsp-probe`: `OsSdlc::Daemon::Navigation.start`. - `dup-sweep` and `dead-code-sweep`: move the class from the bin file to `lib/`, then call it. - Support helpers: `subprocess_dispatch_runner.rb`, `sdlc_executable_helpers.rb`, `evidence_bin_helpers.rb`, `fast_gate_scenario`, `lint_changed_hook_scenario`. Expected saving: 5 to 10 s. Behavior is unchanged. The existing suite is the proof. Each bin keeps exactly one smoke test, in a file named `<bin>_bin_smoke_test.rb`. The smoke test runs the bin as a subprocess to prove the plain-ruby boot (ADR-0166) and the shebang. Calls to external tools (git, rubocop, likec4) stay as subprocess calls. The ADR-0232 `os-sdlc-<command>` contract (stdin, argv, stdout byte-identical; harness errors on stderr with exit 3) must stay asserted by the in-process tests or the smoke tests. Required work: 1. Extract the body of `bin/lint-concept-cycles` into a `ConceptCycleCheck` class under `lib/`; the bin calls it. 2. Move the class in `bin/dup-sweep` and in `bin/dead-code-sweep` to `lib/`; each bin calls it. 3. Convert the listed tests and support helpers to call their in-process entry. 4. Add one `<bin>_bin_smoke_test.rb` file per converted bin; `procman_bin_list_test` stays as the smoke test for its bin and is renamed to match. 5. Remove the Open3 spawn of our own bins from the support helpers — check: absent `Open3` in `plugins/os-sdlc/tests/support/subprocess_dispatch_runner.rb` ## Acceptance criteria 1. Given the converted tests, when the suite runs, then no test outside a `*_bin_smoke_test.rb` file starts a plugin `bin/` script as a subprocess. 2. Given each converted bin, when its smoke test runs, then it boots with plain ruby and exits 0 on `--help`. 3. Given `bin/dup-sweep`, `bin/dead-code-sweep`, and `bin/lint-concept-cycles`, when read, then each has a one-line body that calls a class in `lib/`. ## Owner sketch `OsSdlc::Lint::Sweeping.run(argv:, cwd:)`, `OsSdlc::Lint::Remediation.run`, `OsSdlc::Evidence::Collection.start`, `OsSdlc::Boot::Onboarding.start`, `OsSdlc::Daemon::Navigation.start`, and a new `ConceptCycleCheck`. ## Non-goals The crc and detector bin tests. Other tickets cover them. ## Origin - Trigger: `ruby plugins/os-sdlc/tests/all.rb` took 65.8 s against a 60 s budget. About 70% of summed test time is tests that start our own bin scripts with Open3. - Improvised this session: none - Chain: suite over budget ← tests start our own Ruby bin, hook, or CLI as a subprocess (Ruby boot cost per call) ← no rule says to call the in-process entry (Jared ruling, 2026-10-25; habit, no ADR) - Root candidate: none found; searched Open3, subprocess, in-process, bin_test, run_bin, Boot.run, ProcessIO - Where: plugins/os-sdlc/tests, plugins/os-sdlc/bin - Session: 01c29715-c945-43b4-86fc-6c5fc6c4dd3f - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/01c29715-c945-43b4-86fc-6c5fc6c4dd3f.jsonl
Author
Owner

Work started in /os-sdlc:fast-batch fast-batch-15, branch fast-batch-15.

Work started in /os-sdlc:fast-batch fast-batch-15, branch fast-batch-15.
Author
Owner

fast-gate touched-test selection reported the same set (touched 7 tests, 12 runs) for every gate after commit ff904de8, and the os-me and os-adr gates missed changed files. Skeptic verdict: DROP. The cause is unconfirmed and there is no reproduce command. Check whether the forked worker caused it. File a ticket only if that confirms a selection bug. Run: fast-batch-15, session 01c29715.

fast-gate touched-test selection reported the same set (touched 7 tests, 12 runs) for every gate after commit ff904de8, and the os-me and os-adr gates missed changed files. Skeptic verdict: DROP. The cause is unconfirmed and there is no reproduce command. Check whether the forked worker caused it. File a ticket only if that confirms a selection bug. Run: fast-batch-15, session 01c29715.
Author
Owner

Resolution

Done: every remaining os-sdlc bin and hook test calls its entry in-process; five bins moved their logic to lib; one smoke test per bin and hook.

Evidence: Finding C 85681fb5..c16aac78; fixes R15 d9c39ac7, R16 b8ea605b, R21 ba8e8415. Suites at c9f5db8f: os-sdlc 2701 runs 0 failures (53.1 s, budget 60 s), os 47, os-backlog 327, os-aidd-lint 491, os-adr 111, os-me 399, cc-architect plugin_config 106, all green. Merged to main c9f5db8f, pushed be5d2c5d. Batch state and rulings: docs/crc/os-sdlc/fast-batch-15/.

Follow-ups: #1409 (fast-gate touched-test selection), #1387 (lint_changed churn; occurrence posted), #1337 (cop; main added fast_gate/os_sdlc_lint_bin_test.rb with an Open3 spawn during the batch, which the cop's zero-offense criterion will catch).

## Resolution **Done:** every remaining os-sdlc bin and hook test calls its entry in-process; five bins moved their logic to lib; one smoke test per bin and hook. **Evidence:** Finding C 85681fb5..c16aac78; fixes R15 d9c39ac7, R16 b8ea605b, R21 ba8e8415. Suites at c9f5db8f: os-sdlc 2701 runs 0 failures (53.1 s, budget 60 s), os 47, os-backlog 327, os-aidd-lint 491, os-adr 111, os-me 399, cc-architect plugin_config 106, all green. Merged to main c9f5db8f, pushed be5d2c5d. Batch state and rulings: docs/crc/os-sdlc/fast-batch-15/. **Follow-ups:** #1409 (fast-gate touched-test selection), #1387 (lint_changed churn; occurrence posted), #1337 (cop; main added fast_gate/os_sdlc_lint_bin_test.rb with an Open3 spawn during the batch, which the cop's zero-offense criterion will catch).
jared closed this issue 2026-10-26 21:21:25 +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#1331
No description provided.