Skip to content

test(scheduler): fix provisional admission deadline flake - #2594

Merged
jbeda merged 1 commit into
mainfrom
fix/scheduler-provisional-admission-deadline
Oct 28, 2026
Merged

jbeda merged 1 commit into
mainfrom
fix/scheduler-provisional-admission-deadline

Conversation

@jbeda

@jbeda jbeda commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix the timing-dependent failure in TestFireProvisionalAdmissionDeadlineKeepsPendingUntilRecovery without changing production scheduler behavior.

Relates to #2327, item 7. This PR addresses only that entry, not the other flakes in the tracker.

The fire's deadline context and watchdog use independent timer callbacks. Receiving the watchdog's "termination unconfirmed" diagnostic does not establish that deadline cancellation has propagated to lease acquisition. The test could release its admission gate too early, start its deliberately uncooperative provider, and hang during recovery and cleanup.

  • Capture the actual acquisition context before publishing the fixture's entered signal.
  • Assert that it inherits the exact fire deadline, then wait for its cancellation and verify DeadlineExceeded before releasing admission.
  • Release both fixture gates during cleanup and defer scheduler/service shutdown so a failed join cannot skip teardown.

Existing pending-state, overlap, no-fabricated-start, zero-provider-call, terminal-error, and resource-release assertions remain intact. No sleeps, timeout increases, or production changes.

The original failure reproduced in two of three runs on a pristine archive of the base commit. Source history places the faulty test synchronization in #2277; this is not an execution-bisect claim.

Verification

  • Final reproducer: 30 consecutive runs passed.
  • Four neighboring deadline/cancellation/admission tests: -race -count=5 passed.
  • task test passed.
  • task test:race passed.
  • task lint passed.
  • Spec, standards, test-adequacy, and test-domain review completed with no remaining findings.

API compatibility

Test-only change. No production behavior, wire contract, exported Go API, feature identifier, or stored-data changes; no upgrade coordination required.

Wait for the actual admission context deadline rather than using the independent watchdog diagnostic as a cancellation barrier. Always release fixture gates and close resources during cleanup.

Co-authored-by: Mecatl <[email protected]>
@jbeda
jbeda merged commit e2ef6e9 into main Oct 28, 2026
40 checks passed
@jbeda
jbeda deleted the fix/scheduler-provisional-admission-deadline branch October 28, 2026 23:08
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Nov 18, 2026
2 tasks
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.

1 participant