Skip to content

Implementation Plan: T5-P1-A1-WP2 Hook Deny Efficacy Probe Harness#4131

Merged
Trecek merged 6 commits into
developfrom
t5-p1-a1-wp2-produce-a-deterministic-merge-blocking-probe-ha/3998
Jun 27, 2026
Merged

Implementation Plan: T5-P1-A1-WP2 Hook Deny Efficacy Probe Harness#4131
Trecek merged 6 commits into
developfrom
t5-p1-a1-wp2-produce-a-deterministic-merge-blocking-probe-ha/3998

Conversation

@Trecek

@Trecek Trecek commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Create a deterministic, merge-blocking probe harness that exercises every PreToolUse deny-mechanism guard script across the full (tool_class × session_mode × backend) matrix. Three new files in tests/execution/backends/:

  1. conftest.py — xdist-safe probe row accumulation via workeroutput IPC, matrix JSON serialization to .autoskillit/temp/hook_deny_strength_matrix.json, shared constants, and both EXPECTED_TOTAL_PROBE_COUNT and EXPECTED_NON_INERT_COMBINATIONS derived from HOOK_REGISTRY.
  2. test_hook_deny_efficacy_probe.py — parametrized TestHookDenyEfficacyProbe class exercising each deny-mechanism guard script as a subprocess, plus a collection-count meta-test and a scope-boundary module docstring.
  3. test_hook_strength_matrix.py — three meta-tests validating the serialized strength matrix: combination count, works-as-is strength floor, and not-applicable inert invariant.

Closes #3998

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/impl-20260627-131941-432993/.autoskillit/temp/make-plan/T5-P1-A1-WP2_hook_deny_efficacy_probe_plan_2026-06-27_132500.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step Model count uncached output cache_read peak_ctx turns cache_write time
plan* opus[1m] 2 2.6k 59.9k 1.6M 157.4k 56 188.0k 29m 54s
verify* sonnet 1 5.3k 10.1k 540.3k 74.2k 27 55.7k 7m 12s
implement* MiniMax-M3 1 89.7k 19.1k 2.9M 0 97 0 8m 33s
audit_impl* sonnet 1 60 17.4k 302.1k 68.2k 19 50.7k 7m 54s
prepare_pr* MiniMax-M3 1 47.0k 2.5k 154.2k 0 12 0 1m 0s
compose_pr* MiniMax-M3 1 35.8k 1.6k 141.4k 0 12 0 25s
review_pr* sonnet 1 148 62.5k 1.2M 117.5k 45 99.8k 14m 24s
resolve_review* sonnet 1 231 15.7k 2.0M 90.3k 69 72.7k 10m 58s
Total 180.9k 188.9k 8.7M 157.4k 466.9k 1h 20m

* Step used a non-Anthropic provider; caching behavior may differ.

Token Efficiency

Step LoC Changed cache_read/LoC cache_write/LoC output/LoC
plan 0
verify 0
implement 526 5504.0 0.0 36.3
audit_impl 0
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 9 218722.4 8079.0 1749.4
Total 535 16323.5 872.7 353.0

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
opus[1m] 1 2.6k 59.9k 1.6M 188.0k 29m 54s
sonnet 4 5.7k 105.8k 4.0M 278.9k 40m 29s
MiniMax-M3 3 172.5k 23.2k 3.2M 0 9m 59s

Trecek and others added 6 commits June 27, 2026 14:46
…d xdist-safe matrix serialization

Adds the subdirectory conftest for the deny-mechanism probe harness:
- TOOL_CLASSES (16 entries), SESSION_MODES, BACKENDS shared constants
- EXPECTED_TOTAL_PROBE_COUNT and EXPECTED_NON_INERT_COMBINATIONS derived
  from HOOK_REGISTRY at import time
- record_probe_row() worker-side accumulator
- workeroutput IPC under key 'hook_probe_rows' (distinct from root conftest's
  filter-stats keys)
- Controller-side pytest_testnodedown and pytest_sessionfinish serialize
  the matrix to .autoskillit/temp/hook_deny_strength_matrix.json

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… harness

Adds TestHookDenyEfficacyProbe with parametrization over the full
(tool_class x session_mode x backend) matrix for every PreToolUse+deny
hook script in HOOK_REGISTRY. Each probe:
- Skips inert codex rows after verifying the script is excluded from
  generate_codex_hooks_config() output
- Invokes the guard as a subprocess via sys.executable with a clean env
- Classifies the outcome (deny -> hard, else -> soft)
- Records to the probe matrix via record_probe_row

Includes TOOL_CLASS_PAYLOADS (matching TOOL_CLASSES.keys() exactly),
SESSION_MODE_ENV / BACKEND_ENV env override dicts, helper functions
(_clean_env, _invoke_guard, _build_payload, _collect_probe_params), and
the standalone test_probe_collection_count meta-test that guards against
silent drift between the registry and the expected matrix size.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds three meta-tests that validate the serialized
hook_deny_strength_matrix.json produced by the probe harness:
- test_matrix_combination_count: row count must equal
  EXPECTED_NON_INERT_COMBINATIONS (inert probes are not recorded)
- test_works_as_is_hooks_have_soft_or_better: each works-as-is hook
  must have at least one soft/hard row in the matrix
- test_not_applicable_hooks_appear_only_as_inert: not-applicable hooks
  must be absent from the matrix entirely (since their probes are inert)

All three tests skip gracefully when the matrix JSON is absent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Shorten the long pip/pytest/gh command string in TOOL_CLASS_PAYLOADS
(Bash + mcp_run_cmd entries) and trim the inline comment in test_probe
to fit within the 99-char ruff line limit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tput

A guard returning an empty dict (no stdout) was classified as 'soft',
causing test_works_as_is_hooks_have_soft_or_better to pass even for
a completely non-functional guard. Introduce 'none' strength when
result is empty so the meta-test correctly detects inactive guards.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
works_as_is_stems used hd.scripts[0] only, missing non-first scripts of
multi-script works-as-is hooks (e.g. mcp_run_skill has 5 scripts,
dispatch_food_truck has 4). Probe rows for those scripts were recorded
in the matrix but excluded from the coverage check, allowing gaps to
pass silently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Trecek Trecek force-pushed the t5-p1-a1-wp2-produce-a-deterministic-merge-blocking-probe-ha/3998 branch from 69ae060 to 0ae81b6 Compare June 27, 2026 21:46
@Trecek Trecek added this pull request to the merge queue Jun 27, 2026
Merged via the queue into develop with commit 59c215c Jun 27, 2026
3 checks passed
@Trecek Trecek deleted the t5-p1-a1-wp2-produce-a-deterministic-merge-blocking-probe-ha/3998 branch June 27, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant