Skip to content

test: rewrite the layer record in one step under the live server in test_a_start_serves_the_page_with_its_own_leaf - #6668

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-6665
Nov 21, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-6665

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

test_a_start_serves_the_page_with_its_own_leaf deleted layer.json and then wrote its replacement while the replaced server was still running. The server's row publisher refreshes about every two seconds. When a refresh landed inside that gap, read_page_registry's compose read the layer through load_registry, then found no record and failed assert record is not None. A failed refresh exits the server (RowPublisher.run), so running_server found no server at line 1028. LAYER.write already replaces the file atomically, the way page init writes it, so the test now rewrites the record without deleting it first. The test still covers what it set out to: a server over a layer selecting an unknown package. An absent package is reported as an activation error and does not crash the server.

Evidence, all from macOS ci dispatches of this test alone (--workers 3 --load 2):

  • Before: on a probe branch at the base, 3 of 36 copies failed (run 44925710678). Each failing server's own log ends in the compose assertion traceback above. An earlier probe also failed 2 of 36 with the lease released and the port refusing connections (run 44924777467).
  • After: this branch passed 54 of 54 (run 44926717612).

The test came in with #5977.

Left as is

compose reads the layer record twice, so a record deleted between those reads crashes the serving process. In Leaf itself the record changes only through page init, which restarts the server and replaces the file atomically (served_state/reading.py, held_page_reading). That makes this window reachable only by deleting layer.json by hand under a live server. This PR changes only the test.

Closes #6665 — automated triage

test_a_start_serves_the_page_with_its_own_leaf deleted layer.json before
writing its replacement. The replaced server's row publisher could refresh
inside that gap: read_page_registry's compose read the layer through
load_registry, then found no record and failed its assertion, and the
publisher's failure exits the server, so running_server found none. A macOS
dispatch at the base failed 3 of 36 copies this way, with that traceback in
the server's own log. LAYER.write already replaces the file atomically, as
page init writes it, so the test now rewrites the record without the gap.

Closes #6665
@leaf-agent
leaf-agent merged commit 65c835b into main Nov 21, 2026
11 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6665 branch November 21, 2026 17:22
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.

test_a_start_serves_the_page_with_its_own_leaf: running_server finds no server mid-test, intermittently on macOS

1 participant