Skip to content

Fix nightly browser and site regressions - #620

Merged
max-sixty merged 2 commits into
mainfrom
codex/ideas-page-full-height
Sep 12, 2026
Merged

max-sixty merged 2 commits into
mainfrom
codex/ideas-page-full-height

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • distinguish the document scrollport from nested content clips so below-fold words remain readable by the render gate
  • compose the site-context package into published examples and keep its wide workspace header compact across platform font metrics
  • update stale browser-suite fixtures for current Live Progress, visual-review navigation, version stamping, data-only pages, and resize confirmation

Validation

  • uv run pytest tests --run-nightly -v — 2529 passed; the affected startup-timeout node then passed six consecutive focused runs
  • focused causal slice — 40 passed
  • Live Progress published-workspace allocation — passed locally at 1200×900
  • resize confirmation selection — passed twice in the reviewer’s isolated -n2 reproduction after removing the confirming-page timeout override
  • uv run pre-commit run --files ...
  • npm run typecheck --prefix worker
  • npm test --prefix worker — 60 passed
  • npx wrangler deploy --dry-run --outdir ../.tmp/worker-deploy
  • scripts/verify-site-local.sh

This was written by Codex on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_an_ordinary_error_survives_an_incomplete_resize_confirmation fails under the suite's default parallelism. Same command, same machine, run twice each:

uv run pytest tests/test_render_gate.py --run-nightly -n2 -k resize
  7d9ad945 (merge base) — 6 passed
  11a1b247 (this branch) — 1 failed, 5 passed

It passes alone under -n0, which is why a focused run doesn't see it.

The cause is that the confirming pages keep page.set_default_timeout(500) while the abort target moves. Aborting **/leaf.js starved the runtime itself, so "the runtime never injected its banner" was the outcome whether or not the page got there inside 500ms. Aborting **/_leaf/render-checks/index.js instead requires the page to reach the probe load first — and start_with_pre_upgrade_proof runs ahead of it, whose wait_for_selector("body > main") and the theme.css wait_for_function both run on the page default. Under load those exceed 500ms, _render_scheme takes its except PlaywrightTimeout branch, and the gate reports exactly the failure the assertion stopped expecting:

['[light] console: ordinary error from first attempt (at 1200x900)',
 '[light] the runtime never injected its banner — ...error: ResizeObserver loop completed with undelivered notifications. (the confirming render attempt did not complete)']

Dropping the 500ms default resolves it, and the aborted probe module already makes the confirming attempt fail immediately, so the tight deadline has nothing left to buy — _load_probes raises as soon as the import rejects, and that same probe_failure return is what reports the attempt incomplete. With that one line removed the selection is 6 passed under -n2, twice.

Separately, and not this branch's: test_published_workspaces_keep_their_allocation_under_site_context[live-progress] reproduces red at the merge base too on Linux — lf-monitor settles on data-lf-reading-posture="flow" rather than bounded at 1200×900. The compact-header rule this PR adds is aimed at that allocation, so it may be worth knowing it doesn't clear the case on CI's fonts. The rest of tests/test_site.py is green on the branch, including the new vendoring check.

Comment thread tests/test_render_gate.py Resolved
@max-sixty
max-sixty merged commit d1319e8 into main Sep 12, 2026
7 checks passed
@max-sixty
max-sixty deleted the codex/ideas-page-full-height branch September 12, 2026 06:32
max-sixty added a commit that referenced this pull request Sep 12, 2026
## Summary

- distinguish the document scrollport from nested content clips so
below-fold words remain readable by the render gate
- compose the site-context package into published examples and keep its
wide workspace header compact across platform font metrics
- update stale browser-suite fixtures for current Live Progress,
visual-review navigation, version stamping, data-only pages, and resize
confirmation

## Validation

- `uv run pytest tests --run-nightly -v` — 2529 passed; the affected
startup-timeout node then passed six consecutive focused runs
- focused causal slice — 40 passed
- Live Progress published-workspace allocation — passed locally at
1200×900
- resize confirmation selection — passed twice in the reviewer’s
isolated `-n2` reproduction after removing the confirming-page timeout
override
- `uv run pre-commit run --files ...`
- `npm run typecheck --prefix worker`
- `npm test --prefix worker` — 60 passed
- `npx wrangler deploy --dry-run --outdir ../.tmp/worker-deploy`
- `scripts/verify-site-local.sh`

> _This was written by Codex on behalf of max-sixty_
max-sixty pushed a commit that referenced this pull request Sep 12, 2026
… it (#630)

Two repairs to the render gate's page server and its reporting, found
while diagnosing `test_page_fixture_renders[corpus]` in the
complete-suite run on `ca9bf116` ([run
34675185881](https://github.com/max-sixty/leaf/actions/runs/34675185881)).
**Neither fixes that case** — the measurement is below, and the corpus
sweep is still failing on `main`. What this does fix is a server that
drops requests, and a gate reading that named the wrong wait for the
drop when one reaches it.

## A request written onto a connection the server closed a second ago is
dropped

`TemporaryPageServer.start()` put a one-second read deadline on every
connection. It was there for a real reason: a socket that never sends a
request line otherwise parks the join `server_close()` does over
non-daemon request threads. But a read deadline cannot tell that socket
from one a browser opened ahead of need and is about to write a real
request onto — Chromium preconnects, so both exist here — and a request
written onto a connection the server has already closed is dropped with
no response, no console entry, and no error.

Deterministic, against the server as it stood. Open a connection, wait,
then send:

```
idle 0.2s -> b'HTTP/1.0 403 Forbidden\r\n'    (answered)
idle 1.2s -> b''                              (dropped)
idle 2.5s -> b''                              (dropped)
```

`LeafHTTPServer` now records the connections it is holding and closes
their reading half in `server_close()`, which bounds that join directly
rather than by guessing how long a silence lasts. Only the reading half:
a request already being served still gets its answer, which
`test_temporary_server_close_waits_for_active_request` pins and which is
what ruled out closing both. With no deadline left, a socket opened
ahead of its request is answered whenever it speaks.

This reaches a reader, not only the suite: `render_gate/preview.py`
serves through the same server, so `version check --render` runs on it.

## The gate named the one thing that had gone right

`_render_scheme` reported a timeout anywhere in
`start_with_pre_upgrade_proof` — `goto`, `body > main`, the theme
stylesheet, and the load event — as `the runtime never injected its
banner`. In the corpus failure the runtime had started and its banner
was on the page: what had not happened was the load event, because one
module request was still open. Each wait now says which arrival it gave
up on and what the page was still asking for:

```
[dark] pre-upgrade proof failed: the document never reached load; still requesting /runtime/layer-client.js
```

A timeout raised out of the proof is a `RuntimeError` now, which lands
in a different arm of `_render_scheme` than the one it used to — and
that arm returned the message on its own, so the console entries and `>=
400` statuses the page had collected were dropped. A document refused
with 403 said which wait stopped and nothing about why. It carries those
explanations now, the way the two waits either side of it already do,
and the entry the proof holds itself is left out of the requests the
message names: `/leaf.js` is open at every wait before the release
because this gate chose to hold it, not because the page is waiting for
it.

Nothing on `main` asserted the old string any longer — #620 moved the
resize case onto the probe-module failure, which was the last assertion
reading it — so the branch that reports a real hang had no test at all.
It has one now, and that reading is what turned this failure from
unattributable into a named file.

## What this does not fix

`test_page_fixture_renders[corpus]` still fails, at a rate that makes
`main`'s nightly a coin toss rather than a rare red. Interleaved on one
idle Linux box, alternating `d1319e88` and this branch, one run each per
pair:

```
uv run pytest --run-nightly -q -n0 -p no:randomly \
  "tests/test_render_gate.py::test_page_fixture_renders[corpus]"

d1319e8      2 failed / 7
this branch   3 failed / 7
```

So the dropped-connection mechanism above, real as it is, is not what
the corpus sweep is hitting — and a block-at-a-time comparison would
have said otherwise, because the rate on this box drifts from 0 in 6 to
4 in 6 across an hour. #629 carries what is left: the failure now names
its wait, sometimes a module still in flight and sometimes nothing at
all, which are two different endings and neither is explained.

## Verification

On Linux with the installed Chrome, at `e72d5fc6`:

- `uv run pytest tests` — 1029 passed; four failures this sandbox owns
rather than the branch (`umask`, the `::` wildcard with no IPv6 route,
and two on a read-only `/tmp`), all four red at `4aa102e2` under the
same command.
- `uv run pytest tests/test_render_gate.py --run-nightly -n2` — 101
passed, and `test_page_fixture_renders[corpus]` failing as #629
describes.
- `uv run pytest tests/test_interact_server.py -n0` — 98 passed, the
`::` wildcard case aside.
- `uv run pre-commit run --files ...` on the four files.
- Bug-back, each new test against the source reverted: the connection
opened before its request reads back `b''`, and the held module raises
the bare `TimeoutError` the caller used to call a missing banner.

---------

Co-authored-by: leaf-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants