Run os-adr spawning tests in-process #1335

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

Problem

Three os-adr test files start our own bin scripts with Open3: record/creation_test (3 spawn sites, 9 tests), repository/initialization_test (3), and migration/adr_migrate_bin_test (1). bin/adr-migrate is a 27-line inline script, so it has no callable entry.

Approach

Call Adr::Record::CommandLine#run from creation_test. Call Adr::Repository::Initialization#run(argv) from initialization_test. Extract the bin/adr-migrate body into a class and call it from the migration test.

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. Extract the body of bin/adr-migrate into a class under lib/; the bin calls it.
  2. Convert the three test files to call their in-process entry.
  3. Add one <bin>_bin_smoke_test.rb file per bin.

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 bin/adr-migrate, when read, then it has a one-line body that calls a class in lib/.
  4. Given the converted tests, when they run, then they pass with the same assertions as before.

Owner sketch

Adr::Record::CommandLine#run, Adr::Repository::Initialization#run(argv), and a new class for the adr-migrate body.

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-adr/tests, plugins/os-adr/bin/adr-migrate
  • Session: 01c29715-c945-43b4-86fc-6c5fc6c4dd3f
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/01c29715-c945-43b4-86fc-6c5fc6c4dd3f.jsonl
## Problem Three os-adr test files start our own bin scripts with Open3: `record/creation_test` (3 spawn sites, 9 tests), `repository/initialization_test` (3), and `migration/adr_migrate_bin_test` (1). `bin/adr-migrate` is a 27-line inline script, so it has no callable entry. ## Approach Call `Adr::Record::CommandLine#run` from `creation_test`. Call `Adr::Repository::Initialization#run(argv)` from `initialization_test`. Extract the `bin/adr-migrate` body into a class and call it from the migration test. 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. Extract the body of `bin/adr-migrate` into a class under `lib/`; the bin calls it. 2. Convert the three test files to call their in-process entry. 3. Add one `<bin>_bin_smoke_test.rb` file per bin. ## 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 `bin/adr-migrate`, when read, then it has a one-line body that calls a class in `lib/`. 4. Given the converted tests, when they run, then they pass with the same assertions as before. ## Owner sketch `Adr::Record::CommandLine#run`, `Adr::Repository::Initialization#run(argv)`, and a new class for the `adr-migrate` body. ## 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-adr/tests, plugins/os-adr/bin/adr-migrate - 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-adr creation, initialization and migration tests call their entries in-process; adr-migrate body moved to Adr::Migration::CommandLine; three smoke files.

Evidence: Finding G 001b8973, 938f652f; fix R17 1ae9c537. 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: #1337 (cop). Nothing else.

## Resolution **Done:** os-adr creation, initialization and migration tests call their entries in-process; adr-migrate body moved to Adr::Migration::CommandLine; three smoke files. **Evidence:** Finding G 001b8973, 938f652f; fix R17 1ae9c537. 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:** #1337 (cop). Nothing else.
jared closed this issue 2026-10-26 21:21:28 +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#1335
No description provided.