Run os-me spawning tests in-process #1332

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

Problem

Seven os-me test files start our own bin and hook scripts with Open3.capture3(RbConfig.ruby, BIN or HOOK). This slows the suite. It also stops the journey tracer (#1327) from tracing these tests, because it cannot trace a subprocess.

Approach

The files are extract_budget (5 tests), extract_launcher (4), one_thing_hook (2), route_cli (5), route_shadow_cli (4), confidence_extractor_run, and row_labels_run. The bins already have an entry: OsMe::CLI.start(['route', *ARGV]) (cli.rb:8). test/cli_test.rb:19 already uses capture_io with it. The hooks one_thing.rb and record_prediction.rb are top-level script bodies. Extract a callable class that takes stdin, stdout, and the home dir. The extract_launcher.rb hook wraps OsMe::ExtractLauncher.new(store:, spawner:); call that.

Behavior is unchanged. The existing suite is the proof. Each bin or hook keeps exactly one smoke test, in a file named <bin>_bin_smoke_test.rb. The smoke test runs it as a subprocess to prove the plain-ruby boot and the shebang. Calls to external tools (git, rubocop) stay as subprocess calls.

Required work:

  1. Convert the bin tests to call OsMe::CLI.start inside capture_io.
  2. Extract the body of one_thing.rb and of record_prediction.rb into classes that take stdin, stdout, and the home dir; the hooks call them.
  3. Convert the hook tests to call those classes, and the launcher test to call OsMe::ExtractLauncher.
  4. Add one <bin>_bin_smoke_test.rb file per bin and hook.
  5. Remove Open3 from the converted tests — check: absent Open3 in plugins/os-me/test/route_cli_test.rb

Blocks: #1327

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/ or hooks/ script as a subprocess.
  2. Given each bin and hook, when its smoke test runs, then it boots with plain ruby and exits 0 on --help or on empty valid input.
  3. Given the converted os-me tests, when they run, then they pass with the same assertions as before.
  4. Given a hook class, when called with a stdin string, a stdout buffer, and a home dir, then it writes the same output as the hook script did.

Owner sketch

OsMe::CLI.start(['route', *ARGV]), OsMe::ExtractLauncher.new(store:, spawner:), and new classes for the one_thing and record_prediction hook bodies.

Non-goals

The journey tracer (#1327) itself.

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-me/test, plugins/os-me/bin, plugins/os-me/hooks
  • Session: 01c29715-c945-43b4-86fc-6c5fc6c4dd3f
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/01c29715-c945-43b4-86fc-6c5fc6c4dd3f.jsonl
## Problem Seven os-me test files start our own bin and hook scripts with `Open3.capture3(RbConfig.ruby, BIN or HOOK)`. This slows the suite. It also stops the journey tracer (#1327) from tracing these tests, because it cannot trace a subprocess. ## Approach The files are `extract_budget` (5 tests), `extract_launcher` (4), `one_thing_hook` (2), `route_cli` (5), `route_shadow_cli` (4), `confidence_extractor_run`, and `row_labels_run`. The bins already have an entry: `OsMe::CLI.start(['route', *ARGV])` (`cli.rb:8`). `test/cli_test.rb:19` already uses `capture_io` with it. The hooks `one_thing.rb` and `record_prediction.rb` are top-level script bodies. Extract a callable class that takes stdin, stdout, and the home dir. The `extract_launcher.rb` hook wraps `OsMe::ExtractLauncher.new(store:, spawner:)`; call that. Behavior is unchanged. The existing suite is the proof. Each bin or hook keeps exactly one smoke test, in a file named `<bin>_bin_smoke_test.rb`. The smoke test runs it as a subprocess to prove the plain-ruby boot and the shebang. Calls to external tools (git, rubocop) stay as subprocess calls. Required work: 1. Convert the bin tests to call `OsMe::CLI.start` inside `capture_io`. 2. Extract the body of `one_thing.rb` and of `record_prediction.rb` into classes that take stdin, stdout, and the home dir; the hooks call them. 3. Convert the hook tests to call those classes, and the launcher test to call `OsMe::ExtractLauncher`. 4. Add one `<bin>_bin_smoke_test.rb` file per bin and hook. 5. Remove `Open3` from the converted tests — check: absent `Open3` in `plugins/os-me/test/route_cli_test.rb` Blocks: #1327 ## 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/` or `hooks/` script as a subprocess. 2. Given each bin and hook, when its smoke test runs, then it boots with plain ruby and exits 0 on `--help` or on empty valid input. 3. Given the converted os-me tests, when they run, then they pass with the same assertions as before. 4. Given a hook class, when called with a stdin string, a stdout buffer, and a home dir, then it writes the same output as the hook script did. ## Owner sketch `OsMe::CLI.start(['route', *ARGV])`, `OsMe::ExtractLauncher.new(store:, spawner:)`, and new classes for the `one_thing` and `record_prediction` hook bodies. ## Non-goals The journey tracer (#1327) itself. ## 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-me/test, plugins/os-me/bin, plugins/os-me/hooks - 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

Resolution

Done: os-me tests call entries in-process; one_thing hook body and both eval harnesses moved to lib; smoke tests per entry, including record_prediction.

Evidence: Finding D 74961c73, 79c0a276; rulings R5 58fea20a, R6 745b425d. 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: #1388 (os-me-route KeyError), #1410 (OneThingPrompt::Hook swallows failures), #1337 (cop).

## Resolution **Done:** os-me tests call entries in-process; one_thing hook body and both eval harnesses moved to lib; smoke tests per entry, including record_prediction. **Evidence:** Finding D 74961c73, 79c0a276; rulings R5 58fea20a, R6 745b425d. 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:** #1388 (os-me-route KeyError), #1410 (OneThingPrompt::Hook swallows failures), #1337 (cop).
jared closed this issue 2026-10-26 21:21:26 +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#1332
No description provided.