Conversation
Introduce an AuditScope enum (config, ex_im, reindex, ds_link) and a scope column on audit_logs so verbose event auditing can be enabled per environment. The AUDIT_SCOPE setting (default config,ex_im) controls which scopes are recorded; writes for disabled scopes are skipped. - Migration adds the scope column and backfills existing import_job rows to ex_im (toggling the immutability trigger for the one-time update). - AuditService.persist/persist_batch are now async and gain a log_event method for events without an Auditable object (dataset linking, reindexing). - Skip no-op config updates by comparing against the latest same-scope state, avoiding empty-diff records on unchanged re-imports. - Add scope filtering to the audit log API/service and sanitize obsolete state keys at read time without mutating immutable rows.
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
Description of changes
The admin audit log had three rough edges: no-op channel updates produced empty-diff records (a #528 regression), the
data_sourceblock still showed up in dataset update diffs, and high-value operations (reindexing, dataset↔channel linking) weren't recorded at all. This PR addresses all three by introducing audit scopes.AuditScopeenum (config,ex_im,reindex,ds_link) and ascopecolumn onaudit_logs. Which scopes are recorded is controlled by a newAUDIT_SCOPEsetting (defaultconfig,ex_im); the verbosereindexandds_linkscopes are opt-in per environment. This supersedes the singleDETAILED_AUDITboolean proposed in the issue with a more granular, per-scope toggle.Auditabledomain object.data_sourceare stripped from historical state at read time, so they no longer appear in before/after diffs — without mutating the immutable audit rows.scopefilter.scopecolumn and backfills existing import/export records toex_im(temporarily disabling the row-immutability trigger for the one-time backfill).Checklist
ReviewenvironmentBy submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.