chore: implement phase 8 - #2786
Conversation
📊 API Diff Results
|
83cf391 to
dc4fadf
Compare
ee34ac5 to
686ccc2
Compare
686ccc2 to
cf2505e
Compare
13df605 to
97a296f
Compare
46afcc1 to
33cec3e
Compare
33cec3e to
55f5288
Compare
There was a problem hiding this comment.
🟡 Changes recommended
A confirmed window-boundary clamping bug in classifyRule can allow episode timestamps to escape past windowEnd, violating its stated clamp contract and affecting reported times.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Implements “phase 8” of the gate’s pure decision layer by adding per-instance timeline classification and a policy-driven decide() seam that combines coverage proofs with classification outcomes, while centralizing poll selection and time-skew translation to avoid drift between coverage and classification.
Changes:
- Added
classify.gowith the outcome table machinery (Outcome,PreexistingPolicy), per-instance timeline classification (classifyRule), shared helpers (pollsForRule,runnerTime), and the policy-drivendecide()aggregator. - Updated
coverage.goto reuse the sharedpollsForRuleandrunnerTimeimplementations (removing the duplicated filter/sort and skew translation). - Added
classify_test.gowith extensive unit coverage for classification outcomes, policy behavior, anddecide()invariants (skipped, unobservable, MinObserved, nodata escalation).
File summaries
| File | Description |
|---|---|
| grafana-alertcheck/internal/gate/coverage.go | Replaces local rule-poll filtering/sorting and runner-time translation with shared helpers to keep coverage/classification consistent. |
| grafana-alertcheck/internal/gate/classify.go | Introduces pure classification + decision seam, outcome computation, shared poll filters, and policy-driven unobservable/MinObserved handling. |
| grafana-alertcheck/internal/gate/classify_test.go | Adds comprehensive tests for timeline classification and decide() behavior under multiple edge cases. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
55f5288 to
e79d3c1
Compare
Invariant defended: H6/H7. The one question: can a violation ever outrank an unobservable rule, or can a pass happen without Violations empty and err nil? Adds classify.go: the pure per-instance classifier (outcome table, preexisting policy, BadFor) and decide(), the seam combining proveCoverage with those timelines under one Policy. Consolidates rule-poll filtering and skew translation onto pollsForRule/runnerTime, shared with coverage.go.
e79d3c1 to
48393bc
Compare
Adds
classify.go(pure per-instance classifier: outcome table, preexisting policy, BadFor) anddecide(), the seam combiningproveCoveragewith the timelines under one policy. Consolidates rule-poll filtering and skew translation intopollsForRule/runnerTime, shared withcoverage.go(invariants H6/H7).Review focus:
classify.gooutcome table and the sharedpollsForRule/runnerTimefilters.