tractatus/public/js/admin
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
..
analytics.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
audit-analytics.js fix(audit): ensure all hook denials are logged to audit database 2025-10-28 11:27:53 +13:00
auth-check.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
blog-curation-enhanced.js fix(admin): force fresh API requests to prevent cached 500 errors 2025-10-24 11:02:43 +13:00
blog-curation.js feat(cultural-sensitivity): implement Phase 2 - admin UI with cultural flags (inst_081) 2025-10-25 11:22:42 +13:00
blog-pre-publication.js feat(content): add framework-guided blog pre-publication and comment analysis 2025-10-27 19:45:43 +13:00
blog-validation.js feat(admin): add standalone submission package modal support 2025-10-24 11:06:22 +13:00
calendar.js fix(calendar): Add cache-busting and better error handling 2025-10-24 12:13:21 +13:00
case-moderation.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
claude-md-migrator.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
comment-analysis.js feat(content): add framework-guided blog pre-publication and comment analysis 2025-10-27 19:45:43 +13:00
contact-management.js feat(crm): complete Phase 3 multi-project CRM + critical bug fixes 2025-10-24 18:10:14 +13:00
dashboard.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
editorial-guidelines.js feat(admin): add Editorial Guidelines Manager page 2025-10-24 13:05:47 +13:00
hooks-dashboard.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
login.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
media-triage.js feat(cultural-sensitivity): implement Phase 2 - admin UI with cultural flags (inst_081) 2025-10-25 11:22:42 +13:00
newsletter-management.js fix(newsletter): convert ObjectId to string in DELETE button data attributes 2025-10-24 20:24:54 +13:00
project-editor.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
project-manager.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
project-selector.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
rule-editor.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
rule-manager.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
submission-modal-enhanced.js fix(submissions): extract data from API response wrappers 2025-10-24 16:35:10 +13:00
submission-modal-old.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
unified-inbox.js feat(crm): complete Phase 3 multi-project CRM + critical bug fixes 2025-10-24 18:10:14 +13:00