Skip to content

[DX-5482] fix gap exceeds maxGap on startup - #2854

Merged
Tofel merged 5 commits into
mainfrom
dx-5482-fix-too-tight-schedule-bug
Oct 1, 2026
Merged

Tofel merged 5 commits into
mainfrom
dx-5482-fix-too-tight-schedule-bug

Conversation

@Tofel

@Tofel Tofel commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Fixes a spurious "gap exceeds maxGap" failure when the classification window opens inside the recorder's/check's first-observation pass.
Adds Header.ReadyAt stamped after the pass; check refuses from < ReadyAt in recorder mode; single-step (live mode) clamps from to the pass completion with a blind-interval warning; the recorder child and live poller continue the first observations' schedule (NewSchedulerFromPolls) instead of re-staggering; CheckStartupHandoff simulates the poller's first cycles and refuses unsafe schedules at startup; budget errors now name rules by title and suggest the minimum concurrency.

@Tofel
Tofel requested a review from a team as a code owner September 30, 2026 14:01
Copilot AI balanced review requested due to automatic review settings September 30, 2026 14:01
@github-actions

Copy link
Copy Markdown

👋 Tofel, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

📊 API Diff Results

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

View full report

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.

Copilot review overview

🟡 Changes recommended

Timestamp truncation, unordered concurrent dispatch, and unchanged schema versioning leave startup coverage guarantees incomplete.

Review effort: Balanced
Findings: 2 High severity · 2 Medium severity

Open (4)
What changed in this PR

Fixes startup coverage gaps by recording readiness, preserving poll schedules, and validating startup handoffs.

Changes:

  • Adds ReadyAt and startup-window handling.
  • Continues seeded polling schedules across handoffs.
  • Improves budget validation, diagnostics, tests, and documentation.
File Description
internal/​gate/​watch.go Records readiness and seeds the child scheduler.
internal/​gate/​watch_test.go Tests readiness and seeded recording.
internal/​gate/​source_fake_test.go Adds virtual-clock advancement.
internal/​gate/​schedule.go Adds seeded scheduling and handoff simulation.
internal/​gate/​schedule_test.go Tests scheduling, handoffs, and diagnostics.
internal/​gate/​log.go Adds ready_at to headers.
internal/​gate/​coverage.go Uses readiness for coverage bounds.
internal/​gate/​coverage_test.go Tests readiness-bound coverage.
internal/​gate/​check.go Handles startup blind intervals and seeded polling.
internal/​gate/​check_test.go Tests recorder and live startup behavior.
docs/​reference/​log-format.md Documents ready_at.
docs/​reference/​cli.md Updates command behavior.
docs/​index.md Updates single-step guidance.
docs/​architecture.md Documents recorder handoff design.
docs/​advanced.md Explains startup validation.
.changeset/​v0.1.7.md Records release changes.

💡 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/log.go
Comment thread grafana-alertcheck/internal/gate/schedule.go Outdated
Comment thread grafana-alertcheck/internal/gate/check.go
Comment thread grafana-alertcheck/internal/gate/coverage.go

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.

Copilot review overview

🟡 Changes recommended

The handoff simulation can approve schedules whose real requeued polling order exceeds maxGap.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (4)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Misleading concurrency recommendation for non-utilization failures

grafana-alertcheck/​internal/​gate/​schedule.go:400

This branch is reached only when utilization already fits; the remaining per-rule and burst-bound failures cannot be fixed by adding workers because concurrency does not shorten a request. Keeping “raising concurrency” here sends operators toward a change that will still fail the same check.

Comment thread grafana-alertcheck/internal/gate/handoff.go

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.

Copilot review overview

🔵 Needs a closer look

The handoff simulation can allocate memory proportional to an unbounded concurrency value, and one ReadyAt comment is inaccurate.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Cap simulated concurrency to prevent excessive allocations

grafana-alertcheck/​internal/​gate/​handoff.go:100

--concurrency has no upper bound, and unlike observeAll, this simulation allocates one heap entry per requested worker. A value much larger than the rule count can therefore allocate enormous slices (and repeat that allocation per batch) even though the real poller can never use more than one worker per rule. Cap the simulated worker count to the remaining job count.

Low severity Correct outdated zero-value ReadyAt documentation

grafana-alertcheck/​internal/​gate/​log.go:74

This comment is now inconsistent with single-step construction: check stamps the synthesized header's ReadyAt after the first-observation pass. Only legacy log headers leave this field zero, so documenting single-step synthesis as another zero-value case is misleading.

@Tofel
Tofel merged commit fd38475 into main Oct 1, 2026
63 checks passed
@Tofel
Tofel deleted the dx-5482-fix-too-tight-schedule-bug branch October 1, 2026 07:31
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.

3 participants