Repository navigation
clens-009-edits-highlight-mismatch: TUI Edits tab: the highlighted file is not the file Enter opens - #18
Merged
Conversation
…ghlight-mismatch-1784800379163)
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.
clens-009-edits-highlight-mismatch
Ticket: tickets/clens-009-edits-highlight-mismatch.md
All gates are green and the diff is minimal — only
tui-formatters.tsproduction code changed, plus the earlier test file (untouched in this turn).Summary of the fix
Root cause: both
groupFilesByDirectoryandgroupFilesByAgentrecomputed a display position (fileIdx = baseIdx + ivia cumulative offsets) after re-sorting/re-grouping the files, then compared that position tohighlightIndex— silently assuming display order matched the flat selection order it doesn't.Fix: resolve the highlighted file by identity instead. In each function, before any sorting/grouping, compute:
using the original
filesarray (the flat, selection-order array the caller passed in — the same onegetEditsFileList/Enter uses). Then each rendered entry'sisHighlightedbecomeshighlightedPath !== undefined && f.file_path === highlightedPath, which is invariant to how the entry gets re-sorted or bucketed by directory/agent for display.Since the offset-tracking machinery (
groupOffsets,baseIdx,fileIdx,agentGroupOffsets,groupBaseIdx,dirOffsets,dirBaseIdx) existed solely to feed that now-removed position comparison, it was dead code after the fix and was removed to keep lint clean (no orphaned unused vars) — no other behavior changed.Gates
bun run lint→ ✅ greenbun run typecheck→ ✅ greenbun run test→ ✅ 1866 pass, 0 fail (includes the 4 previously-red regression tests, now green)Changes are left uncommitted in the working tree as instructed.
Gates
lint — pass
typecheck — pass
test — pass
Gate suite ran in: 19318ms
Repair rounds used: 0
Total duration: 668408ms
Run id: clens-009-edits-highlight-mismatch-1784800379163
Captured sessions
/Users/silouane/adw-factory/runs/clens-009-edits-highlight-mismatch-1784800379163/.clens/sessions/0a678616-f695-44c7-a765-e5f283053bde.jsonl/Users/silouane/adw-factory/runs/clens-009-edits-highlight-mismatch-1784800379163/.clens/sessions/1a37194b-92dd-4340-b9c4-4f92f379e784.jsonlOpened by adw-factory. A human reviews and merges — the factory never merges,
approves, or closes its own pull requests.