You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Note geometry cache retains the previous hunk when only the resolved target changes #1346
I’m doing some research for Tessl Code Review and ran it against your repo. It flagged a potential issue, and I figured it made sense to share it with you:
What happened?
When a note's resolved target moves to another hunk while its annotation and thread metadata stay the same, measureDiffSectionGeometry returns the previous cached geometry. Its noteTarget.hunkIndex still points to the old hunk.
This surfaced during a retrospective review of #1202. It was identified as a pre-existing case, not a regression introduced by that PR. I reproduced it on current commit 57a90b4.
Steps to reproduce
Using the checkout's createTestDiffFile helper, make a 40-line file with changes at lines 5 and 35, giving two hunks. Build two notes with createVisibleAgentNote, keeping these fields identical:
Supply target: { hunkIndex: 0, side: "new", line: 5 } for the first note and target: { hunkIndex: 1, side: "new", line: 35 } for the second.
Call measureDiffSectionGeometry(file, "split", true, theme, [note], 120) first with the original note, then with the moved note, retaining the same file object.
Observed:
resolved anchor owner: 0 -> 1
returned geometry object: same object
cached note target: hunkIndex 0
fresh-file control: hunkIndex 1
The control passes { ...file } with the moved note, forcing a fresh WeakMap entry. All other inputs stay the same.
Expected behavior
Changing the resolved anchor should invalidate note-aware geometry so bounds and keyboard note targets refer to its current placement.
notesCacheKey includes annotation/thread fields but omits VisibleAgentNote.anchor, although row planning uses that resolved placement.
Version
Source checkout 57a90b4 (package 0.25.0), macOS, Bun 1.3.10. This was a direct geometry-module reproduction with the actual imports and repository helper, not an interactive TUI/navigation test.
Full transparency: I work at Tessl, and we've spotted that using Tessl Code Review - using repository-level context and specific review lenses that improve over time through feedback. That’s how this finding surfaced.
We’re just getting started and want to offer the tool free to open-source projects. If this is useful, happy to give you access.
Activity