Repository navigation
Render every lf-diff source through one manifest pipeline - #2319
Merged
Merged
Conversation
lf-diff had two render pipelines: `render` for a patch text (inline or bound) and `renderManifest` for a file manifest. Each built its own entries, controls, staging and projection, so every fix had to land twice (#2125 brought the text path level with the manifest path). Now every source form becomes one list of per-file records shaped like the contract's manifest, and one plan/prepare/apply path renders them all. - **One pipeline.** `sourceRecords` parses a patch text once and gives each record its parsed file; a manifest is already that list. `prepareEntry` reads an in-memory record's file and fetches a manifest record's patch with `loadDeferred`. A single `fileEntry(row)` replaces the three entry literals. One `projectFiles` takes its origin from the source form: `files[i].path`/`files[i].patch` for a manifest, the whole delivery for a bound patch text, and none for an inline patch. The record now paints each file's summary, so `renderFile` returns only the evidence that goes under it. - **Behavior change: collapsed files render lazily in every form.** A closed file in an inline or bound patch text now renders when it opens, as a manifest's file already did. Until then, `lfDataDatum` resolves its lines to the file row, and a reveal or hunk walk opens and loads the file. A render failure inside one file shows that file's error box, as a manifest file's load failure already did, instead of failing the whole widget. - **The contract states the manifest's rules.** `records.key` is now `path`, and the redundant `key` field is gone from the schema and from `patch_manifest.py`. `files` requires at least one record, and a rename record requires `previousPath`. `data set` therefore refuses `{"files": []}`, duplicate paths and a rename with no source path, and the widget's own shape checks are deleted. A patch text that repeats a path is refused the same way, with "unified diff repeats file path". - **Failure box.** `failSoft` receives the source only when it is patch text, so a manifest failure no longer prints `[object Object]`. - **Inline lazy loads survive a reconnection.** An inline diff keeps its entries when it reconnects. A load abandoned by a disconnect is tied to its render, so opening the file again starts a fresh load. The JavaScript patch validator stays in the widget; #1082 deliberately took patch parsing out of core. This change touches none of the runtime files that #2287 edits, and `test_a_scroll_box_inside_a_widgets_shadow_tree_takes_the_keyboard` fails on main until #2287 lands. Tests: the lf-diff selections in the widgets, anchors, projection and threads render files pass (88), and so do the other 155 tests that mention lf-diff or the manifest, apart from the reach test above. The test changes: manifest fixtures drop `key`, a new test covers the three contract refusals, a repeated-path refusal joins the rejection cases, and the collapsed-diff test asserts that lines render only on open. > _This was written by Claude Code on behalf of max-sixty_ Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lf-diff had two render pipelines:
renderfor a patch text (inline or bound) andrenderManifestfor a file manifest. Each built its own entries, controls, staging and projection, so every fix had to land twice (#2125 brought the text path level with the manifest path). Now every source form becomes one list of per-file records shaped like the contract's manifest, and one plan/prepare/apply path renders them all.sourceRecordsparses a patch text once and gives each record its parsed file; a manifest is already that list.prepareEntryreads an in-memory record's file and fetches a manifest record's patch withloadDeferred. A singlefileEntry(row)replaces the three entry literals. OneprojectFilestakes its origin from the source form:files[i].path/files[i].patchfor a manifest, the whole delivery for a bound patch text, and none for an inline patch. The record now paints each file's summary, sorenderFilereturns only the evidence that goes under it.lfDataDatumresolves its lines to the file row, and a reveal or hunk walk opens and loads the file. A render failure inside one file shows that file's error box, as a manifest file's load failure already did, instead of failing the whole widget.records.keyis nowpath, and the redundantkeyfield is gone from the schema and frompatch_manifest.py.filesrequires at least one record, and a rename record requirespreviousPath.data settherefore refuses{"files": []}, duplicate paths and a rename with no source path, and the widget's own shape checks are deleted. A patch text that repeats a path is refused the same way, with "unified diff repeats file path".failSoftreceives the source only when it is patch text, so a manifest failure no longer prints[object Object].The JavaScript patch validator stays in the widget; #1082 deliberately took patch parsing out of core. This change touches none of the runtime files that #2287 edits, and
test_a_scroll_box_inside_a_widgets_shadow_tree_takes_the_keyboardfails on main until #2287 lands.Tests: the lf-diff selections in the widgets, anchors, projection and threads render files pass (88), and so do the other 155 tests that mention lf-diff or the manifest, apart from the reach test above. The test changes: manifest fixtures drop
key, a new test covers the three contract refusals, a repeated-path refusal joins the rejection cases, and the collapsed-diff test asserts that lines render only on open.