Repository navigation
Recheck margin anchors and quarantine the unresolved gallery failure - #1506
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
The gallery test still reads the returned Accept and Reject controls before the undo response has been applied. sending waits for the request and its reply, but the 1200px case fails at bg-insert after that wait: the Accept button is absent. Wait for the undo's application (data-lf-applied, or the harness's told reading) before checking those controls. The pin geometry case also needs that boundary before comparing its restored positions.
|
@leaf-agent The current CI run fails
|
A rejected insertion leaves no visible slot, so its Undo contribution moves to the containing passage. Find the control at that current row and settle scheduled margin layout before reading restored controls after undo. The gallery keeps checking that Accept and Reject return across widths.
leaf-agent
left a comment
There was a problem hiding this comment.
The new Undo lookup can still return a control inside a withheld margin row. When the browser stops applying anchor-name to bg-insert-line, the margin layout parks that row; _unfold only opens rows marked data-lf-folded, so this helper cannot make the Undo reachable. #1508 records that failure under load, including the missing Accept control after Undo. The five affected cases passed locally, but this change has not established that the reported gallery failure is fixed. The row needs to become reachable in that state before this PR can claim to resolve it.
|
I pushed A loaded 18-copy run reproduced the failure once. After Undo, Accept and Reject existed in the DOM under |
|
@leaf-agent why aren't you merging this yourself? |
|
I should merge this myself once the fix is verified. I have not merged #1506 because its current head ( |
|
The main run at |
The [failed main run](https://github.com/max-sixty/leaf/actions/runs/36914452215) reported typed draft words disappearing in `test_a_response_draft_yields_focus_when_the_panel_leaves_no_usable_room[390]`. The test moved to Threads search with Playwright's `focus()`, which changes focus without a user press; Leaf then hid the background composer and the words guard correctly rejected that transition. Use `click()` to exercise the real search gesture and record the press that puts the draft away while the test continues to verify its restoration. The 390px case failed in all 18 concurrent copies before the change and passed in all 18 after it. Both 390px and 450px variants passed locally. The separate gallery margin failure is already tracked on #1506. Co-authored-by: leaf-agent <[email protected]>
|
Main CI run 36945384717 hit the same gallery Undo failure: |
Tests that pin accidental restrictions can teach future agents to preserve them. This applies the user's 23 accepted scopes from a deep audit of the suite, removing or narrowing those assertions while retaining useful behavioral guarantees. Production behavior is unchanged. The changes release fixed margin capacities, layout and timing policies, truncation rules, description-only artifact identity, and refusals of otherwise valid content. The margin journeys now prove complete ordered Page Map access and actual spill reachability without requiring six inline entries or a fixed number of fixture peers. Tests still hold invalid-input safety, rendering readiness, meaningful labels, layout stability, optimistic actions, and final-answer semantics. Review restored useful assertions where the original proposals went too far, including declared-language validation, passage ownership/readiness, and filename layout geometry. Five proposals were kept; the image-difference item was left to its existing owner. Validation before integrating main: 1,471 everyday Python tests, seven affected margin browser cases, and independent code and desktop/phone review. On the integrated tree, all-file pre-commit, 190 runtime tests, the semantic-progress test, and independent integration review pass. The margin rerun passes eight cases and reproduces the gallery's hidden Undo defect at 700px before this PR's changed assertions; the existing [investigation](#1508) and [repair owner](#1506) cover it. CI runs the landing gates and changed nightly cases on the integrated tree. The first integrated CI attempt reports 1,545 passed, 3 skipped, and one failure in the same gallery Undo journey at 1440px, before the changed Page Map assertions. The automated second attempt also fails that journey, at 700px with an invisible Undo control. The automated reviewer approved the exact head. The existing reachability repair remains with its owner, and this PR retains the test that exposes it. The user requested merging these reviewed test changes with that pre-existing CI failure outstanding. > _This was written by Codex on behalf of max-sixty_
leaf-agent
left a comment
There was a problem hiding this comment.
The xfail marker covers the draft save, reload, and Page Map reaction checks below the suggestion loop. When the known Undo or Accept failure occurs, pytest stops the whole case and reports an expected failure, so a regression in those other gallery actions can go undetected at that width. Keep the expected-failure marker on a suggestion-only case and run the remaining gallery actions in an unmarked case.
The suggestion Undo expected failure now ends after its own assertions. The draft save, reload, and Page Map reaction journey runs as a separate unmarked four-width test, so those behaviors remain checked when suggestion geometry fails.
…1901) A decided suggestion could keep showing its retired words: the slot carried `data-lf-retired`, the `state.css` rule applied, and Chromium still computed `display: inline`. The style was stale. The operation that left it stale was a forced style read inside a hidden tab panel, made by `bounds.js` from a MutationObserver. ## Cause On every content change of a bounded block (`data-lf-bound`), `hold.sync` found the block's scroller by calling `getComputedStyle` on every box inside it (`scrollerOf`). The feature gallery's "Page & layout" tab holds bounded logs, and an inactive tab panel is `hidden="until-found"`, which is `content-visibility: hidden`. Each read forced Chromium to style that skipped subtree. A Chrome invalidation-tracking trace of a failing run shows the sequence: - a row is added to a log in the hidden panel, and `:has()` invalidation marks `#bg-gallery-tabs` for a subtree restyle and `main` for a local one; - in the same task, `declaresBound` reads style inside the panel, which forces a display-lock style update (1011 such reads in a failing run, against 1 in a passing one); - that update restyles neither `main` nor `#bg-gallery-tabs` and clears the dirty bits above them, so `#bg-gallery-tabs` stays dirty with nothing pointing at it; - every later write under it is never restyled, including the reject's `data-lf-retired` on `#bg-insert lf-new`. `#bg-gallery-tabs` is never resolved again for the rest of the run. The forced pass orphaning a dirty ancestor is a Chromium defect. I could not reduce it to a page without Leaf. ## Fix - `bounds.js`: `sync` asks `skipped(bounded)` first, as geometry.js's other readers of skipped content do. A skipped block keeps the scroller it had, or stands as its own, and renews its size observation. The first delivery after the block is drawn syncs again, so an `end` log that grew while hidden opens on its newest entry. - `reach.js`: `paintReadingReach` and `paintSidewaysReach` check `unpainted` themselves. Review found that a bounded block arriving in a hidden panel registered as a reading region and had its downward cue painted at once, reading `overflow-y` and scroll extents in skipped content from the same MutationObserver. ## Evidence - Issue journey (`test_a_decision_undone_leaves_every_suggestion_pin_where_it_stood`), on macOS Chromium 153: at 0e52b1b it failed 25 of 32 copies, and 0 of 20 with the `bounds.js` change applied there. - Main stopped reproducing after #1880 removed a non-subject `:has()` rule (bisected over the 18 commits from 0e52b1b). That rule supplied the pending subtree invalidation. Adding a no-op rule of the same shape back to `chrome.css` (`.lf-zz-a:has(> .lf-zz-b) * {}`) fails 8 of 10 copies on main, and 0 of 20 with this change. - New test `test_logs_in_a_hidden_tab_open_on_their_newest_entries` grows one bounded log in a hidden tab, adds a second, and checks that neither has its style or scroll extents read while the tab is hidden, then that both open at their newest entry, twice. It fails without the `bounds.js` change, without the `reach.js` change, and without the renewed size observation. - The tests that exercise bounded blocks, reading regions, and reach cues (71 cases) pass, as does `npm run test:runtime`. `test_render_controls.py::test_each_sampled_focus_ring_is_shown_whole_in_its_surface` fails on current main without this change too. ## A more underlying fix? Unverified. Other runtime readers still force style or layout in hidden panels: `shownParts` for target paint (deliberate, per geometry.js's header), `readingPosture` in `recordRegions` and `scrollersSettled`, `margin-layout.js`'s `scrollFollows`, and `user-view.js`'s `seenRect`. With this change and the provoking `:has()` rule, the issue journey stopped failing (0 of 20), so none of them was seen to leave style stale. The run that would settle it is a journey that makes one of them read a hidden panel while an ancestor holds a pending `:has()` subtree invalidation. Its candidate fix is for those primitives to answer skipped content themselves (a last-seen scroller, an empty shown set) instead of each caller asking `skipped` first. History read: `notes/margin-stuck-style.md` (#1506, #1695, #1719), #1834 and #1880. Fixes #1868 > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
The gallery's insertion Reject/Undo can leave controls hidden even though their target is on screen. Two problems were reproduced on main: margin layout permanently cached an unavailable anchor by element identity, and the gallery's suggestion can retain stale style or zero-size geometry under load. Margin layout now reads anchor availability on each pass, so lifting an author's anchor scope restores the existing row. The gallery tests also follow Undo to its current row and wait for admitted gestures and scheduled layout.
The initiating gallery style/geometry failure remains unresolved. The user invoked
/fix-ci, whose documented fallback permits a reasonedxfailfor a stuck failure verified on main. The four-width suggestion Reject/Undo journey continues to run withstrict=False, limited to assertion and Playwright timeout failures; setup exceptions remain red. Draft save, reload, and Page Map reaction checks run in a separate unmarked four-width case.notes/margin-stuck-style.mdretains the reproduction and evidence, including failure without test watchers and the limits of the browser-version comparison. Refs #1505 and #1508.The scope-restoration regression fails before the runtime change and passes afterward. Four related browser cases pass; a resting-page probe found no spontaneous layout loop over 30 frames. Fresh gallery runs reproduced the invisible insertion Undo at 1200px and 700px and later XPASSed, confirming the intermittent failure remains exercised. All four unmarked draft and Page Map cases, 190 runtime tests, and pre-commit pass. A served startup comparison loaded 202 requests in both arms and transferred 3,956,786 versus 3,956,589 encoded bytes by presentation, with no added requests or bytes.