Skip to content

chore: implement phase 8 - #2786

Open
Tofel wants to merge 3 commits into
dx-5122-alerts-assertion-p7from
dx-5122-alerts-assertion-p8
Open

chore: implement phase 8#2786
Tofel wants to merge 3 commits into
dx-5122-alerts-assertion-p7from
dx-5122-alerts-assertion-p8

Conversation

@Tofel

@Tofel Tofel commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Adds classify.go (pure per-instance classifier: outcome table, preexisting policy, BadFor) and decide(), the seam combining proveCoverage with the timelines under one policy. Consolidates rule-poll filtering and skew translation into pollsForRule/runnerTime, shared with coverage.go (invariants H6/H7).

Review focus: classify.go outcome table and the shared pollsForRule/runnerTime filters.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

📊 API Diff Results

No changes detected for module github.com/smartcontractkit/chainlink-testing-framework/grafana-alertcheck

View full report

@Tofel
Tofel force-pushed the dx-5122-alerts-assertion-p8 branch from 83cf391 to dc4fadf Compare September 1, 2026 11:25
@Tofel
Tofel force-pushed the dx-5122-alerts-assertion-p8 branch 2 times, most recently from ee34ac5 to 686ccc2 Compare September 1, 2026 14:46
@Tofel
Tofel force-pushed the dx-5122-alerts-assertion-p8 branch from 686ccc2 to cf2505e Compare September 1, 2026 15:25
@Tofel
Tofel force-pushed the dx-5122-alerts-assertion-p8 branch 2 times, most recently from 13df605 to 97a296f Compare September 2, 2026 09:57
@Tofel
Tofel force-pushed the dx-5122-alerts-assertion-p8 branch 2 times, most recently from 46afcc1 to 33cec3e Compare September 4, 2026 15:15
@Tofel
Tofel force-pushed the dx-5122-alerts-assertion-p8 branch from 33cec3e to 55f5288 Compare September 7, 2026 09:35
@Tofel
Tofel marked this pull request as ready for review September 7, 2026 09:37
@Tofel
Tofel requested a review from a team as a code owner September 7, 2026 09:37
Copilot AI lite review requested due to automatic review settings September 7, 2026 09:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.go with the outcome table machinery (Outcome, PreexistingPolicy), per-instance timeline classification (classifyRule), shared helpers (pollsForRule, runnerTime), and the policy-driven decide() aggregator.
  • Updated coverage.go to reuse the shared pollsForRule and runnerTime implementations (removing the duplicated filter/sort and skew translation).
  • Added classify_test.go with extensive unit coverage for classification outcomes, policy behavior, and decide() 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.

Comment thread grafana-alertcheck/internal/gate/classify.go
@Tofel
Tofel force-pushed the dx-5122-alerts-assertion-p8 branch from 55f5288 to e79d3c1 Compare September 7, 2026 09:46
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.
@Tofel
Tofel force-pushed the dx-5122-alerts-assertion-p8 branch from e79d3c1 to 48393bc Compare September 7, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants