Skip to content

test(hooks): the hook-corpus replay cannot reproduce background-task, orchestrator-env or state-dependent blocks — 29 of 42 logged blocks have no corpus coverage #1129

Open

Description

@admarble

Symptom

scripts/hook-corpus.ts's replay harness (#1094) cannot reproduce three classes of block the hook really issues, so the corpus pins none of them:

The qa pass on PR #1128 measured it: of 42 eligible logged blocks, 13 reproduce; the harvester now keeps only reproduced blocks (so the corpus is honest) and the exec skill's --diff step covers 9 of the hook's 17 block reasons.

Fix shape

  • Add runInBackground?: boolean and env?: Record<string,string> to CorpusCase; set them in both replayCase and replayCaseAsync; harvest logged background-task blocks with runInBackground: true and the orchestrator env.
  • Harvest state-dependent blocks under the state that reproduces them (dirty, a staged secret fixture, a sensitive path in the index), recording the state on the case.
  • Re-point the fragment gate test's fixtures at verbatim hook-log lines.

Acceptance criteria

  • AC-1: the corpus pins at least one block for each of background-task, staged-secret and sensitive-file — Verify: jq -r 'select(.exit!=0) | .block' __tests__/fixtures/hook-corpus.jsonl | sort -u lists all three.
  • AC-2: gate test — a replay with runInBackground: true under the orchestrator env is blocked by all three hook copies — Verify: npx vitest run __tests__/hook-corpus.integration.test.ts -t "background" → green. Mutation-verified per CLAUDE.md §Testing: drop run_in_background from the payload → the case fails; restore.
  • AC-3: npx tsx scripts/hook-corpus.ts --harvest --hook-log ~/.sequant/logs/claude-hook.log on the maintainer host adds at least 20 reproduced blocks beyond the 13 in test(#1094): golden-corpus verdict snapshot for pre-tool.sh #1128 — Verify: the harvest summary line.
  • AC-4: npm run build && npm test green.

Activity

  1. added
    enhancement
    on Sep 20, 2026
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions