Skip to content

fix(tests): replace timing-dependent synchronization#499

Merged
wolfy-j merged 5 commits into
mainfrom
fix/generation-drain-timeout
Jul 22, 2026
Merged

fix(tests): replace timing-dependent synchronization#499
wolfy-j merged 5 commits into
mainfrom
fix/generation-drain-timeout

Conversation

@skhaz

@skhaz skhaz commented Jul 17, 2026

Copy link
Copy Markdown
Member

Removes three independent timing races from the test suite:

  • Extends the registry generation-drain hang guard from 1 second to 10 seconds. Successful delivery still completes immediately; the timer only bounds a genuine hang.
  • Replaces the process subscription sampler with a deterministic lifecycle assertion taken before Process.Close, proving unlisten reclaimed all live state instead of relying on 100-microsecond observations.
  • Drains native-process stderr before Wait closes StderrPipe, matching the os/exec pipe contract and preventing buffered output loss.
  • Makes the application harness fail immediately when a stage fails, uses the same native build tags as Runtime tests, and skips external SQS by default like the other service-backed suites.

Validation

  • make lint
  • go test -race -count=20 ./runtime/lua/modules/process ./service/exec/native
  • ./tests/app/test — 402 application tests passed
  • Existing GitHub Linux, Windows, lint, and CodeQL checks are green.

receive_from selected between the target channel and a 1s timer, asserting the
target fired. A real event arrives in milliseconds, but under a loaded host the
async round-trip raced the 1s deadline and the timer won, failing with a channel
identity mismatch — measured ~50% (3 of 6) flaky. The deadline only exists to
stop a hang; give it 10s of headroom. Verified 10/10 clean afterwards.

@wolfy-j wolfy-j 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.

Reviewed the complete test change. The timer is only a hang guard around an asynchronous registry-generation drain; increasing it from 1s to 10s does not change runtime behavior or assertions, and the test still fails deterministically on a real hang.

@wolfy-j wolfy-j changed the title fix(tests): stop generation_drain flaking on a 1s deadline fix(tests): replace timing-dependent synchronization Jul 21, 2026
@wolfy-j
wolfy-j merged commit 49c092d into main Jul 22, 2026
4 checks passed
@wolfy-j
wolfy-j deleted the fix/generation-drain-timeout branch July 22, 2026 01:16
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