Repository navigation
test(explorer): wait for every API answer before ending the image-flood step - #246
Merged
Merged
Conversation
…od step goto's settle is a quiet window (no API slot or response for 2 s), not 'all page requests answered'. Under the image flood the interceptor can stay quiet that long, so goto may return before all 12 API answers reach the page (v3.2.0 release run: title '0'). Wait for document.title to reach N_API while the step is still active, then end it; every other assertion is unchanged.
Owner
Author
|
Patched test, local run: 1 passed (169 s wall in total) while 36 busy-loop processes ran on 12 cores (load average about 40), including the |
tunjayoff
marked this pull request as ready for review
November 21, 2026 07:14
Owner
Author
|
Idle machine: 5/5 passed (≈11.8 s each). |
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.
Fixes the flake in
tests/test_research_explorer.py::test_explorer_records_every_request_under_an_image_flood(browser bridge (offline) job). It failed once on the v3.2.0 release run (assert '0' == '12'at the title check); the same commit passed on the PR's CI.Cause
Explorer.gotowaits through_settle(settle, dwell): it sleepssettles, then keeps waiting only while the last API activity (last_api, set when a slot is granted and when a response arrives) is less thansettles old. That is a quiet window, not "all of the page's requests answered". In this testsettleis 2 s. Under the 12,000-image flood every paused image goes through the same asyncio loop and CDP pipe as the API requests. Each API request also needs twoFetch.getResponseBodyliveness round trips and a thread hop for the rate slot. So the interceptor can stay quiet for 2 s (title0means no answer at all had reached the page), and goto returns early. The test then setex.active = Falsestraight away and read the title.Change (test only)
res["error"] is None. Then wait for what the test means,page.wait_for_function("document.title === '12'"), with a timeout of(N_API * gap + 60) s= 64.8 s.ex.active = False. An inactive step drops requests that are still queued, so waiting after it would let the title reach 12 through dropped (failed) fetches and the run would then fail onapi_hits.elapsed < 80.No product change and no CHANGELOG entry (tests only).
Runs (local, offline)
ruff check: clean.