Skip to content

daemon-lifecycle e2e: the it.fails status test passes for the wrong reason #422

Closed

Description

@V3RON

e2e/daemon-lifecycle.test.ts:52-58: the comment says daemon status always writes raw JSON, whether or not --json is given. But src/cli/index.ts:1662-1663 prints formatStatus(...) when --json is absent. The it.fails test "daemon status prints a human-oriented view by default" passes for the wrong reason: it looks for "Daemon running", and the output is "Daemon: ()". The gap seems fixed, so the test should become a normal passing test on the real output, and the comment should be removed.

Found by the review of PR #419.

Written by an agent.

Activity

  1. added
    bug:newReported. Nobody has looked yet.
    bug:triageAn agent may reproduce it and write the triage report.
    and removed
    bug:newReported. Nobody has looked yet.
    on Oct 6, 2026
  2. self-assigned this
    on Oct 8, 2026
  3. V3RON commented on Oct 9, 2026

    @V3RON
    ContributorAuthor

    Folding in #429: the human view of daemon status (formatStatus, printed at src/cli/index.ts:1668 when --json is absent) has no test that pins it — deleting it leaves the suite green. The corrected test this issue calls for (assert the real first line, Daemon: running (worker), instead of the it.fails on "Daemon running") also catches that deletion, so the fix here should be written to fail when the human view is removed.

    Written by an agent.

  4. added a commit that references this issue on Oct 16, 2026
  5. V3RON commented on Oct 16, 2026

    @V3RON
    ContributorAuthor

    Confirmed — a Gap: the code prints the human view correctly; the test and its comment are wrong, and nothing pins the human view of daemon status. Reproduction on bug/422-repro (fa168178); the proposed fix is written there.

    Reproduction

    bug/422-repro from current origin/main, two test files:

    1. src/expected-failures.test.ts (unit) — "the tracked test files hold no test written to pass by failing". Fails on main naming the offender:
      e2e/daemon-lifecycle.test.ts:58: it.fails("daemon status prints a human-oriented view by default"…). Green on the branch.
    2. e2e/daemon-lifecycle.test.ts (fast lane) — the it.fails becomes a normal test asserting the real first line: expect(statusHuman.stdout.split("\n")[0]).toBe("Daemon: running (worker)"). Passes on main's code.

    Command: pnpm test:e2e e2e/daemon-lifecycle.test.ts / pnpm exec vitest run --project unit src/expected-failures.test.ts

    With the human view removed from the daemon status branch (src/cli/index.ts:1296 → writeResult only): the old it.fails stays green (3 passed | 1 expected fail); the corrected test fails on a named assertion (expected '{"devices":…' to be 'Daemon: running (worker)').

    Root cause

    e2e/daemon-lifecycle.test.ts:52-58: the comment's premise is false — runDaemon's status branch prints formatStatus(...) when --json is absent (src/cli/index.ts:1296), so the body's "Daemon running" can never appear and the it.fails passes whether or not the human view exists. No cheaper test reaches this either: on the same mutation src/cli/index.test.ts stays green (273 passed) — its ["daemon", "status"] test (line 1325) never asserts stdout, and the Daemon: … pins run status, not daemon status.

    Simplest fix

    Apply what the repro branch shows: drop the comment, make the test a normal it asserting the exact first line. One mutation note: also extend src/cli/index.test.ts:1325 (the connectExistingAdmin fake is already wired there) to assert stdout opens with Daemon: running (worker) — that kills the same mutation at unit cost (rule 7); the e2e test then pins the wire together with real processes.

    Alternatives rejected

    Risk

    • The e2e assertion pins the first line only; a Console line may follow when the console is enabled — check a change there does not silently widen the assertion.
    • The meta-test scans git ls-files: confirm it sees src/, e2e/ and ui/ (its own first test pins this).
    • it.fails elsewhere (none today) will now fail CI — intended.

    Handoff

    Done: claim, reproduction on bug/422-repro (rebased from current main over the 2026-10-08 attempt), mutation evidence both ways, this report.
    Not done: the fix (report only, per this skill).
    Findings: the unit layer cannot see daemon status's human view at all (above); #429's fold-in verified.
    Blocked on: the maintainer's bug:ready.

    Written by an agent.

  6. removed their assignment
    on Oct 16, 2026
  7. added
    bug:readyAn agent may fix it.
    and removed
    bug:triageAn agent may reproduce it and write the triage report.
    on Oct 16, 2026
  8. self-assigned this
    on Oct 16, 2026
  9. added 3 commits that reference this issue on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:readyAn agent may fix it.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions