Originally created by: lodar
Builds the capture path behind proof scorecard's policy-blocked action attempts, which shipped in 0.15.0 as an explicit NO DATA marker because nothing recorded it. We recorded gates that were asked and answered; we never recorded an attempt a policy refused before it got that far.
policy-blocked action attempts 2 (across 7 instrumented policy sites)
A bare 0 would read as "we never get blocked" — the same failure the NO DATA marker existed to prevent — and an uninstrumented refusal site is invisible to the count, so the reader is told the denominator. The site total is derived from the shipped bundle, never hand-maintained: a hand-kept constant drifts and then lies about the one thing keeping a 0 honest.
policy_refuse is deliberately not used for validation errors. A bad flag is the caller getting the invocation wrong, not policy blocking an action; counting those inflates the number into meaninglessness. An under-counted metric that reports its coverage is honest; an inflated one is not.
supervisor_events existence guard, so it only ran on stores that lacked supervisor_events. The table would never have been created and the metric would have read NO DATA forever — indistinguishable from "no refusals recorded yet". Guard on the table you are creating.E_USAGE→E_CONFLICT ×2, E_AUTH_REQUIRED→E_CONFLICT). Telemetry must be behaviour-preserving. The code is now a parameter, and a test compares every site against origin/main. No existing test caught this — task_park_gate_guard_unit.sh fails for an unrelated environmental reason on this host and never reached the assertion. "The suite is as green as main" is not "my change is covered".set -euo pipefail, a grep matching nothing exits 1, pipefail propagates, set -e ends the verb with no output and rc=1. It greps the resolved 5dive on PATH, so it fired on any box whose installed bundle predates this change — the scorecard would have died silently everywhere until the new version rolled.Also: the two no-data reasons are distinguished ("no table in this store" vs "this build has no instrumented sites") — different causes, different fixes, and a marker whose stated reason is wrong is its own small lie.
tests/policy_refusals_unit.sh 16/16 (new), plus negative controls run for each guard, since a guard is not proven until it has failed for the right reason:
policy_refuse return instead of refusing → refusal assertions failEnd-to-end on an isolated copy of a store that already has supervisor_events: migration creates the table, a real park-over-open-gate refusal is both blocked (exit 2, E_USAGE preserved) and recorded, and the metric renders 2 (across 7 instrumented policy sites). schema_sync_unit 9/9. Suite failures are byte-identical to pristine origin/main.
DIVE-1923 (autonomous rollback rate) is still NO DATA — separate ticket, not in this PR.
🤖 Generated with Claude Code
Ticket changed by: lodar