chore: implement phase 9 - #2787
Open
Tofel wants to merge 2 commits into
Open
Conversation
📊 API Diff Results
|
Tofel
force-pushed
the
dx-5122-alerts-assertion-p9
branch
2 times, most recently
from
September 1, 2026 14:18
99e5355 to
95381e3
Compare
Tofel
force-pushed
the
dx-5122-alerts-assertion-p9
branch
from
September 1, 2026 14:46
95381e3 to
04ba08e
Compare
Tofel
force-pushed
the
dx-5122-alerts-assertion-p9
branch
2 times, most recently
from
September 2, 2026 09:45
267665d to
7d9cc1e
Compare
Tofel
force-pushed
the
dx-5122-alerts-assertion-p9
branch
from
September 2, 2026 09:57
7d9cc1e to
effe464
Compare
Tofel
force-pushed
the
dx-5122-alerts-assertion-p9
branch
from
September 2, 2026 11:05
effe464 to
ce02d17
Compare
Tofel
force-pushed
the
dx-5122-alerts-assertion-p9
branch
2 times, most recently
from
September 4, 2026 15:15
1377467 to
f659144
Compare
Tofel
force-pushed
the
dx-5122-alerts-assertion-p9
branch
from
September 7, 2026 09:35
f659144 to
c61028a
Compare
Tofel
marked this pull request as ready for review
September 7, 2026 09:37
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces a large, correctness-critical orchestration layer (check.go) with substantial new behavior despite strong tests, so final human review is warranted.
Pull request overview
Implements Phase 9 by adding the Check() I/O shell around the existing pure classification/coverage logic, with explicit handling for single-step vs recorded-log modes and tightened “authority” decisions (header vs re-resolved definitions; flock vs pidfile) to avoid fail-open behavior.
Changes:
- Added
Check()(and helpers) to orchestrate validation, definition resolution, timing derivation, evidence collection, recorder shutdown via flock authority, drain wait, and finaldecide()classification. - Centralized first-round polling into
firstObservations()for both watch-start and single-step measurement passes, including §3.2 verification and stable poll ordering. - Updated timing/skipped logic so “paused at window start” is sourced from the log header (or equivalent start-of-step snapshot) rather than post-window re-resolved definitions; added supporting helpers and tests.
File summaries
| File | Description |
|---|---|
| grafana-alertcheck/internal/gate/watch.go | Extracts firstObservations() and uses it for initial heartbeats/latency measurement prior to budget checking. |
| grafana-alertcheck/internal/gate/watch_daemon_test.go | Adds a lock-holder test helper process to validate flock-based recorder stop behavior. |
| grafana-alertcheck/internal/gate/schedule.go | Makes transitionGrace exclusion depend on “paused at start” authority (header/snapshot), not post-window definition state. |
| grafana-alertcheck/internal/gate/schedule_test.go | Pins the new header-authoritative grace exclusion behavior in log mode. |
| grafana-alertcheck/internal/gate/log.go | Adds Header.pausedAtStart(), stateRuleByUID(), and ReadLogHeader() to support early identity checks and shared UID selection logic. |
| grafana-alertcheck/internal/gate/flock.go | Adds tryLockExclusive() to distinguish contention from actual flock failures for “writer exists?” probing. |
| grafana-alertcheck/internal/gate/coverage.go | Updates commentary to reflect Phase 9/P8 responsibilities now implemented elsewhere. |
| grafana-alertcheck/internal/gate/classify.go | Switches skipped-rule detection to header authority via pausedAtStart. |
| grafana-alertcheck/internal/gate/classify_test.go | Updates tests to construct pause authority via header rather than Definition.IsPaused. |
| grafana-alertcheck/internal/gate/check.go | New: full Phase 9 Check() implementation including validation, early header read, stop protocol, drain wait, and result merge. |
| grafana-alertcheck/internal/gate/check_test.go | New: comprehensive integration-style tests for single-step and recorder modes, including edge cases and regressions. |
| grafana-alertcheck/internal/gate/check_process.go | New: process signaling helper (signalRecorder) used by recorder stop logic. |
Review details
- Files reviewed: 12/12 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.
Tofel
force-pushed
the
dx-5122-alerts-assertion-p9
branch
from
September 7, 2026 09:46
c61028a to
ab74eba
Compare
Invariant defended: H5/H7. The one question: can check report a pass over a window it did not prove? Check() is the I/O shell around the pure decide(). Single-step synthesizes the header and its own sentinel, so no mode flag reaches the pure layer. Log mode stops the recorder before the one full read. The header, not a definition re-resolved after the window closed, is the authority for what was paused when the window opened — it decides `skipped`, the drain set, and the transitionGrace max. The flock, not the pidfile, is the authority for whether a writer still exists.
Tofel
force-pushed
the
dx-5122-alerts-assertion-p9
branch
from
September 7, 2026 15:02
ab74eba to
7c3f206
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
Check(), the I/O shell around puredecide()(invariants H5/H7). Single-step mode synthesizes the header and its own sentinel, so no mode flag reaches the pure layer; log mode stops the recorder before the one full read. The header (not a re-resolved definition) decidesskipped, the drain set, andtransitionGrace; the flock (not the pidfile) is the authority for whether a writer still exists.Review focus:
check.gomode handling, and the header-vs-flock authority decisions.