You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Audit log: consistent writes and correlation with PoliNetwork Auth #120
Follow-up to #90. The audit log is written on a best-effort basis, and its events can't yet be matched with what PoliNetwork Auth records. Volume is low, so none of this is urgent. These are known gaps to close before anyone relies on the log as evidence.
Consistency
Events are written after the handler, outside its transaction, and a failed write is only logged. For changes made in the database, write the event in the same transaction (an outbox, or an AuditSink passed to the services like their other dependencies). For external side effects (Azure, Telegram, Auth), record the attempt and then its outcome.
The before-state is read outside the update's transaction in most handlers (web.*, wa.groups, tg.groups, groups.labels), so concurrent writes can make it wrong. Read it in the same transaction with SELECT … FOR UPDATE, or with a CTE that returns the old row.
Correlation with PoliNetwork Auth
Every event now has a request_id, one per HTTP request. Send it to PoliNetwork Auth with the role commands People makes (assign, unassign, unlink), so a dashboard action can be matched with the IdP's audit event that it caused.
Optionally, accept an incoming X-Request-Id from the dashboard and the bot, so one id covers the whole chain.
Coverage outside tRPC (a decision to record, not necessarily to build)
These writes don't go through tRPC, so they are not in the central log: the cron jobs, the e-signing agent endpoints, /internal/events from the IdP, and People's Auth sync. People's sync is already in people_activity, and e-sign requests keep their own history. Decide whether any of the rest needs recording, and with what actor (for example system).
Several targets per event
Calls on several records (resolving reports, e-sign jobs, syncing Telegram groups) leave the target id empty, and the ids are only in the input, so the target filter can't find them. If that turns out to matter, add a target_ids text[] column with a GIN index, rather than a full table linking events to everyone involved.
#106 - feat(people)!: link records by email invite or by hand, and unlink through Auth [merged] #95 - feat(people): mirror PoliNetwork Auth roles and Microsoft 365 members [open]
📝 Issue Planner
Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.
Create Plan
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
💬 Have feedback or questions? Drop into our discord!
Activity
coderabbitai commentedon Nov 8, 2026
🔗 Related PRs
#106 - feat(people)!: link records by email invite or by hand, and unlink through Auth [merged]
#95 - feat(people): mirror PoliNetwork Auth roles and Microsoft 365 members [open]
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!