Stream the settings write-back audit event
What does this MR do and why?
This MR makes the policy engine's settings write-back audit with its own stream-only audit event, govern_policy_setting_converged, instead of reusing the persisted project_security_setting_updated event.
Potentially high-volume audit events must not be persisted to the database, and the write-back is one: a write that reports success but does not stick repeats on every scheduled drift-check run and persisted another row each time, automation that keeps flipping a setting back persisted one row per cycle, and the first run over a newly governed group persisted one row per drifted project.
The dispatcher already hands the policy to every executor, so ConvergeProjectSettingExecutor now passes it through to ProjectSettingWriter, and the new event carries the policy attribution (id, name, version, trigger, mode) the generic event could not.
The human-facing API::ProjectSecuritySettings endpoint and its shared project_security_setting_updated definition are untouched.
References
- Resolves https://gitlab.com/gitlab-org/gitlab/-/work_items/642991
- Write-back introduced in !269201 (merged)
Screenshots or screen recordings
No UI change.
How to set up and validate locally
No user-facing change; the write-back behaves as before and only the emitted audit event differs. To check it, on a GitLab with an enforce-mode settings policy demanding secret_push_protection_enabled: true:
- In the Rails console, flip the setting on a governed project:
project.security_setting.set_secret_push_protection!(enabled: false). - Run the drift check or wait for its schedule.
- Confirm no row was persisted:
AuditEvent.lastandAuditEvents::ProjectAuditEvent.where(project_id: project.id)show no new record, while a configured streaming destination receives agovern_policy_setting_convergedevent naming the policy.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.