Repository navigation
test(web-fetch): remove timing races from the native CDP port test - #225
Merged
Merged
Conversation
There was a problem hiding this comment.
ℹ️ Review skipped · 9bd5880
No reviewable content was selected for this run.
lanyue-llk
added a commit
that referenced
this pull request
Nov 4, 2026
lanyue-llk
force-pushed
the
test/native-cdp-port-race
branch
from
November 4, 2026 04:50
9bd5880 to
3dd29de
Compare
There was a problem hiding this comment.
ℹ️ Review skipped · 3dd29de
No reviewable content was selected for this run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues
Closes #216
Summary
test_port_check_ignores_the_log_of_an_earlier_attemptfailed at random in CI withDID NOT RAISE RuntimeError, on PRs that do not touch this code. Its stand-in server calledlisten()and then exited, so the fake handshake could succeed in that gap.The rest of the file had the same kind of dependence on timing, so this makes all of it deterministic:
time.sleep(.2).Test-only. No production code changes.
Test plan
Run locally on macOS with Python 3.11 from the shared locked environment.
tests/test_native_cdp_port.py12 times in a row with four busy CPU processes running: 15 passed each time, 3 to 8 seconds per run.tests/test_native_cdp_port.pyandtests/test_explicit_utf8_io.py: 77 passed.ruff check --config 'include=["*.py"]' --select F,TID252 .andruff checkpass. Pointing ruff directly at this file reports one E501 on line 91, an existing line this PR does not change; the same error appears on main.headless.py, each applied alone and reverted, and each made the file fail: reading the whole log instead of this attempt's (1 failed), removing the exit check after the caller finishes (2 failed), and keeping a browser whose server already exited (1 failed).