Skip to content

Comments

fix: fix RampsController flaky test#8018

Merged
amitabh94 merged 1 commit intomainfrom
cursor/rampscontroller-flaky-test-c0cb
Feb 23, 2026
Merged

fix: fix RampsController flaky test#8018
amitabh94 merged 1 commit intomainfrom
cursor/rampscontroller-flaky-test-c0cb

Conversation

@amitabh94
Copy link
Contributor

@amitabh94 amitabh94 commented Feb 23, 2026

Explanation

  • What is the current state of things and why does it need to change?
    The test "evicts oldest entries when cache exceeds max size" in RampsController.test.ts was flaky. It used 5ms setTimeout delays to create distinct timestamps for cache entries, which was too short for reliable execution in CI environments due to Date.now() resolution limitations and execution timing variations under load. This led to non-deterministic cache eviction order.
  • What is the solution your changes offer and how does it work?
    The setTimeout delays within this specific test have been increased from 5ms to 20ms. This provides a more robust time separation between cache entries, ensuring distinct timestamps and consistent eviction behavior, thereby resolving the flakiness.

References

  • Fixes a flaky test in RampsController.test.ts.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Slack Thread

Open in Web Open in Cursor 


Note

Low Risk
Test-only timing tweak; no production code paths are changed, with minimal risk beyond slightly longer test runtime.

Overview
Makes the RampsController cache-eviction test deterministic in CI by increasing the inter-request delay used to create distinct timestamps.

In RampsController.test.ts, the cache eviction test now waits 20ms (was 5ms) between executeRequest calls so the “oldest entry” eviction order is stable.

Written by Cursor Bugbot for commit 063cbe7. This will update automatically on new commits. Configure here.

…imeout delays

The 'evicts oldest entries when cache exceeds max size' test was flaky in CI
because it used 5ms delays between cache entries to create different timestamps.
This is too tight for CI environments where:
- Date.now() resolution can be 10-15ms on some systems
- System load causes timing variations exceeding 5ms

Increased delays from 5ms to 20ms to ensure reliable timestamp separation
across different CI environments.

Co-authored-by: Amitabh Aggarwal <amitabh94@users.noreply.github.com>
@cursor
Copy link

cursor bot commented Feb 23, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@amitabh94 amitabh94 marked this pull request as ready for review February 23, 2026 15:45
@amitabh94 amitabh94 requested a review from a team as a code owner February 23, 2026 15:45
@amitabh94 amitabh94 changed the title RampsController flaky test fix: fix RampsController flaky test Feb 23, 2026
@amitabh94 amitabh94 added this pull request to the merge queue Feb 23, 2026
Merged via the queue into main with commit 9322455 Feb 23, 2026
312 checks passed
@amitabh94 amitabh94 deleted the cursor/rampscontroller-flaky-test-c0cb branch February 23, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants