Skip to content

Render every lf-diff source through one manifest pipeline - #2319

Merged
max-sixty merged 1 commit into
mainfrom
lf-diff-one-pipeline
Oct 11, 2026
Merged

max-sixty merged 1 commit into
mainfrom
lf-diff-one-pipeline

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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

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]>
@max-sixty
max-sixty merged commit 86d1799 into main Oct 11, 2026
6 checks passed
@max-sixty
max-sixty deleted the lf-diff-one-pipeline branch October 11, 2026 01:25
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