Commit ecceb38
fix(wardens): distinguish OPA ledger staleness from a real review gap (LIA-535) (#1161)
## Summary
- `guardrails.rego`'s file-level `default decision` message ("guardrails
policy produced no valid decision") fired identically for a genuine
missing-review-attestation denial and for a transient OPA ledger
generation mismatch (disk/OPA desync, self-heals within 5 min via
LIA-533's periodic job) — no hint to a developer that the cause might be
infra staleness, not "you need a SHIP."
- New `decision` rule fires a distinct, actionable message specifically
for the generation-mismatch case, scoped to `git.commit`/`file.write`
(the two operations whose decision bodies all require `supported`).
`attestation.verify` is explicitly excluded — it already has its own
composite deny message, and including it would create a real Rego
`eval_conflict_error` (verified by mutation testing).
- Folds in a one-line fix to an adjacent, already-stale ticket citation
(was `LIA-534`, corrected to `LIA-539` — `LIA-534`/`LIA-531` are both
Done/merged; `LIA-539` is the actual open ticket gating
`main-attestation-backstop`'s activation, independently re-verified
against live Linear state rather than the ADR, which itself still lags
on this point).
## Test plan
- [x] `opa test -v --ignore="*.schema.json"
scripts/warden_policy/policy` → 68/68 pass (65 existing + 3 new)
- [x] `opa check --strict scripts/warden_policy/policy` → clean
- [x] `python3 -m pytest scripts/warden_policy/tests` → 303 passed, 1
skipped, 65 subtests, zero regressions
- [x] Mutation-tested the exclusion guard: dropping it entirely
reproduces a real `eval_conflict_error`; the new test catches it
- [x] plan-reviewer: 3 rounds (round 1 REVISE — guard was too broad, `!=
"attestation.verify"` would misclassify unrecognized operations as
staleness, caught via a live failing-test reproduction; round 2 REVISE —
wrong ticket citation; round 3 SHIP after independent live-Linear +
doc-timestamp re-verification), Claude + GPT co-gate
- [x] code-reviewer SHIP (Claude + GPT; GLM `COULD_NOT_RUN` on quota
exhaustion, fails open per established precedent)
- [x] ai-eng-warden SHIP (gate-spec file; confirmed reason-string-only
change, no allow/deny regression, no attacker-controllable input,
accurate remediation hint)
- [x] verification-gate: 4 rounds — caught 2 real comment-accuracy
defects (a misleading counterfactual claim in a test comment, a
stale-doc pointer that would lead a reader back into the exact misread
`LIA-539` was filed to prevent, plus one wrong-direction
cross-reference), all fixed and re-verified; final SHIP
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>1 parent ccc5ff5 commit ecceb38
2 files changed
Lines changed: 69 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
24 | 51 | | |
25 | 52 | | |
26 | 53 | | |
| |||
234 | 261 | | |
235 | 262 | | |
236 | 263 | | |
237 | | - | |
238 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
239 | 269 | | |
240 | 270 | | |
241 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
170 | 188 | | |
171 | 189 | | |
172 | 190 | | |
| |||
614 | 632 | | |
615 | 633 | | |
616 | 634 | | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
617 | 652 | | |
618 | 653 | | |
619 | 654 | | |
| |||
0 commit comments