Skip to content

Add audit logs#647

Draft
varmar05 wants to merge 4 commits into
masterfrom
audit_logs
Draft

Add audit logs#647
varmar05 wants to merge 4 commits into
masterfrom
audit_logs

Conversation

@varmar05

@varmar05 varmar05 commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Introduce a pluggable audit module with NullSink default and emit() API.

Wire SQLAlchemy listeners for user and project lifecycle events, explicit emits for auth and sync endpoints (login, password, access grants/revocations, version push, soft/hard delete, restore).

Add actor_context()/request_context() helpers, device_id capture, scope_id for workspace-scoped filtering, and target_type auto-derivation.

Introduce a pluggable audit module with NullSink default and emit() API.

Wire SQLAlchemy listeners for user and project lifecycle events,
explicit emits for auth and sync endpoints (login, password, access
grants/revocations, version push, soft/hard delete, restore).

Add actor_context()/request_context() helpers, device_id capture, scope_id
for workspace-scoped filtering, and target_type auto-derivation.

This is groundwork for adding more events and to be extended in EE with custom sinks, query API, and retention policy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coveralls

coveralls commented Jul 1, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29822367098

Coverage increased (+0.3%) to 92.422%

Details

  • Coverage increased (+0.3%) from the base build.
  • Patch coverage: 9 uncovered changes across 2 files (460 of 469 lines covered, 98.08%).
  • 2 coverage regressions across 1 file.

Uncovered Changes

File Changed Covered %
server/mergin/audit/listeners.py 46 41 89.13%
server/mergin/utils.py 12 8 66.67%
Total (25 files) 469 460 98.08%

Coverage Regressions

2 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
server/mergin/sync/utils.py 2 85.2%

Coverage Stats

Coverage Status
Relevant Lines: 10464
Covered Lines: 9671
Line Coverage: 92.42%
Coverage Strength: 0.92 hits per line

💛 - Coveralls

varmar05 and others added 3 commits July 6, 2026 16:45
Implements structured audit event emission for all relevant user and project actions.
Update AuditEvent dataclass with new target columns: project_id, workspace_id and user_id.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…events

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Also simplify test_get_projects_by_uuids to avoid the fake-workspace-id hack.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants