tractatus/.claude
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
..
backups fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
hooks fix(audit): ensure all hook denials are logged to audit database 2025-10-28 11:27:53 +13:00
metrics fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
session-archive fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
sessions fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
framework-incidents.json fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
instruction-history.json feat(cultural-dna): complete Phase 1 - Framework Rules Encoding (inst_085-089) 2025-10-28 08:40:33 +13:00
instruction-history.json.backup fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
instruction-history.json.backup-3.5-1761042346894 fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
instruction-history.json.backup-20251012-143441 fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
instruction-history.json.backup-pre-inst-073-1761077855528 fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
instruction-history.json.backup-pre-security-rules-1761044345329 fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
plan-registry.json fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
session-state.json chore: cleanup - add session docs, remove screenshots, update session state 2025-10-28 09:48:45 +13:00
settings.json feat(governance): wave 4 enforcement - 41% improvement (56% → 79%) 2025-10-25 13:48:43 +13:00
token-checkpoints.json chore: cleanup - add session docs, remove screenshots, update session state 2025-10-28 09:48:45 +13:00
tractatus-config.json fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
user-suggestions.json fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00