Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

The dispatch_workflow.test.cjs test was intermittently failing in CI due to strict timing expectations that didn't account for JavaScript execution overhead.

Changes

  • Relaxed timing threshold: Changed assertion from >= 5000ms to >= 4995ms in the dispatch delay test
    • Test measures wall-clock time between dispatch calls
    • Implementation correctly waits 5 seconds, but execution overhead between timestamp captures can cause measured time to be 4999ms
    • 5ms tolerance accounts for sub-millisecond timing jitter while still validating delay behavior
// Before
expect(secondDispatchTime - firstDispatchTime).toBeGreaterThanOrEqual(5000);

// After
expect(secondDispatchTime - firstDispatchTime).toBeGreaterThanOrEqual(4995);
Original prompt

Reference: https://github.com/github/gh-aw/actions/runs/21619543844/job/62332544537#step:7:1

Fix tests


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…tter

The test was failing with 4999ms when expecting >= 5000ms due to timing overhead
between when the test measures time and when the dispatch delay is calculated.
Changed threshold to 4995ms to account for sub-millisecond timing jitter while
still validating the 5-second delay behavior.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing tests in the codebase Fix flaky dispatch_workflow test timing assertion Feb 3, 2026
Copilot AI requested a review from pelikhan February 3, 2026 11:24
@pelikhan pelikhan marked this pull request as ready for review February 3, 2026 11:41
Copilot AI review requested due to automatic review settings February 3, 2026 11:41
@pelikhan pelikhan merged commit 7f74974 into codex/refactor-expired-entity-scripts Feb 3, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/fix-tests-yet-again branch February 3, 2026 11:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a flaky test in dispatch_workflow.test.cjs that was failing in CI due to JavaScript execution timing overhead when measuring delays.

Changes:

  • Relaxed the timing assertion threshold from 5000ms to 4995ms (0.1% tolerance) to account for sub-millisecond jitter between Date.now() calls
  • Updated the comment to clarify that the test verifies "approximately 5 seconds" delay and explain the tolerance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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