finish_command.rb sweep names the os-sdlc-runner path it tried (#635b) #703

Closed
opened 2026-09-24 20:10:19 +00:00 by jared · 3 comments
Owner

Problem

finish_command.rb's worktree-removal sweep reports only a boolean. It cannot distinguish "binary not found" from "binary found but exited nonzero." The fix must keep the existing sweep-failure test green: it asserts the message contains os-sdlc-runner in stderr and that the process still exits 0.

Observed

Verified on main today (2026-09-24).

plugins/os/lib/worktree/finish_command.rb:124-126 system('os-sdlc-runner', ...) || warn(...) reports only a boolean; it cannot distinguish "binary not found" from "binary found but exited nonzero." Pinned by plugins/os/tests/worktree/finish_command_sweep_failure_does_not_block_removal_test.rb, which asserts /os-sdlc-runner/ appears in stderr and that the process exits 0.

Reproduce

grep -n "system('os-sdlc-runner'" plugins/os/lib/worktree/finish_command.rb

Approach

Add a Worktree::BinaryLocator (or reuse a shared one) and use it in finish_command.rb for os-sdlc-runner, replacing the boolean-only system(...) ||. When the binary is missing, warn with "os-sdlc-runner not found on PATH (tried: ...), usage not swept"; when it is found but exits nonzero, warn with the resolved path and the exit status. Sweep failure never blocks worktree removal either way.

Required work:

  1. Add Worktree::BinaryLocator (or reuse a shared one) and use it in finish_command.rb for os-sdlc-runner, replacing the boolean-only system(...) || — check: plugins/os/tests/worktree/finish_command_sweep_failure_does_not_block_removal_test.rb still asserts /os-sdlc-runner/ in stderr and exit 0, unchanged.
  2. Warn with the resolved path and exit status when the binary is found but fails, distinct from the not-found case.

Rejected: an ENV variable override for the binary path (forbidden by ADR-0213's neighboring boundary rule; keep resolution to PATH plus named fallback). Merging plugin load paths (a deliberate process boundary, not an accident to fix by removing it).

Non-goals: changing what happens when the sweep legitimately fails for a reason other than a missing binary. No ADR change.

Constraint: plugins/os/tests/worktree/finish_command_sweep_failure_does_not_block_removal_test.rb must stay green (message still contains "os-sdlc-runner", exit 0).

VERDICT: CREATE

Acceptance criteria

  1. Given os-sdlc-runner is not found on PATH, when finish_command.rb runs its sweep, then it warns "os-sdlc-runner not found on PATH (tried: ...), usage not swept" and does not block worktree removal.
  2. Given os-sdlc-runner is found but exits nonzero, when finish_command.rb runs its sweep, then it warns with the resolved path and the exit status, and still does not block worktree removal.

Owner sketch

module Worktree
  class BinaryLocator
    def self.resolve(name)
      # same PATH-only search, raise NotFound listing tried entries
    end
  end
end

Non-goals

  • Merging plugin load paths.
  • Any environment-variable override for binary location.

Origin

  • Trigger: shell-call/ENV audit, session 16bf37b3-8cff-4121-896c-4a5fc61f2e9e (2026-09-23), user-requested.
  • Improvised this session: none.
  • Chain: fragile cross-plugin binary lookup ← boolean-only system(...) || instead of a resolved, injectable path ← DESIGN, plugins are separate load paths by design (not a bug to fix by merging them).
  • Root candidate: #635 (split 2026-09-24, session 082c3e8b).
  • Where: plugins/os/lib/worktree/finish_command.rb:125
  • Session: 082c3e8b-5598-4c69-9ea6-b717e9c8afb2
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/082c3e8b-5598-4c69-9ea6-b717e9c8afb2.jsonl
## Problem `finish_command.rb`'s worktree-removal sweep reports only a boolean. It cannot distinguish "binary not found" from "binary found but exited nonzero." The fix must keep the existing sweep-failure test green: it asserts the message contains `os-sdlc-runner` in stderr and that the process still exits 0. ## Observed Verified on main today (2026-09-24). `plugins/os/lib/worktree/finish_command.rb:124-126` `system('os-sdlc-runner', ...) || warn(...)` reports only a boolean; it cannot distinguish "binary not found" from "binary found but exited nonzero." Pinned by `plugins/os/tests/worktree/finish_command_sweep_failure_does_not_block_removal_test.rb`, which asserts `/os-sdlc-runner/` appears in stderr and that the process exits 0. ## Reproduce ``` grep -n "system('os-sdlc-runner'" plugins/os/lib/worktree/finish_command.rb ``` ## Approach Add a `Worktree::BinaryLocator` (or reuse a shared one) and use it in `finish_command.rb` for `os-sdlc-runner`, replacing the boolean-only `system(...) ||`. When the binary is missing, warn with "os-sdlc-runner not found on PATH (tried: ...), usage not swept"; when it is found but exits nonzero, warn with the resolved path and the exit status. Sweep failure never blocks worktree removal either way. Required work: 1. Add `Worktree::BinaryLocator` (or reuse a shared one) and use it in `finish_command.rb` for `os-sdlc-runner`, replacing the boolean-only `system(...) ||` — check: `plugins/os/tests/worktree/finish_command_sweep_failure_does_not_block_removal_test.rb` still asserts `/os-sdlc-runner/` in stderr and exit 0, unchanged. 2. Warn with the resolved path and exit status when the binary is found but fails, distinct from the not-found case. Rejected: an ENV variable override for the binary path (forbidden by ADR-0213's neighboring boundary rule; keep resolution to PATH plus named fallback). Merging plugin load paths (a deliberate process boundary, not an accident to fix by removing it). Non-goals: changing what happens when the sweep legitimately fails for a reason other than a missing binary. No ADR change. Constraint: `plugins/os/tests/worktree/finish_command_sweep_failure_does_not_block_removal_test.rb` must stay green (message still contains "os-sdlc-runner", exit 0). VERDICT: CREATE ## Acceptance criteria 1. Given os-sdlc-runner is not found on PATH, when `finish_command.rb` runs its sweep, then it warns "os-sdlc-runner not found on PATH (tried: ...), usage not swept" and does not block worktree removal. 2. Given os-sdlc-runner is found but exits nonzero, when `finish_command.rb` runs its sweep, then it warns with the resolved path and the exit status, and still does not block worktree removal. ## Owner sketch ```ruby module Worktree class BinaryLocator def self.resolve(name) # same PATH-only search, raise NotFound listing tried entries end end end ``` ## Non-goals - Merging plugin load paths. - Any environment-variable override for binary location. ## Origin - Trigger: shell-call/ENV audit, session 16bf37b3-8cff-4121-896c-4a5fc61f2e9e (2026-09-23), user-requested. - Improvised this session: none. - Chain: fragile cross-plugin binary lookup ← boolean-only `system(...) ||` instead of a resolved, injectable path ← DESIGN, plugins are separate load paths by design (not a bug to fix by merging them). - Root candidate: #635 (split 2026-09-24, session 082c3e8b). - Where: plugins/os/lib/worktree/finish_command.rb:125 - Session: 082c3e8b-5598-4c69-9ea6-b717e9c8afb2 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/082c3e8b-5598-4c69-9ea6-b717e9c8afb2.jsonl
Author
Owner

Work started in session 082c3e8b on branch ticket-703 via /os-sdlc:implement.

Work started in session 082c3e8b on branch ticket-703 via /os-sdlc:implement.
Author
Owner

Implementation 32 failed at seam-designer (verdict:error): the change-auditor dispatch 347 produced a handoff for ticket #702 (BodyFetch, os-sdlc) instead of #703 (finish_command.rb, os). Reopening a fresh implementation.

Implementation 32 failed at seam-designer (verdict:error): the change-auditor dispatch 347 produced a handoff for ticket #702 (BodyFetch, os-sdlc) instead of #703 (finish_command.rb, os). Reopening a fresh implementation.
Author
Owner

Resolution

Done: Worktree::UsageSweep owns the sweep; Worktree::BinaryLocator resolves os-sdlc-runner on PATH. Missing binary warns 'os-sdlc-runner not found on PATH (tried: ...), usage not swept'; a nonzero exit warns with the resolved path and exit status. Worktree removal proceeds in both cases.

Evidence: Pipeline implementation 33 (11 dispatches, implementation_complete; implementation 32 failed on a wrong-ticket change-auditor handoff, captured as #706). New test plugins/os/tests/worktree/finish_command_sweep_binary_resolution_test.rb (2 cases); existing finish_command_sweep_failure_does_not_block_removal_test.rb stays green. os suite 24 runs 0 failures. Commit on branch ticket-703.

Follow-ups: #706 captured (change-auditor audited previous ticket, VERDICT: CREATE). Dropped: Style/Documentation offenses on the two new classes match existing plugin practice (Removal has the same offense) and the repo forbids what-it-does comments.

## Resolution **Done:** Worktree::UsageSweep owns the sweep; Worktree::BinaryLocator resolves os-sdlc-runner on PATH. Missing binary warns 'os-sdlc-runner not found on PATH (tried: ...), usage not swept'; a nonzero exit warns with the resolved path and exit status. Worktree removal proceeds in both cases. **Evidence:** Pipeline implementation 33 (11 dispatches, implementation_complete; implementation 32 failed on a wrong-ticket change-auditor handoff, captured as #706). New test plugins/os/tests/worktree/finish_command_sweep_binary_resolution_test.rb (2 cases); existing finish_command_sweep_failure_does_not_block_removal_test.rb stays green. os suite 24 runs 0 failures. Commit on branch ticket-703. **Follow-ups:** #706 captured (change-auditor audited previous ticket, VERDICT: CREATE). Dropped: Style/Documentation offenses on the two new classes match existing plugin practice (Removal has the same offense) and the repo forbids what-it-does comments.
jared closed this issue 2026-09-24 20:55:58 +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#703
No description provided.