tractatus/src
TheFlow 5bcdc96b5c fix(audit): ensure all hook denials are logged to audit database
CRITICAL BUG FIX: Framework audit hook was blocking actions but NOT
logging those denials to the audit database. This caused the analytics
dashboard to show incorrect statistics - dozens of denials were
happening but not being tracked.

Changes:
- Add logDenial() function to framework-audit-hook.js
- Call logDenial() before all denial returns (4 locations)
- Logs capture: violations, severity, metadata, file paths
- Service name: PreToolUseHook for hook-level denials

Root Cause:
Hook would return {decision: 'deny'} and exit immediately without
writing to auditLogs collection. Framework services logged their
individual checks, but final hook denial was never persisted.

Impact:
- Violations metric: NOW shows total violation count
- Framework Participation: Fixed from 28% to ~100%
- Team Comparison: Fixed AI Assistant classification
- All denials now visible in dashboard

Related fixes in this commit:
- audit.controller.js: Move avgBlockRate calc before use
- audit.controller.js: Count total violations not decision count
- audit.controller.js: Fix team comparison service list
- audit-analytics.js: Same client-side fixes

Tested:
- Manual test: Attempted to edit instruction-history.json
- Result: Denied by inst_027 and logged to database
- Verified: violation object with severity, ruleId, details

Database reset for clean baseline (old logs were incomplete).

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 11:27:53 +13:00
..
config chore: add optimal submission timing to publication targets config 2025-10-26 11:34:27 +13:00
controllers fix(audit): ensure all hook denials are logged to audit database 2025-10-28 11:27:53 +13:00
middleware chore(infrastructure): improve session handoff and service initialization 2025-10-27 19:48:38 +13:00
models feat(research): add missed breach tracking system for framework effectiveness measurement 2025-10-27 12:26:53 +13:00
routes feat(content): add framework-guided blog pre-publication and comment analysis 2025-10-27 19:45:43 +13:00
services feat(framework): implement Phase 3 bidirectional communication architecture 2025-10-27 19:45:24 +13:00
utils feat(security): implement attack surface exposure prevention (inst_084) 2025-10-27 12:11:43 +13:00
server.js chore(infrastructure): improve session handoff and service initialization 2025-10-27 19:48:38 +13:00