CLI invocation seam + in-process CLI tests #631
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#631
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Follow-up to #624 (merged main
cf017e0c, ADR-0205), which cut suite wall time from 112-129 s to 45-53 s. The user asked for this ticket directly after reviewing the remaining profile.Observed
About 35 test files fork
ruby bin/<own-cli>per test. Each fork boots Ruby, Bundler, Zeitwerk, and runs a SQLite schema migration, costing 5-6 s under 12-way parallel load. Session c15fe063 measured: CliNextInstructionTest 43 s, CliImplementationOpenTest 42 s, CliSubagentStopTest 22 s, OsSdlcEvidenceBinTest 17 s. os-aidd-lint's tests/aidd_lint_bin_test.rb runs 13 forks of bin/aidd-lint at 2.7 s solo. A hang-guard timeout around two Ruby boots was raised from 5 s to 30 s in c15fe063 to mask boot cost instead of removing it.plugins/os-sdlc/lib/os_sdlc/pipeline/cli.rb reads Dir.pwd or $stdin directly in ten Thor command methods instead of receiving them as parameters:
Because these methods read process globals, the only way a test can vary cwd or stdin is to fork a real subprocess. That fork is the 5-6 s cost above.
Related: #628 (open) already covers the os-sdlc-specific slice of this same problem (per-test binary fork plus a missing template-DB copy). This ticket supplies the general invocation seam #628's in-process tests need as their foundation, then extends the same fix to os-aidd-lint, os-adr, and cc-architect. Do not duplicate #628's os-sdlc task list; this ticket's os-sdlc scope is "apply the seam," #628 owns the template-DB and per-binary smoke-test details.
Reproduce
Expected
Illustration (optional)
Solution
Give each CLI an invocation object (cwd, stdin, stdout, stderr, env); only
bin/*entry points read real process globals and construct that object. Tests call the CLI command class in-process. Keep exactly one real-binary smoke test per binary. Revert the c15fe063 hang-guard timeout from 30 s back to 5 s. Add a guard test that fails when a test forks one of this repo's own binaries outside a named allowlist, mirroring the daemon-spawn guard added in #624/ADR-0205.Scope order: os-sdlc first (lib/os_sdlc/pipeline/cli.rb and its Cli*Test files, coordinating with #628's template-DB work), then os-aidd-lint (tests/aidd_lint_bin_test.rb), then os-adr (os-adr/tests/cli_test.rb), then cc-architect plugin_config tests.
Acceptance criteria
Origin
Relationship to #628
#628 is open and covers the os-sdlc-specific in-process test conversion plus copying a pre-migrated template SQLite DB per test. This ticket supplies the general invocation-seam mechanism #628's in-process tests depend on, and extends the same fix to three other plugins. Reference #628; do not duplicate its task list.
Decomposed 2026-09-23 into children (each body has
Map: #631):b, c, and d can run in parallel after a. #628 is narrowed to the template-DB copy.
Not yet ticketed: in-process tests for the other os-sdlc binaries (evidence, os-sdlc project-config, lint-worklist); the cc-architect plugin_config.rb and validate_marketplaces.rb entry points.
jared referenced this issue2026-09-23 13:49:56 +00:00
Resolution
Done: Superseded by its children, all closed and merged: #638 Invocation seam in os-sdlc (main
4b0ef96c, ADR-0207), #639 os-aidd-lint in-process CLI (main7ff78767), #640 os-adr (closed, no os-adr target), #641 cc-architect PluginConfig::Cli + Invocation (main7414b978), #642 repo-wide fork guard, in-process hook tests, 5 s hang guard (mainadfb114c). No work remains on this parent.Evidence: Each child ticket carries its own os-backlog close comment with commits and suite counts. os-sdlc suite on main
0fe1ee9a: 1383 runs, 0 failures; own_binary_fork_guard_test.rb enforces the no-fork boundary this ticket asked for. Session 557d47dd, 2026-09-24.Follow-ups: none: the children's follow-ups (#665 test-file repair route, #670 gate output cap, #662 charter brief-fetch carve-out, #628 template-DB copy) are filed on their own tickets.