Repository navigation
feat(usage): log blocked hook-bypass attempts - #384
Merged
Merged
Conversation
Owner
Author
ReviewVERDICT: APPROVE Reviewed head The PR meets every acceptance point in #361 and follows the approved plan. The hook still exits 2 and stays blocking when logging is off or fails. A blocked attempt appends one Blocking findings: none. Non-blocking:
Targeted tests: 192/192 passed. Size: 7 files, +156/−21. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why does this feature exist?
Blocked
--no-verify,HUSKY=0, and other hook-bypass attempts were already rejected, but those blocked attempts were not written to the factory usage log alongside the per-rule lint counts from ADR 0100. This PR records each blocked attempt as one JSON Lines event so the monitoring epic can see when someone tries to skip the gates.Closes #361.
What changed?
The existing
block-gate-bypasshook still exits 2 and stops the commit. On a blocked attempt it now callsscripts/lint-usage.mjs --blocked-bypassto append one record (timestamp, branch, agent and model when known, and the attempted command) to.cache/factory-usage/lint-runs.jsonl. Logging stays best-effort: a missing or failing logger does not weaken the block. ADR 0100, QUALITY_GATES.md and tasks.md note the new event. No guarded paths changed; enforcement sign-off is not required.7 files, +156/−21, 177 hand-written changed lines.
Behavioural Proof (with video and screenshots)
Not applicable: hook and usage-log change with no rendered UI surface.
scripts/block-gate-bypass.test.tsandscripts/lint-usage.test.ts(red then green). A manual blocked attempt returned exit 2 and wrote exactly one log record; a normal commit is not recorded as a bypass.Verification Summary
pnpm exec jest --selectProjects tooling scripts/lint-usage.test.ts scripts/block-gate-bypass.test.ts,node scripts/enforcement-approval.mjs --git ben/main HEAD,pnpm verify,pnpm e2e.{"head":"d1f032b44ea96af77e411b226852427ba4b1938d","problems":[]}. Codexpnpm verifypassed 3,221 tests (one benchmark timed out, then all three benchmark tests passed on recheck); contract, integration, coverage, build and size passed. Pre-push against Benorigin/mainre-ranpnpm verifyandpnpm e2e; Playwright last-run status waspassedwithfailedTests: []at 17:24:19 GMT..agents/project/PR_QUALITY.md) satisfied, or each gap named: local verify and e2e passed; no user-visible behaviour change; logic covered by unit and behaviour tests; no interactive UI, so accessibility does not apply; ADR 0100 updated; hooks were not bypassed.pnpm verifypnpm e2e.agents/project/ARCHITECTURE.mdandCONVENTIONS.md; new decisions recorded as ADRs.PRD Behaviours to Review
PR Proof Law
.agents/project/PR_QUALITY.mdand.agents/skills/pr-quality-contract/SKILL.md; thePR qualitycheck verifies the proof format.