Repository navigation
Fix virtual sleep determinism detection - #8541
austinywang wants to merge 254 commits into
Conversation
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe determinism checker now distinguishes real clock sleeps from fake-clock event data, and CI validates the checker before strict enforcement. The relay credential refresh test directly checks emitted clock events after each simulated refresh advance. ChangesDeterminism-safe refresh testing
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR makes the test-determinism gate distinguish real delays from virtual or shadowed sleep APIs. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (128): Last reviewed commit: "Merge branch 'main' of https://github.co..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/check-test-determinism.py`:
- Line 196: The sleep-detection regex at scripts/check-test-determinism.py lines
196-196 must exclude Swift enum cases while matching unqualified and
method-called sleeps; replace its current boundary pattern with the specified
refined matching logic. Remove the _is_assertion_line workaround at
scripts/check-test-determinism.py lines 449-453, leaving assertion lines
eligible for real delay detection because the regex now excludes virtual-clock
.sleep( cases.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 855c1b14-efa8-4cf1-ad19-5c2475636e7d
📒 Files selected for processing (1)
scripts/check-test-determinism.py
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/check-test-determinism.py`:
- Around line 455-461: Update _SLEEP_CALL to use the specified prefix pattern so
it matches unqualified sleeps and method calls while excluding virtual clock
enum cases written as .sleep(. Remove _IMPLICIT_MEMBER_SLEEP_VALUE and delete
the candidate_line manipulation in the sleep-detection flow, using the original
line directly for _SLEEP_CALL matching.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 169bd566-3569-4894-ba9f-0a4e9f5d16ce
📒 Files selected for processing (1)
scripts/check-test-determinism.py
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/check-test-determinism.py`:
- Around line 461-478: Update the named-clock resolver around the backward scan
to track lexical scope boundaries, including private/static functions and
closures/blocks, so outer bindings cannot leak into nested scopes. Resolve typed
function parameters such as ContinuousClock before returning, while retaining
nearest-binding precedence and recognizing real-clock declarations or
initializers. Ensure injected or virtual-clock fixtures are not classified as
real, and make the added determinism self-tests pass.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c31b5a9f-ff28-4296-92d6-3da7baceff74
📒 Files selected for processing (2)
.github/workflows/ci.ymlscripts/check-test-determinism.py
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
…-8529-workflow-guard-sleep-assert
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
…-8529-workflow-guard-sleep-assert
…uard-sleep-assert
Closes #8529
Root cause
The determinism checker treated sleep-shaped syntax too broadly. Swift virtual-clock enum values and arbitrary receiver methods could be classified as real wall-clock delays, while real sleep APIs in other lexical and language forms were not modeled consistently. That made the workflow guard noisy and left causal-ordering gaps.
What changed
The branch retains test-only red commits followed by their corresponding fixes, so the regression history demonstrates that coverage catches the defects.
Verification
Exact head: b625a30
Base: 252aa38
Demo Video
Demo Video: N/A. This changes an internal static workflow guard; the tagged app was verified through its isolated socket instead.
Localization
Not applicable. The final five-file PR diff changes internal CI, checker, and test surfaces only; no user-facing strings or localization catalogs changed.