Add audit logging for comment changes and document access#288
Add audit logging for comment changes and document access#288cass-clearly wants to merge 4 commits into
Conversation
The Minimalist — Round 1 ReviewVerdict: REQUEST_CHANGES Test command passed: Plan review was skipped. I do not recommend a totally different path: a single Required changes:
This should stay small. Do not build a generic audit subsystem, filters, search, or admin API in this PR. |
The Craftsperson — Round 1 ReviewVerdict: REQUEST_CHANGES Test command passed: I do not recommend a totally different path. An Required changes:
Do not merge until the tests fail for missing audit behavior and pass because the behavior is actually implemented. |
The Architect — Round 1 ReviewVerdict: REQUEST_CHANGES Test command passed: I do not recommend a totally different path for the core implementation. A single Required changes:
This is close, but not done. The current branch adds a security-flavored feature while leaving the actual audit guarantees untested and non-atomic. |
The Marketing Guru — Round 1 ReviewVerdict: REQUEST_CHANGES Test command passed: I do not recommend a totally different implementation path. I do recommend fixing the public contract before this ships. Right now the docs promise more than the product exposes clearly. Required fixes:
|
The Steward — Round 1 ReviewVerdict: REQUEST_CHANGES Test command passed: Plan review was skipped. I do not recommend a totally different path if audit retrieval is actually required: a DB-backed Required changes:
|
The Minimalist — Round 2 ReviewVerdict: REQUEST_CHANGES Test command passed: I reviewed the current PR diff and changed files. I still do not recommend a totally different path: one Round 1's main simplification is only half done. The public
Keep this PR to the actual requirement: write durable audit rows, retain them, and document DB verification. Do not re-add the endpoint unless product accepts a separate retrieval requirement. |
The Steward — Round 2 ReviewVerdict: REQUEST_CHANGES Test command passed: I still do not recommend a totally different path. A single Required changes:
These are material Steward blockers: API stability, debuggability, and failure-mode consistency. After these are fixed, the implementation can stay on this path. |
The Craftsperson — Round 2 ReviewVerdict: REQUEST_CHANGES Test command passed: I still do not recommend a totally different path. Removing the read API and collapsing to Required changes:
Also note outside my main lane: |
The Architect — Round 2 ReviewVerdict: REQUEST_CHANGES Test command passed: I reviewed the current PR diff and changed files. A totally different path is still not warranted: one Required changes:
Non-blocking: This is close. Fix the contradiction between the audit guarantee and the mutation/delete failure modes, clean up the false endpoint docs, then ship. |
The Marketing Guru — Round 2 ReviewVerdict: REQUEST_CHANGES Test command passed: I reviewed the current PR diff and changed files. I do not recommend a totally different path: durable audit rows plus operator docs is the right shipping shape. But the public contract is still false in places, so this cannot ship. Required changes:
The changelog entry is fixed. The remaining blockers are accuracy and onboarding friction: the right thing must be the easy thing, and docs must not describe nonexistent product surface. |
The Minimalist — Round 3 ReviewVerdict: REQUEST_CHANGES Test command passed: I reviewed the current PR diff, changed files, and PR body. I still do not recommend a totally different path: one The code/docs cleanup from Round 2 is done: no One Round 2 blocker is still unfixed: the PR description still says this adds an audit-events listing endpoint and tells reviewers to verify This is a material blocker because the PR body is public release context and currently promises deleted scope. Do not re-add the endpoint; just delete the stale promise. |
The Craftsperson — Round 3 ReviewVerdict: REQUEST_CHANGES Test command passed: I still do not recommend a totally different path. A single Required changes:
These are the remaining Round 2 Craftsperson blockers: tests as executable design, and the required refactor step before shipping. |
The Steward — Round 3 ReviewVerdict: REQUEST_CHANGES Test command passed: \Unknown command: "test" Did you mean this? I reviewed the current PR diff and changed files. A totally different path is not warranted: one DB-backed audit_events table with route-level writes is still the right-sized approach. The Round 3 branch fixed the removed endpoint in README/code and made direct comment mutations transactional, but two production/API-contract blockers remain. Required changes:
These are material Steward issues: partial success in a security control and a public contract that still advertises a nonexistent endpoint. |
The Marketing Guru — Round 3 ReviewVerdict: REQUEST_CHANGES Test command passed: I reviewed the current PR diff, changed files, docs, changelog, and PR body. I still do not recommend a totally different path: durable DB audit rows plus operator docs is the right shipping shape for #279. The README/changelog cleanup is mostly fixed: no public README API section now promises Required changes:
These are public-contract/onboarding blockers. Developers and agents should not have to reverse-engineer that the documented endpoint is gone or adapt an internal placeholder URL before they can verify the feature. |
The Architect — Round 3 ReviewVerdict: REQUEST_CHANGES Test command passed: I reviewed the current PR diff, changed files, prior council feedback, and PR body. A totally different path is still not warranted: one Most Round 2 blockers are fixed: the public read endpoint and unused formatter are gone, direct comment create/update/delete writes are transactional, reply deletes are audited, and document access coverage is broader. Two material blockers remain:
I am not blocking on the Craftsperson's helper-refactor request. At this size, repeated call sites are tolerable and extracting helpers can be a follow-up. The remaining blockers are correctness/public-contract issues, not polish. |
The Minimalist — Round 4 ReviewVerdict: APPROVE Test command passed: I reviewed the current PR diff, changed files, prior Council feedback, and PR body. A totally different path is not warranted. The smallest acceptable shape is still one Round 3's blocker is fixed: the PR body no longer promises There is still some repetition in route-level audit calls, but extracting helpers here would be abstraction for future churn, not a present need. Ship the direct version. |
The Craftsperson — Round 4 ReviewVerdict: REQUEST_CHANGES Test command passed: I reviewed the current PR diff, changed files, and prior council feedback. A totally different path is still not warranted: a single The Round 3 Steward/Architect blockers are fixed: document deletion now audits from The Craftsperson blockers from Round 3 remain materially unresolved:
These are tests-as-design and red-green-refactor issues, not scope requests. The behavior is close; make the audit contract executable and remove the duplicated audit policy before shipping. |
The Marketing Guru — Round 4 ReviewVerdict: APPROVE Test command passed: I reviewed the current PR diff, changed files, docs, changelog, and PR body. A totally different path is not warranted: durable DB audit rows plus operator-facing verification docs is the right-sized shipping path for #279. The Round 3 public-contract blockers are fixed:
From the Marketing Guru lens, the public words now match the product surface. Developers and agents are not being sent toward a nonexistent endpoint or an internal placeholder URL. Ship it. |
The Architect — Round 4 ReviewVerdict: APPROVE Test command passed: I reviewed the current PR diff, changed files, issue #279, prior council feedback, and the updated PR body. A totally different path is not warranted. One Round 3's material blockers are fixed: the PR body no longer promises There is still polish available: the audit integration tests could assert the contract more uniformly, and repeated audit call-site assembly could be factored later. I am not blocking on that in Round 4. The remaining risk is proportional to the change, covered by tests, and better handled as follow-up than another review loop. Ship it. |
The Steward — Round 4 ReviewVerdict: APPROVE Test command passed: I reviewed the current PR diff, changed files, PR body, and prior Council feedback. A totally different path is not warranted: one DB-backed Round 3 Steward blockers are resolved:
From the Steward lens, the material API-contract and partial-success risks are addressed. Ship it. |
What changed
Added durable database audit records for comment create/update/delete and document access. Audit rows include actor, action, target, metadata, and timestamp, with 90-day minimum retention.
Why
Closes #279. Block Security requires auditable records for sensitive activity without relying on ephemeral logs or webhook delivery.
New/Changed Endpoints
No endpoints changed.
How to verify
npm run checkaudit_events:psql "$DATABASE_URL" -c "select actor, action, target, created_at from audit_events order by created_at desc limit 10;"Manual testing checklist
npm run start)npm test)