CNV-80463: add alert rule preview API #1331
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.44) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.44 · 239 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.328
Real PR Conversation Timeline
1 comments
"Review active on #1331"
general
weight: 0.35
PeterYurkovich
Summary
Adds
POST /api/v1/alerting/rules/previewfor dry-run create orupdate without persisting changes.
Preview shares planning logic with execute paths
(
plan_create_user_defined.go,plan_create_platform.go,plan_update.go) and returns a multi-resource change plan(
resources[],desiredRule,writable, optionalmanagedBy).Preview API
alertingRule+ optionalprometheusRuleruleId+ at least one oflabels,alertingRuleEnabled, orclassificationchanges[]and fulldesiredObjectfor UI review
writable: falsewithmanagedBy)Tests
/rules/previewcreate and updateTest plan
go test ./pkg/management/... ./internal/managementrouter/...go build -tags e2e ./test/e2e/...Signed-off-by: Shirly Radco <sradco@redhat.com>
Co-authored-by: AI Assistant <noreply@cursor.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Added alert-rule previews for creating and updating rules. Previews show the desired rule, affected resources, and add, replace, or remove changes without saving them.
Preview results indicate whether changes are writable and identify GitOps- or operator-managed rules that cannot be changed through the API.
API operations now document bearer-token authentication.
Documentation
Documented preview requests, responses, and access requirements.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->