Add the settings trigger vocabulary and violation shapes
What does this MR do and why?
Records the four project settings triggers the engine reports, and adds the value objects that turn one engine decision into the details and the sentence the audit trail carries.
Gitlab::PolicyStore::Triggers::TYPES is the persisted vocabulary, and the trigger_type enums on Govern::Policy and Govern::PolicyEvaluation grow with it. The authoring catalogue, Triggers::ALL, does not change, so the policy editor offers nothing new yet. The ids match the engine's own registry, so an evaluation records what the engine reported. The vocabulary work of https://gitlab.com/gitlab-org/gitlab/-/work_items/632234 extends the authoring side and should build on these constants.
ViolationDetails reads the violations out of one decision. ViolationMessage turns them into one sentence. SettingDrift carries the key names the engine uses in its violation hashes; the behaviour that reads a drifted setting back arrives with the write-back work of https://gitlab.com/gitlab-org/gitlab/-/work_items/630155, which is the first thing that needs it.
This MR is one of three. !261560 (merged) was too large to review in one piece, so it is now a stack: this MR, then the dispatch rules and audit executor in !263547 (merged), then the evaluation service in !261560 (merged). Each stands alone and its specs pass on its own branch.
Nothing calls this code yet.
References
- Issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/630148
- Trigger vocabulary issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/630150
- Epic: https://gitlab.com/groups/gitlab-org/-/work_items/23462
Screenshots or screen recordings
Backend-only change, no UI.
| Before | After |
|---|---|
How to set up and validate locally
-
Run the specs:
bin/rspec ee/spec/lib/govern/policy_engine/ ee/spec/models/govern/ cd gems/gitlab-policy-store && bundle exec rspec -
Confirm the editor still offers only the three deployment triggers, because
Triggers::ALLis unchanged.
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.