Skip to content

Stop a persistent test server through its command - #3327

Merged
leaf-agent merged 1 commit into
mainfrom
fix/ci-39425875292-server-stop
Oct 20, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/ci-39425875292-server-stop

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

PR #3322's CI run passed test_server_run_persistent_declines_the_claim_a_harness_session_offers, then timed out for 120 seconds while its spawn fixture tried to retire the persistent server at teardown. The test starts a server whose stated lifetime requires an explicit stop, but it left that stop to the fixture's process-group signal. It now calls hosting.cmd_stop and waits for the server to exit, as the neighboring persistent-server tests do. The fixture still guards early failures.

The focused test passes after the change. The CI timeout was intermittent, so that local pass alone does not establish the cause; the change makes the test exercise the server's explicit-stop contract before teardown.

@leaf-agent
leaf-agent merged commit 8c30ec4 into main Oct 20, 2026
4 checks passed
@leaf-agent
leaf-agent deleted the fix/ci-39425875292-server-stop branch October 20, 2026 13:20
leaf-agent added a commit that referenced this pull request Oct 20, 2026
The [main CI
run](https://github.com/max-sixty/leaf/actions/runs/39411015460) failed
the aimed-press journey on a tab even though the press did not switch
tabs: positioning a comment copied the tab panel's stylesheet
`anchor-name` into its inline style, and the markup reading counted that
presentation detail as a page change. The reading now excludes anchor
names, as it already excluded generated margin-anchor names. It still
compares the tab's selected state, content, and other markup after the
press.

The focused tab case failed on main before this change and passes
afterward. This PR's CI passed that case but timed out while retiring a
persistent test server; [PR
#3327](#3327) addresses that
separate test teardown failure.

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 20, 2026
… a rendering turn ending before observer deliveries (#3346)

Two load-only flakes, each traced to its cause and fixed there.

**A persistent server stopped by a signal could hang at exit.** This is
the 120 s teardown timeout that #3327 worked around in
`test_server_run_persistent_declines_the_claim_a_harness_session_offers`
by stopping the server with `server stop`. The page subscription's
`weakref.finalize` (`_PageChanges.connect`, `file_changes.py`) ran at
interpreter exit by default. It closed the subscription while the row
publisher and the lifetime check, both daemon threads, still waited on
it. Each woke, found the subscription closed, and subscribed again,
which registered a new finalizer that `weakref`'s exit handler then ran
in turn. The loop ends only when the daemon threads fall behind
`weakref`'s exit handler; in CI it outlasted the fixture's 120 s wait. A
user who stops a foreground `leaf server run` with Ctrl-C hits the same
path; `server stop` never did, because `exit_serving` calls `os._exit`.

The finalizer now skips exit, since exit releases the native watches
anyway. `FileChanges.matches` no longer checks the stop flag. `close`
empties the roots `matches` compares, and with exit skipping the
finalizer, nothing closes a subscription its owner still hands out, so
the flag added nothing. The test now stops its server with Ctrl-C, as
its user would, so it exercises the path that hung.

On macOS, a persistent server sent SIGTERM after printing its URL hung
past 10 s in 11 of 30 trials, and sent Ctrl-C in 7 of 27. With the
change, none of 84 did (30 and 27 SIGTERMs, 27 Ctrl-Cs, at delays from 0
to 1.5 s). The CI hang was on Linux; the mechanism is in Python's exit
sequence rather than the platform watcher, so I expect the same fix
there but did not run it on Linux.

**A rendering turn ended before its IntersectionObserver deliveries.**
review-queue's and rust-sort's render-gate resize journeys failed now
and then under load with a 32×32 keyboard stop present on one pass and
missing on the other. The stop is the Copy control of a code block far
down the page, which leaves layout when the runtime's near-window
IntersectionObserver (`anchorView`, `css-anchors.js`) says its block is
more than a screen away. The driver's `requestFrame` marked a turn
presented from a task queued in its animation-frame callback, and Chrome
and Firefox deliver that update's IntersectionObserver callbacks in a
later task. So `one_frame`, and `rendered` after it, could return before
the callback that takes the control out of layout.

`requestFrame` now starts an IntersectionObserver in the animation frame
and marks the turn from a task its first notice queues, after every
observer delivery of that update. `one_frame`'s docstring already
promised this ("its observer deliveries included"). It applies to `page
check --render` as well as the suite. The new test checks the order
directly: it failed 5 of 5 runs before the change and passed 5 of 5
after. review-queue's journey at 4× CPU throttling failed 3 of 14 runs
before and passed 20 of 20 after; rust-sort's passed 10 of 10 after,
though it had also passed 6 of 6 before at that throttle.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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.

1 participant