Fix CliProjectConfigTest failures: test-command verification discards commands in bare tmpdir fixtures #208

Closed
opened 2026-08-01 15:40:28 +00:00 by jared · 3 comments
Owner

Problem

2 failures in plugins/os-sdlc/tests/cli_test.rb (CliProjectConfigTest), pre-existing on main:

test_project_config_updates_an_existing_project_yaml [cli_test.rb:909]
Expected: "rake test:unit"  Actual: "rake test"

test_project_config_accepts_explicit_values [cli_test.rb:901]
Expected: "bundle exec rspec"  Actual: "rake test"

Root cause

Commit 285ab82 ("Harden os-sdlc implement pipeline CLI") added execute-then-persist verification for --test-command: verified_test_command_options/test_command_clean_exit? in bin/os-sdlc (~lines 633-647) run the candidate command via Open3.capture3, and on non-zero exit silently discard it, falling back to Project::DEFAULT_ATTRS[:test_command] = "rake test".

The tests (run_project_config, create_then_update_test_command, cli_test.rb:945-997) run the CLI in a bare tmpdir containing only git init — no Gemfile, no Rakefile — so bundle exec rspec and rake test:unit genuinely fail there and get discarded. The implementation is behaving as designed (documented at bin/os-sdlc:65-66, ADR-0074/ADR-0088); the fixtures were never updated in the same commit.

Proposed fix (test-side)

Make the fixtures pass verification. Either:

  • Use a trivially-successful command in these two tests, e.g. --test-command "true" (assert it persists as "true"), or
  • Seed the tmpdir with a minimal Rakefile defining the referenced task so the real commands exit 0.

Do NOT relax the verification in bin/os-sdlc — that would reverse the ADR-0074/0088 hardening decision; if that path is taken instead, a superseding ADR is required.

Verify

cd plugins/os-sdlc && ruby -Itests -Ilib tests/cli_test.rb — the 2 CliProjectConfigTest failures go green; 3 CliAcLint* failures are a separate ticket.

## Problem 2 failures in plugins/os-sdlc/tests/cli_test.rb (CliProjectConfigTest), pre-existing on main: ``` test_project_config_updates_an_existing_project_yaml [cli_test.rb:909] Expected: "rake test:unit" Actual: "rake test" test_project_config_accepts_explicit_values [cli_test.rb:901] Expected: "bundle exec rspec" Actual: "rake test" ``` ## Root cause Commit 285ab82 ("Harden os-sdlc implement pipeline CLI") added execute-then-persist verification for `--test-command`: `verified_test_command_options`/`test_command_clean_exit?` in bin/os-sdlc (~lines 633-647) run the candidate command via Open3.capture3, and on non-zero exit silently discard it, falling back to `Project::DEFAULT_ATTRS[:test_command]` = "rake test". The tests (`run_project_config`, `create_then_update_test_command`, cli_test.rb:945-997) run the CLI in a bare tmpdir containing only `git init` — no Gemfile, no Rakefile — so `bundle exec rspec` and `rake test:unit` genuinely fail there and get discarded. The implementation is behaving as designed (documented at bin/os-sdlc:65-66, ADR-0074/ADR-0088); the fixtures were never updated in the same commit. ## Proposed fix (test-side) Make the fixtures pass verification. Either: - Use a trivially-successful command in these two tests, e.g. `--test-command "true"` (assert it persists as "true"), or - Seed the tmpdir with a minimal Rakefile defining the referenced task so the real commands exit 0. Do NOT relax the verification in bin/os-sdlc — that would reverse the ADR-0074/0088 hardening decision; if that path is taken instead, a superseding ADR is required. ## Verify `cd plugins/os-sdlc && ruby -Itests -Ilib tests/cli_test.rb` — the 2 CliProjectConfigTest failures go green; 3 CliAcLint* failures are a separate ticket.
Author
Owner

Fixed in worktree branch worktree-fix-cli-test-regressions (commit 33a0175): fixtures use true under execute-then-persist verification; cli_test.rb added to LIVE_TEST_FILES. Full suite: 245 runs, only the 3 ticket-#209 failures remain (now also fixed). Awaiting merge.

Fixed in worktree branch worktree-fix-cli-test-regressions (commit 33a0175): fixtures use `true` under execute-then-persist verification; cli_test.rb added to LIVE_TEST_FILES. Full suite: 245 runs, only the 3 ticket-#209 failures remain (now also fixed). Awaiting merge.
Author
Owner

Merged to main (merge c15cca4, commit 33a0175). Suite green: 432 runs, 0 failures. Ready for sign-off.

Merged to main (merge c15cca4, commit 33a0175). Suite green: 432 runs, 0 failures. Ready for sign-off.
Author
Owner

Confirmed fixed on main: cli_test.rb:914-936 (CliProjectConfigTest) uses --test-command "true" per ADR-0074/0088. Full suite green (830 runs, 0 failures in clean run). Closing.

Confirmed fixed on main: cli_test.rb:914-936 (CliProjectConfigTest) uses --test-command "true" per ADR-0074/0088. Full suite green (830 runs, 0 failures in clean run). Closing.
jared closed this issue 2026-08-13 18:15:59 +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#208
No description provided.