Skip to content

testing hooks: evaluate PostToolUse bashEditDiff to cover test files written through Bash #5608

Description

@kyle-sexton

Problem

The testing plugin's opt-in test-scan and test-weaken hooks see test files written through the Write and Edit tools only. A test file an agent writes or edits through Bash (cat > foo.test.ts, sed -i, a generator script) is never scanned. The Release 2 judge plan and the Release 2b mutation-scope plan (#5603) both deferred closing this gap, so it has no owner.

Candidate mechanism

PostToolUse bashEditDiff (beta since Claude Code 2.1.269) lists the Git-tracked files a Bash call changed. Per code.claude.com/docs/en/hooks (fetched 2026-09-30) it is best effort and in public beta; it is recorded in every permission mode only when bashEditDiffEnabled is set, otherwise only in auto and bypassPermissions modes.

Scope

  1. Probe bashEditDiff on the installed version: which modes populate it, whether new untracked files appear, and its shape on Linux and Windows Git Bash.
  2. If it holds, route Bash-changed test files through the existing test-scan (and later the judge's PostToolUse job) behind the same opt-in, within the test-scan p95 latency budget.
  3. If it does not, record the gap in the testing plugin's docs as a known limit.

Acceptance

  • A probe row records bashEditDiff's behavior on the installed version.
  • Either Bash-written test files are scanned when the hooks are on, or the limit is documented.

Related: #5603 (Release 2b plan, DT10), #5605 (Release 2 judge).

🤖 Generated with Claude Code

Activity

  1. added
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Sep 30, 2026
  2. kyle-sexton commented on Sep 30, 2026

    @kyle-sexton
    ContributorAuthor

    Commit 14457ae on origin/main (PR #5621, merged 2026-09-30) meets both acceptance criteria.

    1. Probe row: docs/specs/tautological-tests/probes.md has the section "bashEditDiff (Claude Code 2.1.285, WSL2, 2026-09-30)". It records the field location (tool_response.bashEditDiff), a table of which modes and settings populate it, whether untracked new files appear (they do), and its shape (changedFiles, files, moreFiles).
    2. Scanning: plugins/testing/hooks/hooks.json has a PostToolUse row with matcher Bash that runs hooks/test-scan-bash.sh (up to 4 changed test files per call, each through test-scan.sh). plugins/testing/README.md documents the precondition (bashEditDiffEnabled) and the cost. A live claude -p run in probes.md shows the hook flagging a zero-assertion test written through a cat heredoc.

    The issue's Scope also asks for a Windows Git Bash probe, but that is not an acceptance criterion. The README records it as a known limit ("Windows Git Bash is not probed"), and running it needs a Windows host (operator-only), so it can be a separate follow-up.

    No open PR addresses #5608 (#5603 only lists it as related) and no duplicate was found. The issue has no comments and only the needs-triage label (no needs-decision or needs-human).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageNot yet classified. Floor until a type and one priority tier are set.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions