Skip to content

Fix generator virtual-time test race - #82

Merged
xavierjohn merged 2 commits into
mainfrom
fix/generator-test-timer-driving
Oct 17, 2026
Merged

xavierjohn merged 2 commits into
mainfrom
fix/generator-test-timer-driving

Conversation

@xavierjohn

@xavierjohn xavierjohn commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fix the generator test-harness race that blocked the publishing run after #81. Compilation succeeded; Container_startup_has_a_bounded_readiness_deadline failed because the shared clock helper exhausted 6,000 virtual-time spins before queued asynchronous continuations ran. The same helper caused the earlier intermittent continuous-recovery failure.

  • Replace blind clock pumping with a small timer-observing FakeTimeProvider. Tests advance only after the scenario registers its next timer.
  • Await actual request completion, cancellation, and backpressure signals instead of polling predicates or relying on Task.Yield.
  • Verify the readiness deadline at exactly 30 seconds for both repeated HTTP 503 responses and a hanging readiness request.
  • Add a regression proving that the clock waits for timer registration and can advance two virtual minutes without a spin budget.

Only generator tests change. Runtime behavior, library contracts, dependencies, and the AgentDocs upgrade are unchanged.

Verification

  • Exact-head CI passes, including the full solution build, coverage tests, package verification, and SQL cancellation checks.
  • All 65 generator tests pass.
  • 100 complete suite runs pass with four concurrent runners and DOTNET_PROCESSOR_COUNT=1: 6,500 successful test executions.
  • Formatting and analyzer verification passes with dotnet format --verify-no-changes --no-restore.

The publishing workflow has not been rerun and no packages have been published as part of this fix.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Test Results

471 tests  +4   469 ✅ +4   32s ⏱️ +4s
  6 suites ±0     2 💤 ±0 
  6 files   ±0     0 ❌ ±0 

Results for commit 839e0bf. ± Comparison against base commit 40524c7.

This pull request removes 1 and adds 5 tests. Note that renamed tests count towards both.
GenerateSli.Tests.ScenarioTests ‑ Container_startup_has_a_bounded_readiness_deadline
GenerateSli.Tests.ScenarioTests ‑ Advancing_virtual_time_honors_the_timeout_when_callbacks_keep_registering_timers
GenerateSli.Tests.ScenarioTests ‑ Container_startup_has_a_bounded_readiness_deadline(hanging: False)
GenerateSli.Tests.ScenarioTests ‑ Container_startup_has_a_bounded_readiness_deadline(hanging: True)
GenerateSli.Tests.ScenarioTests ‑ Virtual_time_skips_timers_that_were_disposed_before_they_were_observed
GenerateSli.Tests.ScenarioTests ‑ Virtual_time_waits_for_timer_registration_instead_of_spinning

♻️ This comment has been updated with latest results.

@codecov-commenter

codecov-commenter commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.71%. Comparing base (40524c7) to head (839e0bf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #82   +/-   ##
=======================================
  Coverage   92.71%   92.71%           
=======================================
  Files          33       33           
  Lines        1002     1002           
  Branches      173      173           
=======================================
  Hits          929      929           
  Misses         50       50           
  Partials       23       23           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Track live timers in the test time provider, skipping ones disposed before
they are observed, and advance until a goal completes instead of assuming
how many timers the runner creates. Check the deadline on every iteration so
callbacks that register timers synchronously cannot hang the test, and give
the regression test an independent fail-safe.

Also synchronize the readiness-deadline and cancellation-precedence tests
with the runner, settle before negative assertions, and centralize the
real-time test timeout.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@xavierjohn
xavierjohn merged commit 3976fa7 into main Oct 17, 2026
3 checks passed
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