Skip to content

feat: add authored notes to diff source lines - #4759

Merged
leaf-agent merged 1 commit into
mainfrom
feat/issue-4707
Oct 30, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
feat/issue-4707

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Adds lf-diff-note children addressed by file, side="old|new" and at, so an author can explain a patch inline without repeating its source in a code block. Notes follow their file disclosure, wrap within the visible reader width, survive deferred loading and source refreshes, and show an unmatched address when their line disappears.

The shared passage reader now admits declared prose members independently of a data widget's source notation, covering existing code notes too. File data identity belongs to the file header instead of its entire body: selecting a note captures an authored prose anchor rather than a source-revision-bound file datum. File comment controls and inline conversation placement retain their existing routes; closing a file comment returns focus within that file, now at its header.

Validation passed:

  • 24 focused passage/quote model tests, including a regression that first failed because all prose members were withheld.
  • Browser checks for old/new/context placement, keyboard opening of deferred evidence, browser/file capture agreement, missing-line refresh, existing code notes, file conversations and focus across evidence changes.
  • Desktop and phone first-paint height checks; pnpm run check, the final browser build check, and pre-commit checks.
Visual and startup verification

Reviewed before/after captures of the committed diff gallery in light, dark and phone states. Reproduce them with:

uv run leaf-dev stills 481e3cc33618e2b373bc1c887fe7e68f7c331dcf --authored --state diff-author-notes --state diff-author-notes-dark --state diff-author-notes-touch

Screenshot publication is blocked: leaf-dev publish-media received HTTP 403 because leaf-agent cannot push to max-sixty/leaf-assets. The captures stayed in this run's .tmp/stills/; no image or asset pin was committed. The named states let the reviewer regenerate and inspect the comparisons.

A base/candidate startup probe of the same small served patch kept 39 code requests and 36 JavaScript requests through both upgrade and presentation. Code bytes increased by 5,451, including the note placement, prose styling and first-paint height reservation. The reservation must precede the source renderer to keep content below an annotated diff in place; the desktop/phone checks cover that guarantee.

Closes #4707 — automated triage

Preserve declared prose members when reading data widgets, so existing code notes and new diff notes can be quoted independently of source notation. Diff notes use source file, side and line coordinates, survive deferred rendering and refreshes, and mark missing coordinates instead of disappearing.

Closes #4707
@leaf-agent
leaf-agent merged commit 2705f8d into main Oct 30, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the feat/issue-4707 branch October 30, 2026 09:20
max-sixty pushed a commit that referenced this pull request Nov 1, 2026
Three browser tests still read file identity from the outer diff
container. #4759 intentionally moved that identity to the file header so
authored notes keep their own prose anchors. The tests now inspect the
header and retain their checks of file comments, stored source
coordinates, call-tree navigation and precise line selection. Runtime
behavior is unchanged.

The original unloaded-file assertion reproduced on main `7844f4d04`.
With the corrected locators, all four focused checks pass:
`test_a_manifest_diff_can_comment_on_one_unloaded_file`,
`test_call_diff_projects_stable_commentable_rows`,
`test_a_data_bound_diff_aims_and_selects_one_source_line`, and
`test_author_notes_follow_source_lines_and_survive_deferred_refresh`
(24.23s). Ruff lint, formatting and `git diff --check` pass.

Closes #4903 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 1, 2026
Authored diff notes now reserve the one-pixel inline borders of the file
they enter during upgrade, preventing the reported two-pixel width loss.
This preserves #4759's final note layout and wrapping; only the initial
authored note is inset.

The package quality check reproduced both reported findings on current
main and passes with the fix. The existing desktop/touch first-paint
test now compares note width across upgrade; its new assertion fails on
the original CSS and both cases pass with the correction.

Visual comparison with `leaf-dev stills HEAD^ --state diff-author-notes
--state diff-author-notes-dark --state diff-author-notes-touch` found
all three presented states unchanged. A served base/candidate startup
comparison kept 42 code requests and 39 JavaScript requests through
upgrade and presentation, with JavaScript bytes unchanged and 150
additional CSS bytes to reserve the inset before rendering.


<details><summary>First-paint comparison</summary>

In the same gallery, with the runtime entry held, the old note measured
907.609375px before upgrade and 905.609375px afterward. The corrected
note measured 905.609375px on both sides. The initial border and text
inset move inward by one pixel on each edge:

| Before | After |
| --- | --- |
| ![Original first
paint](https://github.com/user-attachments/assets/781b355c-e817-492a-89a2-d995aa445e21)
| ![Corrected first
paint](https://github.com/user-attachments/assets/15cb44eb-82f5-427d-be47-734bee783d10)
|

The focused Python checks passed (3 cases), Ruff passed, and all 737
runtime tests passed.

</details>

Closes #4950 — automated triage

Co-authored-by: leaf-agent <[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.

lf-diff has no author notes on a line, unlike lf-code's lf-note

1 participant