Skip to content

tdd-pretool-check.sh missing claude-sdlc-wizard#436's fix (ported hook drifted stale) #30

Description

@BaseInfinity

Concrete finding, not just a generic audit request

hooks/tdd-pretool-check.sh here shares filenames and structure with claude-sdlc-wizard's
hooks (_find-sdlc-root.sh, precompact-seam-check.sh, instructions-loaded-check.sh,
model-effort-check.sh, sdlc-prompt-check.sh) -- this looks like a port from an earlier
point in that repo's history, not an independent reimplementation. Checked it directly:

if [[ "$FILE_PATH" == *"/src/"* ]]; then

This is the exact bug claude-sdlc-wizard#436 found and fixed: */src/* requires a slash
before src, so a cwd-relative path like src/app.js (common output shape, no leading
slash) never matches -- the TDD nudge silently never fires for it. The current
claude-sdlc-wizard/hooks/tdd-pretool-check.sh fix is one line:

[[ "$FILE_PATH" == *"/src/"* || "$FILE_PATH" == "src/"* ]] && SRC_MATCH=1

It also picked up a second improvement this repo's copy doesn't have: priority detection for a
test file touched earlier in the session, so the gate unlocks once TDD RED has actually
happened, instead of nagging on every subsequent src/ edit regardless of test state.

Why this is worth fixing by diff, not by independent audit

This is the strongest evidence yet (from a parallel cross-model review asking whether Codex/
OpenCode siblings need independent Fable-led audits) for the cheaper answer: when a hook is
a direct port, diff it against the upstream fix rather than re-auditing from scratch.
The bug
was already found, root-caused, and fixed once -- porting the fix is strictly cheaper than
rediscovering it.

Proposal

  1. Diff hooks/tdd-pretool-check.sh here against the current
    claude-sdlc-wizard/hooks/tdd-pretool-check.sh and pull forward both fixes above.
  2. Same check for the other 5 ported hooks (precompact-seam-check.sh,
    instructions-loaded-check.sh, model-effort-check.sh, sdlc-prompt-check.sh,
    _find-sdlc-root.sh) -- if one hook drifted from a stale snapshot, the others plausibly did
    too.
  3. After that diff pass, a host-native black-box smoke test per hook is still worth adding
    (drive the actual PreToolUse event through OpenCode's own hook loader, not just a direct
    script invocation) -- this repo already has 10 test scripts and CI, so it's the
    best-positioned sibling to do this properly, and the only one where a further scoped Fable
    pass (limited to hooks/) is worth spending on, once the smoke tests exist to tell it where
    to look.

Submitted as part of a cross-repo self-enforcement review pass
(see claude-sdlc-wizard#236 -> PR #440, and codex-sdlc-wizard#58).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions