refactor: consolidate audit logging into internal/audit provider#541
Merged
lakhansamani merged 2 commits intomainfrom Apr 3, 2026
Merged
refactor: consolidate audit logging into internal/audit provider#541lakhansamani merged 2 commits intomainfrom
lakhansamani merged 2 commits intomainfrom
Conversation
24bb5cc to
6eb3bf4
Compare
Replace two duplicate audit log helpers (graphql/audit_log_helper.go and http_handlers/audit_log_helper.go) with a single audit.Provider in internal/audit/ following the project's standard provider pattern. - Create internal/audit/provider.go with Provider interface + LogEvent - Inject AuditProvider into graphql.Dependencies and http_handlers.Dependencies - Initialize audit provider in cmd/root.go - Update all 32 call sites across 29 files to use audit.Event - Delete the two old helper files - Callers now extract IP/UserAgent and pass in Event struct directly
6eb3bf4 to
35053fa
Compare
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.
Summary
Replaces two duplicate audit log helpers with a single
audit.Providerfollowing the project's standard provider pattern (Dependencies + New() + Provider interface).Before: Duplicate
logAuditEvent()methods andAuditLogOptsstructs in bothinternal/graphql/andinternal/http_handlers/After: Single
internal/audit/package withProviderinterface injected as a dependencyChanges
internal/audit/provider.gowithProviderinterface,Eventstruct, and asyncLogEventimplementationAuditProvider audit.Providertographql.Dependenciesandhttp_handlers.Dependenciesaudit.Providerincmd/root.goand pass through to both providersaudit.Eventinternal/graphql/audit_log_helper.goandinternal/http_handlers/audit_log_helper.goRef: RFC #505 — Structured Audit Log System (audit logger service section)
Test plan
go build ./...passesTEST_DBS=sqlite— 8/8 audit log tests pass