Skip to content

wr-tdd: hook per-session IDLE state blocks multi-session RED->GREEN impl edits (on-disk RED not recognised across sessions) #399

Description

@tompahoward

Description

The @windyroad/tdd PreToolUse Edit hook tracks RED/GREEN/IDLE state via per-session file-write events. When a RED-phase test commit lands in one session and the corresponding GREEN-phase impl edit happens in a SUBSEQUENT session, the new session starts in IDLE — no file-write event for the paired test occurred this session — so the hook blocks the impl edit (Cannot edit '<impl>' -- no tests written for this file yet. TDD state is IDLE) even though the paired test exists on disk AND npx vitest run confirms it is RED. Distinct from the stem-match strictness issue (P020, same package): P020 is path-pairing; this is per-session lifecycle handling.

Symptoms

  • Iter N lands the failing test in a prior subprocess session; iter N+1 (new session) attempts the impl edit and is blocked with TDD state IDLE.
  • npx vitest run <test> confirms the test is RED (correctly TDD-incomplete); only the hook's per-session state machine fails to recognise the prior-session RED.

Workaround

touch + trivial Edit on the paired test file in the current session → fires a fresh PostToolUse event → state advances to RED → impl edit unblocked. Cost: one extra Edit call per multi-session GREEN phase.

Affected plugin / component

@windyroad/tdd — PreToolUse Edit hook per-session RED/GREEN/IDLE state machine.

Frequency

Any TDD workflow where RED and GREEN phases land in separate sessions (overnight pause, AFK iter-boundary, the explicit RED->GREEN split AFK orchestration uses).

Versions

  • Local plugin: @windyroad/tdd (not detected — marketplace install)
  • Upstream package: @windyroad/tdd (not detected)
  • Claude Code CLI: 2.1.219
  • Node: v24.16.0
  • OS: Darwin 25.3.0 arm64

Evidence

Possible fixes: (A) hook seeds RED/GREEN by running the paired test once at session start; (B) treat "test file exists and runs red" as a sufficient IDLE->RED signal regardless of session boundary (on-disk RED is source of truth); (C) document the touch-the-test-file workaround as the canonical multi-session pattern.

Cross-reference

Reported from https://github.com/voder-ai/dry-aged-deps — tracked locally as problem ticket P026 in docs/problems/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions