feat(commons): evaluate rule sets in order of priority #2537
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.42) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 336 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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
Diff Size
diff_size
0.348
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2537"
general
weight: 0.35
cbumb
Summary
Fixes #2210. Part of #1903. Design: ADR-064, section "Rule set evaluation".
Adds rule set evaluation to
commons/pkg/ruleset. Nothing calls it yet.Compiledrops disabled rule sets, compiles the CEL rules once, and orders the rule sets bypriority, highest first. Equal priorities keep the order of the configuration.Evaluatereturns the first rule set that matches, or no match. The rule sets after the winner are not evaluated.EvaluationErrorthat names the rule set, and no winner. The caller then uses neither a later rule set nor its default.allandanygive the same result whatever the order of their rules, as&&and||do in CEL. A rule that does not match decidesall, and a rule that matches decidesany, even when another rule in the list fails.Input. A rule whose input is missing fails withErrMissingInput.The second commit logs each Node rule evaluation in
celruleat debug instead of info, because it now runs for each rule set on each event.Type of Change
Component(s) Affected
Testing
Checklist
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Rule sets can now be compiled and evaluated to select the first matching result, considering higher-priority rules first and preserving configuration order for ties. Disabled rule sets are skipped.
Evaluation reports errors when a rule set fails before a match and identifies when a required input is missing. For combined rules,
allandanyconditions follow their expected match behavior even when other conditions error.A selected rule set retains its configured outcome.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->