Files
devplacepy/.claude/commands/audit-event.md
T
retoorandClaude Opus 5 91fac7fd67 Gate blocked actions behind an in-place terms acceptance dialog
A member whose account has not accepted the terms in force now gets one
dialog on the action they attempted instead of a dead-end refusal. The
client handler is the single TermsGate, wired into every Http POST helper
so the four optimistic controllers cannot swallow the gate into an error
flash, and the original request is replayed once the acceptance is
recorded. Reading the site and deleting an account stay unblocked.

apple.md is the source brief the compliance research documents reference.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 11:25:57 +02:00

16 lines
1.6 KiB
Markdown

---
description: Add an audit-log event end to end - the events.md catalogue key, the category_for mapping, and the recorder call at the mutation point.
argument-hint: <event.key for which mutation>
allowed-tools: Read, Grep, Edit, Bash(python *)
---
Add the audit event for: **$ARGUMENTS**
Follow the audit-log design (`devplacepy/services/audit/`); confirm against the source first.
1. Pick or extend the event key in `events.md` (the authoritative catalogue at the repo root) in the correct domain.
2. If it is a NEW domain, extend `category_for` in `devplacepy/services/audit/categories.py`.
3. Call the recorder on the mutation's success path: `audit.record(request, event_key, ...)` in HTTP or WebSocket handlers, or `audit.record_system(event_key, ...)` in request-less contexts (services, jobs, CLI). On a guard or denial branch pass `result="denied"`; on a failure branch pass `result="failure"`.
4. Route through the existing DRY choke point when one applies (`content.py`, the `project_files.py` helpers, `routers/containers.py` `_audit_instance`, the Devii dispatcher `_audit_mechanic`) instead of scattering call sites. The HTTP path and the Devii path for one mutation must stay disjoint (no double counting).
5. Recording is best-effort: wrap nothing the caller depends on, and NEVER gate the audited action on the record succeeding.
6. Validate the touched files with the per-language checks (`python -m py_compile` + `pyflakes` for Python, `node --check` for JS, brace balance for CSS, tag and `{% %}` balance for templates) and `python -c "from devplacepy.main import app"`.