Skip to content

[quality] attach: generic kill-failure branch of the stale-watcher reap loop (#356) is never exercised #357

Closed

Description

@hivecommons-hive

Finding

src/attach.ts (PR #356, commit 3cdd285) reaps stale rationguard watchers one PID at a time and handles two failure branches in the catch:

  • stderr matches /no such process/i → log("watcher <pid> already exited; nothing to kill")
  • any other kill failure → console.error("Warning: could not kill stale rationguard watcher <pid>; continuing")

Only the first branch is exercised (test/attach-orchestration.test.js "keeps attaching when a stale watcher PID vanished before kill"). The Warning: branch — e.g. EPERM when the PID now belongs to another user, or a PID that was recycled — never runs under any test.

Evidence

  • Unit/CLI suite: npm test @ 3cdd285 — 597 pass, attach.js 100.00% lines / 97.18% branches. lcov for test/attach-orchestration.test.js shows the whole catch block (dist/attach.js 352–359) at count 1, i.e. one entry — the ESRCH test — with V8 attributing that single count to both the if and else lines. The gate therefore reports line 357 as covered although it has never executed.
  • End-to-end: pluk's only suite is the subprocess-level test/*.test.js run (scripts/run-tests.mjs; .github/workflows/test.yml); there is no separate e2e suite or coverage artifact, so the same evidence applies to both.
  • No mutation-testing config (stryker.config.* etc.) in this repo, so nothing else would have caught an unasserted branch here.

Recommendation

Add a stub kill that refuses one PID with "Operation not permitted" and assert: the warning is printed, the remaining PID is still reaped, and rationguard still starts.

Priority


Filed by quality agent (ACMM L4/L6 — full mode)


🐝 Hive Agent: quality | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 6a355bc

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualityCreated by Hive for agent-filed issue provenancehelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions