Repository navigation
Make suggestion decisions immediate and routes exact - #345
Conversation
# Conflicts: # tests/test_render_margin.py
leaf-agent
left a comment
There was a problem hiding this comment.
Two things, both inline.
The lifecycle itself traces cleanly. I walked the refusal path — drainOutbox sets entry.rejected and runs reconcileKnownState before entry.resolve, so renderState has already cleared data-lf-state and cancelled the fold animation by the time the continuation paints Failed/Retry/Cancel — and the already-undone-read path, where stateProjection drops the entry once its attempt is in receipts and actionStands sends the continuation to the re-render rather than a second settle. The exact-route change reads right too: pageMapEntries is already filtered to entries with a target and clusterButtons filters to visible, non-disabled controls, so enumerating the cluster cannot mint a hint that presses nothing. Ran the touched browser tests here — test_render_widgets.py -k "suggestion or decision or optimistic or accept_all or decided_change" 15 passed, and the g-hint plus Button-gallery tests in test_render_margin.py 9 passed.
The pending-Undo press is the one worth a look: it sits on the path this PR claims, and its fix site is outside the diff, so say the word and I'll push it.
leaf-agent
left a comment
There was a problem hiding this comment.
Both earlier threads close properly — the pending Undo now answers with the same sentence withdraw() uses, and the guard sits ahead of undoableAction, so the wrong reading is no longer reachable. Ran the touched browser tests here: test_render_widgets.py -k "second_press or optimistic_decision or refused_decision or accepting_a_suggestion or decided_change or accept_all" 6 passed, test_render_margin.py -k "g_hints or button_gallery or margin_target" 5 passed, test_render_projection.py -k "escape_lets_go or done_press or spent_request or recordless" 5 passed.
One inline, on the guidance. The other is the success path's assistive reading: notice() was also the announce() call, so with it gone nothing states the decision to a listening reader — #voice gives up "proposed deletion"/"proposed insertion" on settle, and no live region carries the lf-old → lf-new swap. A keyboard press is covered, since #replaceControls sees held and hands focus to Undo, whose aria-label names the outcome. A pointer press is covered only where the browser focuses the button it activated: held is computed from document.activeElement, and Safari and Firefox on macOS leave that on <body> after a click, so there the decision lands silent. Not asking for the notice back — flagging that "the resulting content and Undo control are durable confirmation" is a sighted reading, and the listening one may still be owed a sentence.
|
Addressed in e45b6b2: successful Accept and Reject delivery still has no visible notice, but now announces the decision through the live region. A browser test invokes the pointer path while focus remains on
|
leaf-agent
left a comment
There was a problem hiding this comment.
One inline, on the announcement itself. The rest of the increment reads right: button.click() from inside the page leaves focus on body, so the new test pins exactly the pointer case the last pass named, and the restored shared rule with the suggestion scoped under it says both things without re-claiming the sweep.
Separately, deleting test_a_wait_the_reader_would_notice_says_so_and_a_short_one_says_nothing leaves the delayed busy paint (lf-runtime-4f3c2a8d-working, chrome.css — 140ms after a 200ms delay, keyed on aria-busy rather than a tag) with no test measuring it, and lf-draft still paints under that rule. The suggestion is no longer the vehicle for it; nothing else took the reading over.
|
Addressed in cb0dddc: the delayed non-Button busy-paint regression now lives with
|
leaf-agent
left a comment
There was a problem hiding this comment.
One red on this head, in a module the PR gate never opens: uv run pytest tests skips the nightly test_render_* files, so test going green here says nothing about them and this one surfaces first on main, after it moves.
Accepting with a selection standing leaves the comment field open. test_the_comment_button_stands_on_no_control — "the press decided, it didn't compose" — finds .lf-composer visible for the full five seconds. It passes at 59d0aa31, the main this branch just merged.
Instrumented on SUGGESTION_PAGE at 930×900, the press closes the field and something reopens it. #lf-composer[data-lf-open] reads true at pointerdown and mousedown, false at mouseup and click, and true again by 600 ms — with the selection string unchanged throughout and no selectionchange in between. Focus lands where it should, on Undo accepting the suggested change: …, and data-lf-state is accept. What the reader gets is the change and a comment field still standing over it, its quote rewritten under them as the retired slot leaves the reading:
before Comment on “The camera survey found two dead zones. Refill every feeder each morning. Refill a feeder when its camera shows it half-empty.”
after Comment on “The camera survey found two dead zones. Refill a feeder when its camera shows it half-empty.”
Both ends of that are this PR's: the decision now paints between mousedown and mouseup rather than after the round trip, and #replaceControls moves focus in the same frame. I didn't isolate which one reopens the field, and the fix site is outside the diff — say the word and I'll trace it and push the repair.
The merge resolution in test_render_widgets.py is the right one: test_a_widget_naming_its_own_words_does_not_read_the_runtimes reads the announcement now, and both parametrized cases pass at this head. It was red at cb0dddc9; the merge is what closed it.
Pre-existing on main — not this PR
Four more nightly failures reproduce at 59d0aa31 with the PR absent, so they aren't this branch's to answer:
test_render_controls.py::test_the_composed_corpus_declares_every_control_row_archetype— the gallery's Play and Replay carry no archetypetest_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus—.interaction-gallery .interaction-control:focus-visiblenames no--lf-here-ringtest_render_navigation.py::test_the_feature_gallery_exercises_the_injected_core_surfaces— 12 asks rows against an expected 11test_render_options.py::test_a_selected_question_keeps_one_action_context_while_tab_reaches_its_field— −11.4px clearance against a 20px floor, identical on main and on this head. Geometry here is font-sensitive and I ran outsidescripts/linux-suite.sh, so read that number as local.
What I ran, and what else I looked at
test_render_widgets, test_render_outbox, test_render_drafts, test_render_projection, test_render_margin, test_render_navigation, and test_render_anchors at 54a2b221 with --run-nightly: 560 passed, and the only two failures are the gallery ask count above and the composer. Earlier, before the base merge, the full test_render_* set at cb0dddc9 plus the current base. Each failure was then bisected in its own worktree with its own environment — the first attempt ran main's test files against the review checkout's assets, which reports the PR's behaviour under main's assertions, so every number here comes from worktree-local runs.
The rest of the increment reads right. announce inside the actionStands(accepted) branch is the shape the last pass asked for, and the two outbox assertions do hold it: I reverted that hunk and watched both go red. test_a_draft_wait_only_paints_after_the_shared_busy_delay is a good pin — sampling the animation's own currentTime means the first frame reads 0 however loaded the machine is, so neither bucket can empty out under contention, and the reduced-motion guard zeroing the duration leaves both readings intact. Measured 42 frames, 9 early and 21 finished, stable across repeats.
Two things on the enumeration change read as hazards and are not. pageMapEntries is filtered to entries with a target and clusterButtons filters to visible, non-disabled controls, so pageMapButtons cannot mint a hint that presses nothing. And sendAction's second actionAvailable call, which now runs after the optimistic #settle, cannot refuse the send whose result is already painted: lf-suggestion's x-state declares no requires, so nothing in that predicate reads data-lf-state.
|
Addressed in 81423a7: an outside Leaf control press now clears the prior page selection before that action can replace selected nodes, so later state application cannot reconstruct the selection and reopen its Comment field. The reported nightly case passes, as do the complete anchor and reaction browser files, all 903 everyday tests, and pre-commit.
|
leaf-agent
left a comment
There was a problem hiding this comment.
One inline. The pointer route is closed — I ran test_the_comment_button_stands_on_no_control at this head with --run-nightly and it passes, and the new getSelection().isCollapsed line pins the mechanism rather than only the outcome. The same decision taken from the keyboard still shows the defect, and it is a regression against the base this branch merged, so it is this PR's rather than the corpus's.
Suggestions previously waited for the event round trip before showing a decision, then repeated the successful result in a notice. Generated
ghints also addressed a whole Page-map location, so a location with Accept and Reject silently chose its first action.This change paints reversible suggestion decisions immediately and carries them through the shared outbox projection until authoritative state arrives. Pending delivery leaves a disabled Undo Button in the pressed control's position; refusal restores the pending suggestion with Retry and Cancel. Successful delivery adds no receipt or visible transient notice, while its live-region announcement preserves assistive confirmation.
Generated
ghints now enumerate exact visible Page-map Buttons, giving Accept and Reject separate routes. The browser guidance and live Button gallery document and exercise the resulting lifecycle.Tests cover immediate paint, rollback, ambiguous retry, authoritative replay, focus and layout continuity, exact Accept and Reject routes, visually silent success, confirmation when pointer activation leaves focus on the page body, selection-composer dismissal through pointer, Enter, Space, and
g, and the shared delayed busy paint on drafts. The repository pre-commit gate and affected browser tests pass; light and dark browser sweeps report no console errors.