Skip to content

Keep live revisions flowing through retained editing sessions - #2179

Merged
max-sixty merged 3 commits into
mainfrom
codex/retain-composition-on-revision
Oct 9, 2026
Merged

max-sixty merged 3 commits into
mainfrom
codex/retain-composition-on-revision

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Questions stayed at zero while a comment composer, native selection, or typed reply held the entire authored revision. Live revisions now arrive during editing when the source patch preserves the native editor and the complete anchor scope of a pending comment or selection.

The retention proof uses the DOM patcher's existing matching and widget ownership rules. It covers ordinary authored controls, panel replies, and thread mirrors mounted in unchanged page containers, including authored nodes a module moves elsewhere. Changed anchor scopes and replaced editors still defer activation; executable changes still wait for composition before reloading. Update the authoring contract and the tests that previously required unrelated revisions to wait.

Margin placement now invalidates its geometry when source insertions change a target's containing layout. This keeps its marker synchronized with the existing scroll restoration that preserves the inline editor, reading passage, and resting pointer.

Validation: all 282 runtime tests pass. Focused browser journeys cover Questions changing 0 → 3 → 0, exact editor/focus/caret retention, native selections, replies after Tab, removed source anchors, ambiguous quotes, and reload deferral. Independent browser review also exercised a canonical reply mounted in a plain Element container; desktop and narrow-screen checks preserve reading, editing, pointer, and marker positions. Runtime tests cover shadow owners, generated editors, and authored nodes moved outside main or into another source owner. Startup comparison adds no code requests and about 5 KB of source bytes before presentation; mutation placement must settle before paint to prevent displaced markers.

This was written by Codex on behalf of max-sixty

Whole-page composition holds kept Questions at zero until an anchored composer closed. Admit an in-place revision when the authored patch proves that every native editor and complete pending anchor scope survives. Reuse its matching and widget ownership rules, checking both logical and physical owners of moved nodes. Reloads and destructive edits still wait for composition.

Source insertions exposed a missed margin geometry dependency: hear child-list changes in measured layout and settle marker coordinates at the script checkpoint before scroll restoration can paint stale placement.

Selections, generated shadow controls, and emptied replies now follow unrelated revisions. The old-realm state test explicitly changes executable identity to exercise a real reload. Update the authoring contract. Validated with focused browser journeys, 282 runtime tests, pre-commit, and a served startup comparison with no added code requests.
@max-sixty
max-sixty merged commit 959bf39 into main Oct 9, 2026
5 checks passed
@max-sixty
max-sixty deleted the codex/retain-composition-on-revision branch October 9, 2026 23:21
leaf-agent added a commit that referenced this pull request Oct 10, 2026
The retained draft editor follows an unrelated authored change immediately after #2179. Verify its empty value and focus through that revision, then reload and save it as an absolute edit.
leaf-agent added a commit that referenced this pull request Oct 10, 2026
The retained draft editor follows an unrelated authored change immediately after #2179. Verify its empty value and focus through that revision, then reload and save it as an absolute edit.
leaf-agent added a commit that referenced this pull request Oct 10, 2026
[#2179](#2179) lets unrelated
authored revisions arrive while retained editors hold unsent words. Two
browser journeys still expected those revisions to wait: one for a page
comment editor in runtime chrome, another for an empty draft editor
whose authored node is retained. They now check immediate adoption while
each editor keeps its value and focus. The comment journey still checks
the live URL and retired attributes; the draft journey still reloads and
saves the empty value as an absolute edit.

Both original cases failed on `main` before this change. Their revised
cases passed: `uv run pytest
tests/test_render_drafts.py::test_an_empty_draft_survives_reload_and_a_live_revision
tests/test_render_projection.py::test_the_live_page_retains_a_page_comment_while_adopting_revisions
-q -n0`.

This addresses two failures in [main CI run
38013241865](https://github.com/max-sixty/leaf/actions/runs/38013241865).

---------

Co-authored-by: leaf-agent <[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.

2 participants