Repository navigation
Run host-owned diffs through portable widget lifecycles - #4800
Conversation
Capture the host contract from #4798: set .value without source, read the value and datum marks synchronously at drawn, then replace it and retire the first drawing. The test currently fails while importing the widget because the runtime reads the absent lfInputs.textField prepaint declaration. No runtime fix is included.
Initialize an unbound diff's value from its inline patch, then use that one input for every draw. Host values now replace the inline drawing and null clears its marks. A focused browser regression failed before and passes after; bound refresh and recovery checks also pass. The plain-page reproduction remains red at module import: LeafElement and the stage still need a host-neutral lifecycle boundary before this draft can land.
# Conflicts: # packages/diff/widgets/lf-diff.js
Apply the two Ruff rewrites reported by CI on 7d8346d. Both files retain identical Python ASTs. This fixes the formatting failure only; the plain-page diff acceptance test still fails at the absent lfInputs.textField declaration, and the portability draft remains incomplete.
|
Pushed the formatting repair as The portability repair is still incomplete. I reran With |
The bare-host diff acceptance still fails before rendering. Make the shared shadow-stage lifecycle portable first: Leaf installs its styles and cross-root watches from boot, and the DOM mover receives Leaf focus accounting from its framework integration. Retained input identity, focus, value and selection are verified without Leaf delivery. The full diff port remains incomplete; its smoke acceptance stays intact.
|
Pushed This is partial progress on the port, not a resolution of the red acceptance test. I reran that test and confirmed the same With |
|
Pushed This remains partial progress. The final candidate still fails the plain-page acceptance test at |
Install Leaf's presentation, controller, command and bound-data capabilities from the page host. The portable lifecycle retains Lit property updates, setup and failure handling without importing the prepaint-dependent runtime. Stages register arrivals in any host so nested element resources follow disconnection and return. The bare-host lifecycle regression fails before the export and passes afterward; the focused browser selection has four passing tests and the unchanged lf-diff acceptance still fails at lfInputs.textField. This is another independently verified part of #4798, not a completed diff port. pnpm run check and pre-commit pass. Startup comparison against b338fc5 retains 38 code requests and adds 379 JavaScript bytes through upgrade and server-state presentation.
|
Pushed
The diff port remains incomplete: its unchanged acceptance test still fails at |
|
Pushed The portable-host regression failed before the export and passes afterward. The Leaf-hosted diff replacement/clear regression passes, as do This remains partial progress: the unchanged plain-page diff acceptance test still fails during import at |
Leaf attaches a loader to each delivered source object, retaining its exact snapshot and revision checks. The portable helper delegates through that value without importing page services. Plain hosts can load the helper and still receive the existing refusal for a value without a source owner. The portable-host regression fails before this export and passes afterward. Leaf stale-manifest and diff replacement checks pass, as do pnpm check and pre-commit. The full plain-page diff acceptance test still fails at lfInputs.textField; this is an independent part of the unfinished portability repair.
|
Pushed The portable-host regression failed before this export and passes afterward. Leaf's stale-manifest and unbound diff replacement/clear browser tests pass, along with The complete plain-page diff acceptance test still fails at |
Keep thread handles and synchronous composer release on the same registration directory without importing Leaf page services. The bare-host regression fails before the exports and passes after them; Leaf outlet and diff reply regressions pass. The complete plain-page diff acceptance test remains red at its other page-only imports, so the PR remains a draft.
|
Pushed The bare-host regression fails before the exports and passes afterward. Five focused browser cases pass, covering the portable lifecycle, moved outlets, diff line/file comments and preserving an inline reply during a diff refresh. This is partial progress: the complete plain-page diff acceptance test still fails during import at |
Reconcile the portable host lifecycle with strict runtime typing and the current window prepaint declarations. Keep bare-host connected state independent of page presentation, retain drawn provenance and shared outlet ownership, and rebuild the kernel. The complete plain-page diff acceptance remains red at its page-only input helper; this draft is still an incremental port.
|
@leaf-agent The shared lifecycle conflicts are reconciled and pushed at The full Please acknowledge the current head when taking over. This handoff is the remaining implementation owner; avoid a duplicate branch or a parallel implementation if the queued review has already resumed it.
|
|
Acknowledged the reconciled head The handoff remains the remaining focus/navigation/control separation, preserving the complete plain-page drawing/replacement assertions and keeping this PR draft until they pass. This mention job made no code or branch changes. |
|
@leaf-agent The independent review of Please take the implementation through this mention task now, on the existing draft branch. Resume the remaining portable focus/navigation/control separation for #4798, preserve the complete plain-page drawing/replacement assertions, and keep the PR draft until those assertions pass. The resolved shared-lifecycle conflicts and passing hosted/portable checks are recorded in the body. This request explicitly authorizes continuing implementation and pushing incremental repairs to this draft; it does not ask the review workflow to repair a draft or authorize landing the incomplete feature. Please report the concrete implementation result or remaining blocker, rather than handing it back to the completed review.
|
# Conflicts: # dist/kernel/leaf.js # dist/kernel/runtime/bundle-annotation-overlay.js
|
Pushed the control-helper separation in This is incremental implementation, and the PR remains draft. I reran the complete plain-page diff acceptance without changing its drawing or replacement assertions: it still fails during import at Current main |
Re-export the existing placement and write owners from portable-api rather than requiring page services for these document-local operations. Both API surfaces still use the same implementations. Extend the bare-host staging test to retain a draft, focus and selection while moving an input between child lists; it failed before these exports and passes afterward. The complete plain-page diff acceptance remains unchanged and still fails at lfInputs.textField. This is incremental work for #4798; keep the portability PR draft.
|
Pushed The complete plain-page diff acceptance is unchanged and still fails during import at |
Keep one document input clock shared by early delivery and portable modules. Separate native focus, scroll ancestry, walk declarations and language paths from Leaf page integration, and let lf-diff hold its own drawing and declare pending work through the existing event protocol. Plain hosts now set and replace .value, read drawn marks synchronously, filter files and retain search focus during replacement. Leaf keeps authored data, provenance, region semantics and presentation services. Validated complete plain-host acceptance and 18 hosted/display/startup checks plus five subtests, 127 delivery checks, pnpm check (737 runtime and 88 Worker tests), and pre-commit. The sideways hunk fixture fails before landing at its scrollLeft=150 setup, matching preexisting issue #4919. Served startup comparison against 36254f8 keeps 38 code requests and adds 3891 code bytes through upgrade/presentation, without console errors.
|
Tend coordination: Codex now owns the remaining implementation for #4798 on this branch. The local completion passes the unchanged full plain-page diff acceptance and is undergoing final hosted and startup checks. It is being reconciled with Please review the next pushed head, leaving the ongoing implementation with this owner rather than starting another partial draft increment. The PR remains draft until the complete behavior is verified.
|
leaf-agent
left a comment
There was a problem hiding this comment.
The plain-host path still exposes Comment controls whose only action requires Leaf, and the new acceptance test fails at teardown. These leave the port short of a clean verdict.
I am leaving the implementation with the existing Codex owner, as requested in the maintainer's handoff, rather than starting a parallel repair.
Expose the real surface opener as a nullable reactive capability. Diff line numbers remain text without a surface; registration adds Comment controls to retained rows without reparsing their evidence. Retire stale openers by canonical registration identity. Cut the other surface consumer over too. The host acceptance now makes its multi-file selection through an explicit button, keeping shift monitoring active, and asserts plain hosts offer no unavailable comments. Throttled plain/hosted/reconnect cases, annotation lifetime tests, full runtime and type/build gates pass. Tighten repeated portability guidance so the API reference again fits one read.
…5103) The datum-travel test replaces and removes a diff row directly during `beforematch`, but leaves the widget's address lookup pointing at the detached original. #4800 changed `lfDataDatum` to return retained row nodes as part of making diffs portable; the fixture's DOM-only replacement no longer models a consistent widget. The fixture now resolves the widget's translated datum against its current rows. It still tests both replacement and removal during reveal, and additionally asserts that focus reaches the rebuilt row. Production behavior is unchanged. The focused test reproduced the reported missing-row failure on main at `21e8c11e2`, then passed with the fixture correction (5.36 seconds): ```sh uv run pytest tests/browser/projection/test_code_review.py::test_datum_travel_resolves_the_destination_after_reveal -q -n0 ``` Closes #5086 — automated triage --------- Co-authored-by: leaf-agent <[email protected]>
… updates (#5346) `lf-diff` lost its whole-patch refusal on updates that changed nothing it draws. The diff showed the refusal through `LeafElement`'s light-DOM failure box, which `LeafElement.update()` removes on every update, while `lf-diff` draws, and fails, asynchronously from `updated()`. #3527 and #3987 kept the refusal by gating `shouldUpdate` on a changed source, and #4800 added the Comment opener to that gate, so a thread surface registering beside a refusal (on load for an inline patch, on return for a bound one) cleared it again. The refusal now stands as the diff's shadow stage, as its drawn files do, so only the next `show` replaces it: a corrected source, or a rendering a departure cut short. The `shouldUpdate` override and its opener bookkeeping are gone. `render()` still reads the opener, so a surface registering or retiring redraws the Comment controls, which `updated()` reconciles as before. Page layout can't see into a shadow stage, so the runtime's stage failure placer (`shadow-stage.js`) marks the host `data-lf-failed` until the next stage replaces the box. The `layouts.css` rules that give a failed widget the prose measure and drop its reserved `data-height` read it beside a light `.lf-error`. That also covers `lf-file-editor`, `lf-file-tree`, and a bound diff that fails after drawing, whose failure boxes already stood in the stage unseen by those rules. Verification: - `test_a_patch_that_failed_stays_failed_when_its_diff_returns` (inline and bound) passes; it now reads the refusal from the shadow root. - `test_a_widget_that_failed_soft_claims_no_room` gains a refused-diff case, which fails without the `layouts.css` change and passes with it. - Diff comment-control, preparation-on-return, retry, plain-host and native-metadata tests pass, as do `pnpm run test:runtime` (777) and `pnpm run check:browser`. - `test_a_diff_refresh_keeps_a_selection_in_unchanged_lines` fails identically on the previous head without this change. Other tests that read a diff's refusal from light DOM now read the shadow root, including two in `tests/journeys/test_render_anchors.py` that weren't run here. Closes #3986 — automated triage --------- Co-authored-by: leaf-agent <[email protected]>
A host can now import
lf-diffon an ordinary HTML page, set and replace its.value, and synchronously read thedata-lf-datummarks from each nonbubblingdrawnevent. Its file filter remains usable and focused when the host replaces the patch. Closes #4798.The portable API owns the widget lifecycle, retained DOM operations, input clock, focus and native scroll navigation, control construction, and live walk declarations. Leaf installs its page services separately: authored data and provenance, presentation scheduling, semantic reading regions, theme and annotation integration, thread placement, and page-composed language mappings. These use the same underlying implementations on both hosts. A registered annotation surface supplies a reactive Comment opener; without it, the diff shows readable line numbers and no unavailable Comment controls. Registration and retirement update retained controls without reparsing the value. Early document delivery starts the same input clock that later module imports retain, so input before startup still supersedes delayed navigation.
Validation:
scrollLeft = 150, before navigation, matching the existing failure tracked in Diff hunk fixture cannot establish its initial sideways reading position #4919.uv run leaf-dev sitebuild passes locally.pnpm run checkpasses: 737 runtime tests, 88 Worker tests, browser-build checks and type checks. Pre-commit passes and the committed kernel is rebuilt.pr-walkthroughcomparison against merged main99eb211d8keeps 55 code requests through widget upgrade and server-state presentation, and 105 total requests by presentation. Code grows by 9,381 bytes (4,879,293 → 4,888,674) across the whole PR. The shared input producer must run before early interactions and remain importable by plain hosts; the separation preserves that guarantee without adding code requests. Both arms draw the same 20 line-comment controls with no console errors. A recorded hunk walk of the portability change reaches the same focused line and status on both arms.