Skip to content

Preserve runtime state across authored revisions - #621

Merged
max-sixty merged 11 commits into
mainfrom
codex/fix-clipped-reader-heading
Sep 12, 2026
Merged

max-sixty merged 11 commits into
mainfrom
codex/fix-clipped-reader-heading

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 12, 2026 •

Copy link
Copy Markdown
Owner

An in-place authored revision could overwrite or remove live reader state because the
same stable html and body elements carry both authored attributes and runtime-owned
state. The visible symptom was a heading sliding under the fixed banner after the
prepaint data-lf-live marker disappeared, but the same boundary also affected body
focus and runtime-owned inline layout properties.

Make root ownership explicit: authored classes and attributes replace their prior
authored share, reserved runtime namespaces remain live, and runtime writers register
the individual root attributes and CSS properties they own. Version continuity now
walks the same composed reading tree as passage resolution, preserves a nested heading's
offset within its section, and records the active reading region before a bounded
workspace reflows. An architecture lint rule follows document-root aliases and rejects
inline-style mutations outside that ownership boundary.

Browser regressions cover automatic revision arrival and the rendered Versions control,
including reworded-heading fallback, an initially colliding body tabindex, colliding
runtime CSS properties, a declared shadow-root landmark, and a four-pane bounded-to-flow
transition. uv run pytest tests passes all 1,051 tests, and every pre-commit hook passes.

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.

Both halves land: I ran each new case against the base runtime and each fails there, and test_render_projection.py and test_render_navigation.py are otherwise green on the branch (the one red, test_command_hub_stops_listening_after_live_version_replacement, fails at the merge base too and is already fixed in #620).

One gap in the invariant the change claims for itself: capture clamps the quote landmark but not the section landmark, and for a heading that carries its own id those are the same element — so a revision that rewords the heading still lands the reader on the clipped title. Detail and a reproduction inline.

Comment thread skills/leaf/assets/runtime/version.js Resolved
leaf-agent
leaf-agent previously approved these changes Sep 12, 2026
max-sixty and others added 4 commits September 12, 2026 08:51
Records the option space for combining UI acceptance policy with
recurring agent discovery. The note compares Leaf's existing `ui-sweep`
composition with public exploratory, visual-audit, goal-driven browser,
general QA, and hosted-browser skills; defines the shared mission,
evidence, stopping, and calibration contracts; and recommends a
Leaf-native pilot before adding persistent QA infrastructure.

This is an active research note rather than a shipped product or agent
contract.

Checks: `uv run pre-commit run --files notes/agent-driven-ui-quality.md`

> _This was written by Codex on behalf of max-sixty_
## Summary

- distinguish the document scrollport from nested content clips so
below-fold words remain readable by the render gate
- compose the site-context package into published examples and keep its
wide workspace header compact across platform font metrics
- update stale browser-suite fixtures for current Live Progress,
visual-review navigation, version stamping, data-only pages, and resize
confirmation

## Validation

- `uv run pytest tests --run-nightly -v` — 2529 passed; the affected
startup-timeout node then passed six consecutive focused runs
- focused causal slice — 40 passed
- Live Progress published-workspace allocation — passed locally at
1200×900
- resize confirmation selection — passed twice in the reviewer’s
isolated `-n2` reproduction after removing the confirming-page timeout
override
- `uv run pre-commit run --files ...`
- `npm run typecheck --prefix worker`
- `npm test --prefix worker` — 60 passed
- `npx wrangler deploy --dry-run --outdir ../.tmp/worker-deploy`
- `scripts/verify-site-local.sh`

> _This was written by Codex on behalf of max-sixty_
Resolving a selected thread updated the panel optimistically but
deferred its focus handoff until the request completed. During that gap,
focus fell to the Threads list, so pressing `c` opened the page comment
box and cancelled the eventual landing.

Move settlement landing into the optimistic transition and restore it on
refusal. Resolve now selects the next available thread immediately,
while Reopen enters its reply and conditionally restores the reader's
exact lifecycle/search view if the request fails. Existing focus-intent
guards keep later reader navigation authoritative.

Browser coverage holds accepted and refused Resolve/Reopen requests,
presses `c` before acknowledgement, retains drafts, and covers
last-thread and later-destination behavior. The complete conversation
browser file passes 76 tests. The current-head full suite passed 1,036
tests; its two intermittent render-startup failures reproduced on a
frozen current-main worktree with the same two-worker selection.

> _This was written by Codex on behalf of max-sixty_
@max-sixty max-sixty changed the title Preserve reader shell across revision changes Preserve runtime state across authored revisions Sep 12, 2026

@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.

The root-ownership split holds on the path the PR claims. One seam it leaves open: the namespace half of the boundary is enforced — version check rejects an authored data-lf- attribute or lf- class on <html> and <body> through reserved_marker_errors — while the registry half is opt-in and unchecked, so the next runtime writer that reaches past setRuntimeRootStyle reintroduces exactly the collision this PR fixes, and nothing says so. Detail and the enforcement this repo already has for facts of this shape inline.

@leaf-agent
leaf-agent dismissed their stale review September 12, 2026 16:13

Superseded by the review on a later commit.

@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.

The seam I raised is enforced for root styles; detail and the remaining attribute-side note are inline. Selection on the branch-owned increment (203d6877): pre-commit run eslint --all-files passes, and the restore and revision-activation cases the refactor touches — test_a_restored_auxiliary_surface_has_final_geometry_before_runtime_loads, test_a_current_auxiliary_choice_replaces_a_persisted_tray_during_replay, test_the_live_page_adopts_a_revision_and_stamps_it_without_replacing_main, test_revision_changes_keep_the_complete_heading_below_reader_chrome, test_revision_changes_follow_authored_text_into_declared_shadow_trees, test_revision_remembers_the_active_region_when_a_workspace_reflows — are green.

…der-heading

# Conflicts:
#	skills/leaf/assets/runtime/version.js
@max-sixty
max-sixty merged commit 7ea4605 into main Sep 12, 2026
4 checks passed
@max-sixty
max-sixty deleted the codex/fix-clipped-reader-heading branch September 12, 2026 16:52
max-sixty added a commit that referenced this pull request Sep 12, 2026
Follow-up to #621. Version activation keeps the document roots alive
while replacing authored state, so runtime-owned root attributes and
styles need one enforceable ownership boundary.

This expands the existing architecture lint from inline styles to root
state. It covers direct properties, DOM attribute methods, `dataset`,
`classList`, `Object.assign`, `Reflect.set`, stable aliases, and
destructured aliases while permitting Leaf-reserved `data-lf-*`
attributes and `lf-*` class tokens.

Unknown attribute names fail closed. References through the shared
`PAGE_PAINT_ATTRIBUTE` registry are resolved from its canonical
declaration, so the runtime's existing house style remains checked
without duplicating the registry.

Validated with causal lint probes for accepted and rejected mutation
forms, the full pre-commit gate, and independent review.

> _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