Objective: Implement a global "Forensic Journal." Instead of simple logs, every mutation (Create/Update/Delete) across the entire system must be captured as a polymorphic audit record with oldValue vs newValue diffing, enabling a "Time Travel" feature for any entity.
Files involved (12):
models/AuditLog.js
(New: High-volume polymorphic storage)
services/auditProcessor.js (New: Background worker to process diffs)
utils/diffEngine.js (New: Logic to compare JSON objects)
middleware/auditInterceptor.js (New: Global request/response context capture)
plugins/mongooseAuditV2.js (New: Mongoose plugin for auto-auditing)
routes/audit.js
(New: Forensic explorer API)
models/Transaction.js
(Update: Registering audit plugin)
models/Taxonomy.js
(Update: Registering audit plugin)
models/Workspace.js
(Update: Registering audit plugin)
services/securityService.js
(Update: Logic for "Suspicious Pattern" detection in logs)
tests/auditTraceability.test.js (New: "Time Travel" verification tests)
AUDIT_FORENSICS_SPEC.md (Technical spec)
Objective: Implement a global "Forensic Journal." Instead of simple logs, every mutation (Create/Update/Delete) across the entire system must be captured as a polymorphic audit record with oldValue vs newValue diffing, enabling a "Time Travel" feature for any entity.
Files involved (12):
models/AuditLog.js
(New: High-volume polymorphic storage)
services/auditProcessor.js (New: Background worker to process diffs)
utils/diffEngine.js (New: Logic to compare JSON objects)
middleware/auditInterceptor.js (New: Global request/response context capture)
plugins/mongooseAuditV2.js (New: Mongoose plugin for auto-auditing)
routes/audit.js
(New: Forensic explorer API)
models/Transaction.js
(Update: Registering audit plugin)
models/Taxonomy.js
(Update: Registering audit plugin)
models/Workspace.js
(Update: Registering audit plugin)
services/securityService.js
(Update: Logic for "Suspicious Pattern" detection in logs)
tests/auditTraceability.test.js (New: "Time Travel" verification tests)
AUDIT_FORENSICS_SPEC.md (Technical spec)