Delivers the append-only audit trail system for all compliance-critical
actions per the TRA-246 acceptance criteria.
- tracking/models.py: AuditEvent model with ORM-level immutability guard
(save raises on update, delete raises on direct call)
- tracking/audit.py: single record() call point; never raises in production
- tracking/admin.py: read-only Django admin for AuditEvent inspection
- tracking/migrations/0001_initial.py: DB schema with composite indexes
- tracking/serializers.py: PII metadata gating (oidc_sub stripped for
non-admin callers)
- tracking/views.py: read-only AuditEventViewSet (IsPrivileged + 60/min
throttle)
- tracking/urls.py: registers audit/events/ router
- tracking/management/commands/prune_audit_log.py: retention enforcement
command with --dry-run and --class filter; writes access.admin_action
event on real prune runs
- config/settings/base.py: AUDIT_RETENTION_DAYS per event class + audit
throttle rate
- api/exceptions.py: wires access.permission_denied audit event on every
PermissionDenied exception (M1 integration point)
- tests/test_audit.py: 26-event taxonomy coverage, immutability, retention,
API permission, PII gating, and service helper unit tests
Co-Authored-By: Paperclip <noreply@paperclip.ing>
- Add section 7: DRF global settings (REST_FRAMEWORK dict, required
packages, custom exception handler, drf-spectacular config, URL
routing skeleton) to satisfy the DoD requirement for concrete
implementation conventions
- Add section 9: handoff checklist for domain tracks (TRA-254/255/256),
frontend track (TRA-257), and QA/CI track (TRA-258) with per-gate
merge criteria and oasdiff command
- Fix section numbering: old section 7 OpenAPI subsections were
labelled 6.x; renumbered to 8.x; old sections 8 and 9 become 10 and 11
Co-Authored-By: Paperclip <noreply@paperclip.ing>