Skip to content

fix: make inline diff files and lines commentable - #2125

Merged
max-sixty merged 5 commits into
mainfrom
fix/issue-2124
Oct 10, 2026
Merged

max-sixty merged 5 commits into
mainfrom
fix/issue-2124

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Inline lf-diff patches rendered file and line rows without projecting their coordinates, so their comment controls had no addressable targets. The widget now projects inline rows and gives them the same file and line controls as bound patches. The projection contract accepts an unversioned inline value when the widget has no active source binding; bound projections still require their source snapshot.

The new browser regression failed before the change, then passed with file and line comments admitted under the expected diff anchors. Focused projection and diff tests passed (8 tests), as did JavaScript syntax checks. The standalone startup probe could not launch Chrome in this CI sandbox; the browser tests did run through the suite fixture.

Closes #2124 — automated triage

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline diff path and its comment anchors have no review finding. The current lint check is red on shortcut-bar.js line 338, outside this diff; #2123 contains the focus-owner fix. This PR cannot merge until that fix reaches its base and lint passes here.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

I merged current main into this branch to pick up the separate shortcut-bar.js lint repair. The full pre-commit gate and test_inline_diff_lines_and_files_can_start_comments passed locally. CI on 7f7b16873f8a61c99f547f1fa5b2ec5786476eff is green, including lint, build, review, and the broad test job.

GitHub still reports mergeStateStatus: BLOCKED for this head, so I left the PR open for its applying merge rule.

# Conflicts:
#	skills/leaf/packages/diff/widgets/lf-diff.js
#	tests/test_render_widgets.py

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base merge left @pytest.mark.parametrize("review", [False, True]) above test_filtering_a_diff_keeps_its_field_and_toolbar_controls_fixed, but removed the test's review argument. Pytest now fails while collecting tests/test_render_widgets.py (function uses no argument 'review'), so the test job cannot run this file. Remove the stray decorator.

The base merge removed the diff review mode from the filtering test but left its parametrization, preventing pytest from collecting the file. Drop the obsolete case so the remaining width checks and inline comment regression run.
@max-sixty
max-sixty merged commit 056c7cc into main Oct 10, 2026
5 checks passed
@max-sixty
max-sixty deleted the fix/issue-2124 branch October 10, 2026 07:59
max-sixty added a commit that referenced this pull request Oct 11, 2026
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]>
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.

Inline lf-diff patches get no line or file comment controls

2 participants