Skip to content

Stabilize nightly browser tests and reply version holds - #161

Merged
max-sixty merged 11 commits into
mainfrom
codex/fix-nightly-main
Aug 31, 2026
Merged

max-sixty merged 11 commits into
mainfrom
codex/fix-nightly-main

Conversation

@max-sixty

@max-sixty max-sixty commented Aug 31, 2026 •

Copy link
Copy Markdown
Owner

Nightly browser coverage had drifted from the current responsive layout, panel, native-popover, page-map, and inline-thread behavior. This updates those journeys to observe the runtime's settled state and folds in the general rendered-frame wait used by keyboard scope walks.

Review also exposed a runtime issue behind the failures. An accepted anchored comment now opens its inline thread only when that send still owns the typing landing, so a later reply gesture keeps its focus and draft. An untouched reply box that Leaf merely opened and focused no longer blocks a live version, while any actual reply draft—including one the reader cleared back to empty—still holds the version.

The demo and public example previews were regenerated with their owning scripts. The complete local gate passes: 1,574 tests under uv run pytest --run-nightly tests, followed by every pre-commit hook.

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.

Reviewed at 0b8925e. Thirteen of the sixteen failures on 834e68c are addressed and everything the diff touches passes on the merged tree — I ran it: anchors ×4, aim ×3, margin ×3, drafts, options, pages, controls ×3, and test_demo_recording_drives_the_browser_journey. Three findings, one of them the reason I'm commenting rather than approving.

The seven "release the inline reply" edits are one runtime decision, written down only in test helpers. I probed the state they walk out of: immediately after a comment posts, document.activeElement is an empty TEXTAREA carrying data-lf-offer, inside the inline thread the runtime opened by itself.

PROBE: {'active': 'TEXTAREA.lf-ui', 'offer': True, 'value': '',
        'previewOpen': True, 'previewThread': True}

midComposition() in skills/leaf/assets/leaf.js returns true for exactly that shape — active.value !== "" || active.hasAttribute("data-lf-offer") — and state-application.js's willActivate gate reads !midComposition() || activationIsForced(). So on the live root, posting a comment now stops the page following new revisions until the reader closes the thread, with nothing typed and nothing on screen saying so. That is the failure composing/surface.js already records in its own words: "leaving an element anchor set, which midComposition() reads, so the page quietly stopped following new versions."

Six of the sixteen nightly failures were that one fact — anchors ×4 and aim ×2, the latter reading Actual value: v1 ▾ where the test expects v2 — and leave_new_thread plus the six open-coded copies of it are the same workaround seven times. That is a lot of weight for a rule whose only statement is a helper docstring saying a live page "may" follow its next revision. midComposition's own comment justifies the data-lf-offer case as "deleting everything is still an edit", which is not what an untouched auto-focused box is. Either the hold is intended, in which case it belongs beside midComposition and the four anchors tests' "The page follows it" comments want rewording; or the fix is that an opened-but-never-typed-in reply doesn't count as composition, and one runtime change replaces all seven. From here it reads like the second, but it turns on what the inline thread is supposed to mean, which is yours to say.

Two of the new waits poll for the assertion behind them. test_a_specimen_holds_a_wide_exhibit_inside_the_column waits for scrollWidth === clientWidth and then asserts document == column on those same two numbers, so the assertion the docstring exists for can't go red any more — a specimen that widens the document now produces a 30s wait_for_function timeout instead of "the exhibit widened the specimen instead of scrolling inside it". test_the_shipped_long_thread_opens_beside_its_source_in_the_right_margin is the same shape narrower: at height 480 the wait guarantees bottom <= 473 and the assertion behind it is bottom <= 472.5, so half a pixel of the claim survives. Both tests pass on this tree with the new wait deleted, and neither has failed in the last three nightly runs — so these are hardening, and worth waiting on a fact of the resize that the assertion doesn't restate.

Overlap with three open PRs. #157 rewrites the same two page-map keyline assertions, with a shared helper that also derives the address span (1 vs 1–n) instead of hardcoding, and keeps the row's page-map items word asserted; #155 fixes the same ring-walk focus race generally rather than special-casing scope == "the versions menu" and key == "v"; #156 changes the same inputs_sha256 line (inline note there). Whichever way you go, three of these want closing as duplicates.

Still red on this head: test_render_drafts::test_a_held_comment_send_leaves_a_later_reply_box_focused, test_render_drafts::test_a_comment_hidden_by_narrowing_lands_in_its_reply_box, and test_render_options_settled::test_settled_options_collapse_without_going_out_of_reach.

How I checked
  • Probe: opened SAID_PAGE on the live root, dragged the column heading, posted the comment, then read document.activeElement — the output quoted above.
  • midComposition → skills/leaf/assets/leaf.js (const midComposition = () =>); the activation gate → skills/leaf/assets/runtime/state-application.js (const willActivate =); the prior bug → skills/leaf/assets/runtime/composing/surface.js, the comment above function activateVisual.
  • Reverted each change on its own and re-ran the owning test: test_workspaces_replace_each_other_instead_of_stacking (both widths), test_a_specimen_holds_a_wide_exhibit_inside_the_column, test_coarse_pointer_resize_reach_stays_reachable_without_trapping_scroll, and both ring sweeps for theme.css line 686 — all green without the change.
  • inputs_sha256: recomputed digest(capture_input_files()) on the merged tree at both a48ed44 and 0b8925e; c51a8720… matches. On 834e68c it is 77e6dd79… against a checked-in 0836f336…, which is the failure in the nightly log.
  • Re-ran the nine failures this PR doesn't name; six now pass, three listed above still fail.
  • Failure lists from runs 33350774450, 33347270702, 33347154927.

Comment thread tests/test_render_controls.py Resolved
Comment thread skills/leaf/packages/default/theme.css Resolved
Comment thread docs/example-previews.json Resolved
@leaf-agent

Copy link
Copy Markdown
Collaborator

ci on main is red at run 33354315480 (05b94a1) with 15 nightly failures. This PR now contains 05b94a1, and at 5efdaf9 it closes all 15 — including the three my earlier review left listed as still red at 0b8925e. No ci-fix PR from me; this one is the fix.

I measured both sides rather than reading across from the review. On main at 05b94a1 all 15 node ids fail (15 failed in 165.74s, default parallelism), which together with the CI run makes them deterministic rather than contention. On 5efdaf9 the same 15 pass (15 passed in 43.60s), taking test_a_comment_hidden_by_narrowing_lands_in_its_reply_box under its new name test_a_comment_hidden_by_narrowing_opens_its_inline_reply.

The three the review named have all turned: test_a_held_comment_send_leaves_a_later_reply_box_focused, the renamed narrowing test, and test_settled_options_collapse_without_going_out_of_reach. And the first finding went the runtime way — midComposition now asks replyBoxHasDraft before counting a data-lf-offer textarea, so a reply the runtime merely opened and focused no longer stops a live page following, and leave_new_thread and its open-coded copies are gone from tests/.

The 15 node ids, and how I ran them
tests/test_product_page.py::test_demo_recording_drives_the_browser_journey
tests/test_render_aim.py::test_a_declared_box_takes_its_comment_on_every_type_that_carries_an_id
tests/test_render_aim.py::test_a_declared_flowchart_node_keeps_its_comment_across_renderings
tests/test_render_aim.py::test_design_mode_comments_on_what_a_press_lands_on_and_nothing_else
tests/test_render_anchors.py::test_a_widgets_attribute_takes_a_comment_like_any_other_passage
tests/test_render_anchors.py::test_a_widgets_label_takes_a_comment_inside_the_control_it_labels
tests/test_render_anchors.py::test_an_ambiguous_revised_passage_detaches_instead_of_guessing
tests/test_render_anchors.py::test_one_neighbour_is_not_enough_to_identify_a_revised_comment
tests/test_render_drafts.py::test_a_comment_hidden_by_narrowing_lands_in_its_reply_box
tests/test_render_drafts.py::test_a_held_comment_send_leaves_a_later_reply_box_focused
tests/test_render_drafts.py::test_page_round_trip
tests/test_render_margin.py::test_g_addresses_the_page_map_prefix_in_its_announced_order
tests/test_render_margin.py::test_one_margin_item_owns_a_targets_controls_information_and_more_actions
tests/test_render_options_settled.py::test_settled_options_collapse_without_going_out_of_reach
tests/test_site.py::test_the_public_catalog_is_a_visual_index_of_full_page_routes

Both runs were uv run pytest <the 15 ids> --run-nightly -q, one in the main checkout at 05b94a1 and one in a worktree at 5efdaf9.

@leaf-agent

Copy link
Copy Markdown
Collaborator

One failure from run 33350774450 (834e68c) isn't among the 15 tracked above, and nothing on this thread accounts for it: tests/test_render_navigation.py::test_a_label_press_keeps_the_controls_keyboard_standing. It did not recur on 33354315480, and this PR doesn't touch that file — so it isn't yours to own, but the nightly can still come back red on it after this lands.

It predates the inline-thread change. I reproduced it on c0a5b65, the commit before 834e68c, with the identical message — so the inline conversation is not what broke it.

Measurement and the shape of the read

Same command in three checkouts, uv run pytest --run-nightly -n 4 --dist loadgroup over test_render_aim.py test_render_anchors.py test_render_drafts.py test_render_navigation.py test_render_options_settled.py test_site.py test_product_page.py:

tree result
c0a5b65 (before the inline-thread commit) 3 failed, 228 passed — label press, test_a_stale_cancel_cannot_settle_a_newer_durable_generation, and the preview digest
834e68c + a local fix for the inline-thread failures 1 failed, 230 passed — label press alone
5efdaf9 (this head) 232 passed

One sample each, and it passes at -n0 in all three, so the green row is not evidence of a fix — it is load-dependent. CI's own -n 2 caught it once in three runs.

The assertion is assert "unselect" in key_line(page), taken mid-drag while the mouse is still down. key_line is deliberately never retried and waits two requestAnimationFrames. But the selection reaches updateFab through scheduleSelectionUpdate, a setTimeout, and the repaint it causes coalesces to a frame of its own — so the chain is macrotask → rAF, and two frames don't order against a timer the machine has not run yet. That reading is inferred from the code rather than instrumented; what is measured is the table.

@max-sixty
max-sixty merged commit b4a5aeb into main Aug 31, 2026
3 checks passed
@max-sixty
max-sixty deleted the codex/fix-nightly-main branch August 31, 2026 04:53
max-sixty added a commit that referenced this pull request Aug 31, 2026
The complete nightly suite on `main` caught a stale public
example-preview input digest after the preview-handoff and runtime
changes were combined with #161. This branch now includes the later main
updates from #163 as well, then regenerates through
`scripts/example-previews.py`; all nine preview images remain
byte-for-byte unchanged.

Validation on that merged tree: all 20 tests in `tests/test_site.py`
pass, followed by every pre-commit hook.

> _This was written by Codex on behalf of max-sixty_
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