Repository navigation
Fix browser timeout lifecycle boundaries - #102
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
The probe-lifecycle rework itself reads well — no async export is left under render-checks/, nextFrame has no remaining callers, and the driver-side refusal of a thenable probe is a good place to put the invariant. One blocker, reproduced.
The two new gate tests fail under the repo's default -n 2. Both were dropped to served_timeout_ms=500, but that value is not just the probe deadline — _render_scheme passes it straight into served_here, so it is also the page.request.get deadline for /registry.json, /api/state, the markup, and the previous stamp. Both tests deliberately need the whole gate to run before reaching the probe they stub (the docstring of the test being replaced said so: "the readings before this one have to run for the gate to reach a probe at all"), so under any concurrency the served fetch trips first and the assert all(...) breaks on an unrelated finding:
FAILED tests/test_render_gate.py::test_an_async_reading_probe_is_refused_instead_of_awaited
AssertionError: an async reading has to name itself, and this came back as
['[light] the server stopped answering: APIRequestContext.get: Timeout 500ms exceeded.',
'[dark] the server stopped answering: APIRequestContext.get: Timeout 500ms exceeded.']
Restoring the 3000 the replaced test used clears it — verified below. The refusal path throws immediately rather than waiting, so this costs no wall time on the async test, and only the one 3s wait on the frame test.
Separately, on retiredSlots: the per-holder animation wait is removed in favour of the gate's pageSettled, but pageSettled is polled once in _render_scheme before the context is built, and retiredSlots runs about fifteen probe round trips later inside _read_scheme — it is a precondition, not a reading taken at the same moment. Is a fold that starts after that poll (a CSS animation is created at style recalc, after the rAF callback the poll runs in) reachable here, or does logApplied + presented foreclose it? The other four probes that dropped async were genuinely synchronous already; this is the one place a wait was removed rather than relocated.
Evidence
Run at head 826a629, default options (addopts = "-n 2 --dist loadgroup", 4 cores):
| run | command | result |
|---|---|---|
| 1 | uv run pytest tests/test_render_gate.py -q |
2 failed, 64 passed — test_an_async_reading_probe_is_refused_instead_of_awaited, test_a_rendering_turn_is_polled_from_the_driver |
| 2 | uv run pytest tests/test_render_gate.py -q |
1 failed, 65 passed — test_an_async_reading_probe_is_refused_instead_of_awaited |
| 3 | same file at base 38bef20 (worktree) |
65 passed |
| 4 | head + the two suggestions below | 66 passed |
Not load-specific: a two-test selection (-k "async_reading or rendering_turn") reproduced the same failure in 4.5s.
Mechanism, by symbol rather than line since the merged tree is ahead of the branch — in render_gate/scheme.py, _render_scheme sets both page._leaf_probe_timeout_ms = served_timeout_ms and served_here(path) -> served(page, url, path, timeout_ms=served_timeout_ms), and served ends return page.request.get(urljoin(url, path), timeout=timeout_ms). The try: block around the four served_here calls is what raises, and its except PlaywrightTimeout is what emits the server stopped answering.
The other tests changed here are green: the six wait_for_revision call sites in test_render_projection.py that dropped BOTH_STAMPS, the unroute_all change in test_render_outbox.py, and the tab-mark poll in test_render_startup.py all pass (10 selected, 27s).
|
Addressed the reproduced blocker in On
|
|
Blocker cleared — reverified at The No remaining findings from my side; the approval is on the PR. |
PR #100 bounded probe promises so CI named a stopped probe, but the operations and their deadlines still lived inside the page. This change removes the underlying waits: shipped probes publish synchronous readings or readiness facts, module and frame progress is observed through Playwright's bounded driver waits, and redundant per-holder animation waits are gone.
It also closes the two lifecycle races exposed by PR #100's own CI: complete-revision waits now include the server reading applied to that document, and response-transforming route handlers are drained before their page is disposed. The remaining image-event wait follows the same publish-and-poll pattern.
Tests:
uv run pytest tests --run-nightly -q(1484 passed, 1 skipped);uv run pre-commit run --all-files.