feat(VAN-16): broader action taxonomy and per-triager activity log views#23
Merged
fr4nc1stein merged 3 commits intoMay 29, 2026
Merged
Conversation
- CLAUDE.md: added '5. Learn From Corrections' and '6. Autonomous Execution' sections based on Boris Cherny's CLAUDE.md patterns - tasks/lessons.md: initial 23 lessons extracted from ISSUES.md, CHANGELOG.md, docs/agent.md, docs/SCHEMA_REFACTOR.md, docs/MIGRATION_ORDER.md, and AGENTS.md covering Cloudflare edge runtime, Next.js 16, auth/middleware, DB migrations, API design, security, and dev workflow patterns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Item 1 - Broader action taxonomy:
- lib/audit.ts: add 5 new AuditAction types (comment_posted, scope_created,
scope_updated, scope_archived, template_used)
- app/api/reports/[id]/comments/route.ts: log comment_posted on POST
- app/api/admin/scopes/route.ts: log scope_created on POST
- app/api/admin/scopes/[id]/route.ts: log scope_updated on PATCH,
scope_archived on DELETE; capture userId from requireRole
- app/admin/activity-logs/page.tsx: sync ACTION_TYPES/ICONS/COLORS with all
known action types (added role_changed, user_suspended, user_unsuspended,
comment_posted, scope_created, scope_updated, scope_archived, template_used)
Item 2 - Per-triager scoped audit views:
- app/api/admin/activity-logs/route.ts: drop gate to requireRole('TRIAGER');
TRIAGERs are auto-scoped to their own actor_id; response includes scoped flag
- app/api/admin/activity-logs/export/route.ts: same TRIAGER access + auto-scope
- app/admin/activity-logs/page.tsx: show info banner when scoped=true
Retention policy (item 3) deferred -- depends on VAN-11 (Program Settings)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #22
Summary
Fills two of the three gaps in the Activity Logs module (
/admin/activity-logs).Item 1 — Broader action taxonomy
Added 5 new
AuditActiontypes and wired them into the relevant routes:comment_postedPOST /api/reports/[id]/commentstemplate_usedPOST /api/reports/[id]/comments(whentemplateIdis provided)scope_createdPOST /api/admin/scopesscope_updatedPATCH /api/admin/scopes/[id]scope_archivedDELETE /api/admin/scopes/[id]The page (
/admin/activity-logs) now has icons and colour badges for all 15 known action types, including the 3 that were already inlib/audit.tsbut missing from the UI (role_changed,user_suspended,user_unsuspended).Item 2 — Per-triager scoped audit views
ADMINtoTRIAGERactor_idis automatically forced to their own user ID — they only see their own actionsItem 3 — Deferred
Retention policy controls depend on the Program Settings module — skipped for now.
Files changed
lib/audit.ts— +5 action typesapp/api/reports/[id]/comments/route.ts— logcomment_posted+template_usedapp/api/admin/scopes/route.ts— logscope_createdapp/api/admin/scopes/[id]/route.ts— logscope_updated,scope_archivedapp/api/admin/activity-logs/route.ts— TRIAGER access + auto-scopeapp/api/admin/activity-logs/export/route.ts— TRIAGER access + auto-scopeapp/admin/activity-logs/page.tsx— full action type sync + scoped banner🤖 Generated with Claude Code