feat: implement audit logging system #122#134
Merged
kryachkow merged 18 commits intodevelopmentfrom Feb 18, 2026
Merged
Conversation
Closed
statgpt/admin/alembic/versions/2026_02_11_1200-3b8a6a40f1cd_add_audit_logs_table.py
Show resolved
Hide resolved
statgpt/admin/alembic/versions/2026_02_11_1200-3b8a6a40f1cd_add_audit_logs_table.py
Show resolved
Hide resolved
1. Make audit log fields non-nullable. 2. Set `state_after=None` for DELETE actions. 3. Split user auth from audit context setup.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
/deploy-review
|
Fedir-Yatsenko
previously approved these changes
Feb 17, 2026
Collaborator
Fedir-Yatsenko
left a comment
There was a problem hiding this comment.
Let's test in the Review env and merge the changes
Contributor
Author
|
/deploy-review
|
Contributor
Author
|
/deploy-review
|
Contributor
Author
|
/deploy-review
|
Contributor
Author
|
/deploy-review
|
Fedir-Yatsenko
approved these changes
Feb 17, 2026
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.
Applicable issues
This PR is the first part of the issue #122. The rest of the work is described in issue #145.
Description of changes
Implemented immutable admin audit logging in Postgres with decorator-based instrumentation and read-only API access.
What was added
audit_logstable (append-only; DB trigger blocksUPDATE/DELETE)@audit_actiondecorator for service-layer write operationsGET /admin/api/v1/audit-logs(paginated list, no state payload)GET /admin/api/v1/audit-logs/{id}(includesstate_beforereconstructed from previous log andstate_afterfrom current log)Logging behavior updates
state_after(JSON); no full before/after snapshots in DBstate_beforeis computed on demand in details endpointstate_after = nullActor attribution
performed_byandperformed_by_nameare taken from configurable JWT claims:AUDIT_PERFORMED_BY_CLAIM(default:oid)AUDIT_PERFORMED_BY_NAME_CLAIM(default:unique_name)Checklist
Reviewenvironment.By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.