Repository navigation
Fix two load-sensitive tests: release leases by unlocking, and give the shift watch a pre-scroll pose - #1790
Merged
Merged
Conversation
…ted)" This reverts commit ea07613.
`test_a_user_move_no_carrier_will_pick_up_messages_its_claude_code_session`
failed in loaded full-file runs at `auth, user = messages("s1")`: the
comment after the "watcher" let go of its lease messaged nobody, because
`wait_is_live` still read the lease as held.
The flock belongs to the open file, which every copy of the descriptor
shares. The test holds the wait lease in the same process as the page
server, and the comment posted under the lease starts a thread-title
`claude` subprocess about 6 ms before the test closes the lease. On macOS
CPython forks for that spawn, so the child holds a copy of the lease
descriptor until its exec closes it. On a busy machine the child can wait
that long, and `lease.close()` leaves the lock held. Holding a forked child
across the close reproduces the exact failure every time.
`release_lease` now unlocks before closing, which releases the open file
whatever copies remain. Any lease holder that spawns subprocesses had the
same window, e.g. a page server releasing its server lease while a title
subprocess is starting. Tests release their leases through
`release_lease` instead of closing the descriptor.
`test_a_released_lease_is_free_while_a_child_still_holds_its_descriptor`
lends the descriptor to a live child and fails with a close-only release.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`test_native_anchor_scroll_retains_local_motion_proof[*-]` failed on CI about once in 200 copies with "textarea#field moved without input", and never on macOS. A traced CI run showed the motion was the setup scroll, not the typing gesture the test is about. The page evaluated the setup scroll before its first frame. The watch's first pose then already had the anchor scrolled, with the anchored field still where Chrome had last placed it. Chrome moved the field one frame later and reported that move as a layout shift whose only source was the field. The watch credits a portal for following its anchor's scroller only from a pose that saw the anchor before the scroll, and there was none, so it found the field moved with no input, which was correct. The test now paints a frame before it scrolls. The watch's frame callback is registered at document start, ahead of any callback the page adds, so that frame gives the watch the pre-scroll pose, and the field's catch-up is credited as scroll. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…verted)" This reverts commit d93da96.
`flocked`, `page_locked` and the interaction log released their flock by closing the descriptor. A subprocess another thread starts in the meantime holds a copy of that descriptor until its exec, so the next taker could wait on that child. Each now unlocks before it closes, the same release `release_lease` uses. The control test starts its child through the `spawn` fixture. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 5, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 5, 2026
…ase its lease unlocked #1778 allowlisted answer_ready.wait(10) while this file was held; it now takes STATED_TIMEOUT and the allowlist goes. The state-wait test releases its waiter lease with release_lease, which #1790 made unlock before closing. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 5, 2026
#1790 made release_lease unlock before closing; a bare close() could leave the lock held while a forked subprocess kept the descriptor. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 5, 2026
#1790 made leases.release_lease unlock before it closes, because closing leaves the lock held while a forked child still holds the descriptor. test_a_presence_read_crossing_freshness_returns_to_the_current_lease still released its waiter lease with lease.close(); it now calls release_lease. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
pushed a commit
that referenced
this pull request
Oct 5, 2026
Five long browser journeys also checked things other tests own, such as colours, focus rings and panel filters, so deliberate UI changes kept breaking them. The most-edited, `test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline`, was edited by 30 commits since Sep 14, each following an intended UI change; none caught a regression. Each test now asserts only the behaviour it owns. ## Changes - **`test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline`:** a thread the diff seats inline is the core thread. From the diff the user reaches it with `t` or its comment note, shares one draft with the panel, reacts, resolves and reopens it, and news updates both views in place. Palette, Send faces and ring band are left to `test_render_thread_snapshots`'s inline case; panel filter and go-to-threads focus to the Threads tests. The dark/light parameter goes. - **`test_real_page_passages_can_be_quoted`:** drags once per passage shape and once per adjacent pair of shapes, instead of 2n−1 drags per page (998 → 252). All four pages stay. - **`test_a_failed_thread_surface_returns_its_threads_to_core_fallback`:** drops the `begin` and `end` cases, which reach the same `catch` in `surfaces.js` as `outletFor`, along with the six-reaction count. Main's keyboard-activation case from #1705 is kept. - **`test_the_feature_gallery_exercises_the_injected_core_surfaces`:** checks that each core surface shows the gallery's own content. Two checks with no other owner move: pressing `w` behind the image viewer goes to `test_a_pasted_image_survives_…`, and the Page Map's close cross to `test_the_g_chord_opens_an_empty_page_map`. - **`test_a_thread_can_be_answered_in_the_margin_without_opening_threads`:** drops the geometry, first-frame, font and border checks other tests own, and the 1920 width. - **Thread snapshots:** a new `inline-dark` case in `dev/leaf_dev/thread_snapshots.py` takes over the dark appearance check the lifecycle test dropped. It has reviewed images for both the Mac and Linux profiles, and `leaf-assets.json` is moved to pin them. `SnapshotRun.capture` now records a missing baseline image as a failure and keeps going, as it already did for missing geometry, so a new case's first run captures every stage. - **`test_a_margin_card_clears_its_row_only_where_that_costs_no_width`:** new. It holds the placement checks main added to the margin-answer test in #1781, at 1920 and 2400, while that test stays at one width. - `test_render_startup.py`'s lease test calls `release_lease(lease)`, which #1790 made unlock before closing. ## Validation - A dark-only background planted on the diff's seated thread fails `inline-dark` at all six stages, while the light `inline` case passes. Each test fails on a planted fault in the code it protects: - the inline seat rebuilding its view on every render (diff lifecycle) - `lf-metric` words not counting as page words (quoting) - a failed widget not pushing its empty plan (failed surface) - the gallery log losing its resolve event (gallery surfaces) - the marker opening its card while Threads is open (margin answer) Local times under heavy load: - diff lifecycle: 31 s → 12 s - quoting: 154 s → 80 s - failed surface: 174 s → 125 s - gallery surfaces: unchanged at 64 s - margin answer: 25 s → 6 s > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Two tests failed under load and passed alone. Each failure traced to a definite cause, and neither fix is a retry or a longer wait.
test_a_user_move_no_carrier_will_pick_up_messages_its_claude_code_sessionThis test failed four times in loaded local runs, each time at
auth, user = messages("s1")withTypeError: cannot unpack non-iterable NoneType. The comment posted after the "watcher" let go of its lease reached no one, becausewait_is_livestill read the lease as held.A flock belongs to the open file, and every copy of the descriptor shares it. The test holds the wait lease in the same process that runs the page server. The comment posted under the lease starts a thread-title
claudesubprocess about 6 ms before the test closes the lease. On macOS, CPython forks to start that subprocess, so the child holds a copy of the lease descriptor until its exec closes it.lease.close()closed only the parent's copy. If the forked child is held across the close, the test fails every time with the same error. The presence cache was not involved: the nudge decision reads presence fresh.The fix is at the primitive.
release_leasenow unlocks before it closes, which releases the open file whatever copies remain. Tests release their leases throughrelease_leaseinstead of closing the descriptor. Any process that holds a lease and starts subprocesses had the same window, for example a page server releasing its lease while a title subprocess is starting.flocked,page_lockedand the interaction log also unlock before they close. Those locks are blocking, so the window only delayed the next taker until the child's exec, and none of them gave a wrong answer.test_a_released_lease_is_free_while_a_child_still_holds_its_descriptorpasses a lease descriptor to a live child and checks that the released lease reads free. It fails whenrelease_leaseonly closes.test_native_anchor_scroll_retains_local_motion_proof[*-]This failed on attempt 1 of #1778, and in two other CI runs since #1705 rewrote it, with
textarea#field moved without input. It is unrelated to #1751's resize ownership: the resize branch never ran. A traced CI run showed that the motion came from the test's setup scroll, not from the typing gesture. The page scrolled before the watch's first frame, so the watch's first pose already showed the anchor scrolled while the anchored field had not moved yet. Chrome moved the field one frame later and reported that as a layout shift whose only source was the field. The watch credits a portal's catch-up to scrolling only from a pose taken before the scroll. It had no such pose, so it reported the move, which was correct.The test now paints a frame before it scrolls. The watch registers its frame callback at document start, ahead of any callback the page adds, so that frame gives the watch the pre-scroll pose. In an A/B on CI runners under the same load, the old order failed 2 of 648 copies and the fixed order failed 0 of 648. An earlier traced run had failed 2 of 432 copies.