feat(diff-edit): collapsible file cards with stats, auto-collapse, and keyboard navigation - #128
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9610de5f60
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
abe0a8e to
b209abb
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b209abbbf2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce10b998ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4459dafee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce1b7ab7f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46bf174bd9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0bc0af2da4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 805c5d72f2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7fef58dec3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 04c419b723
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b55a55352
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
jayjay/shell/gpui/src/repo/window/diff_edit/state.rs
Lines 209 to 211 in 8e6ffbe
Fresh evidence beyond the earlier mode-reload fix: if Ignore Whitespace changes while compute_file_diff_full is running, the reset clears loading but leaves the session unchanged, and this completion guard therefore accepts the old-mode result. If it finishes after the replacement load, it overwrites the card and its line mapping with the superseded mode, allowing later selections to be applied using current-mode semantics. Capture and compare the whitespace mode or a load generation here. agents/architecture.mdL39-L39
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
jayjay/shell/gpui/src/repo/window/diff_edit/state.rs
Lines 211 to 213 in 627951b
When Ignore Whitespace changes or the selected change is amended while this background diff computation is running, sync_diff_edit_loaded_files clears the state and launches replacements but preserves the session ID, so this guard still accepts the old completion. If it finishes last, its old rows and full-line mapping overwrite the replacement and can be submitted with the current whitespace mode, selecting or removing different lines. Capture and compare the mode and immutable commit (or use a load generation) before installing the result. agents/architecture.mdL39-L39
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
jayjay/shell/gpui/src/repo/window/diff_edit/state.rs
Lines 211 to 213 in 3d53d82
When Ignore Whitespace is toggled while a card's background diff computation is running, the reset in sync_diff_edit_loaded_files clears state but does not change session, so this completion still passes the only guard and can reinstall the old-mode diff. Because loaded_files then suppresses another load, the user can select old-mode row indices that build_diff_edit_request submits with the new whitespace mode; unchanged file contents pass the core staleness check, allowing the indices to target different lines. Capture and compare the mode/commit here, or advance a load generation during the reset. agents/architecture.mdL39-L39
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Fixed the review-body P1 in the latest push: the session-epoch reset now advances the diff-edit session token, so every in-flight completion — card diff computes and stats alike — fails the existing session guard instead of reinstalling old-mode state over the cleared maps. This is the same invalidation mechanism enter/exit already rely on, now applied to mode and commit epoch changes. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fffb182a69
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
62687f6 to
bce5720
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bce572009f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 440fa28c5c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
jayjay/shell/gpui/src/repo/window/diff_edit/rows.rs
Lines 113 to 115 in 98a0936
In the GPUI Diff Edit path, when a projected file has both raw and processed entries in vm.diff_cache—for example, after opening an .ipynb rich preview before entering Diff Edit—this path-only scan can return either entry. Because projected hunks are marked unsupported and never replaced from loaded_files, the arbitrary preview remains for the session, so the card can show processed Markdown while its stats and collapse policy describe the default raw source. Resolve the fallback using the current revision, projection mode, and whitespace cache key instead of scanning values. agents/format-projections.mdL42-L45
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Fixed the review-body P2 in fb7a234: the diff-edit preview fallback now resolves through Verifying the fix surfaced that the path scan was worse than an arbitrary pick: processed entries are cached under the projection's virtual path ( |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb7a23455a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
jayjay/shell/gpui/src/repo/window/diff_edit/session.rs
Lines 27 to 28 in 4efe8d5
When Diff Edit is opened while Find is active, this transition leaves find.query set even though the normal detail pane and find UI are replaced. The root key handler in render/mod.rs:175-178 still sends every key to handle_find_key first, where find.rs:125-130 consumes it, so j/k, arrows, Return, and Space operate on the hidden find state instead of the Diff Edit cards. Close Find when entering this mode or bypass its handler while Diff Edit is active. agents/shell-parity.mdL29-L29
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 60e88ea796
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8629445ad4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…d keyboard navigation Reworks the Diff Edit view in both shells so large changes stay scannable. - Per-file +/- line stats in card headers, computed in core from the raw (as-displayed) content and matching the rendered diff rows exactly, including EOF-newline reconciliation. - Per-file collapse/expand with chevrons; Expand All / Collapse All buttons and mod+alt+e / mod+alt+c shortcuts. - Auto-collapse for large diffs via the shared policy: diffs with at most 30 files always start fully expanded; beyond that, >1000 total changed lines collapses every card, otherwise only files with >300 changed lines start collapsed. The collapse-all case is seeded at entry from the whole-change stats the shells already hold, so large diffs never flash expanded; with stats still pending, multi-file diffs collapse provisionally and the per-file pass replaces the seed. Stats are re-fetched and stale results dropped by commit id when the working copy is amended mid-session. - Keyboard focus model: j/k or Up/Down move between file cards, Left/Right collapse or expand the focused card, Return toggles it; focused cards are highlighted and scrolled into view, and the active pane is restored when leaving Diff Edit. - File cards use the file list's circular check style (empty / dash / check for none / partial / full selection); the selection badge now appears only for partial selections as 'N / M lines'. - SwiftUI cards render their diff at full content height with inner scrolling disabled, so the Diff Edit view scrolls as one surface. - SwiftUI Diff Edit state now lives in an observable DiffEditSession model; the view renders it. Every session load is pinned to the session's opening commit, so content that drifts mid-session (including in files no card ever rendered) fails the core staleness guard instead of being silently re-baselined. Done (keep-only- selected) strictly reloads every editable file through the shared DiffStore fetch sequence with errors propagated and absent file sides preserved, blocking with an alert on load failure or drift. - Select All computes selection diffs without syntax highlighting (compute_file_diff_full_plain): tree-sitter setup costs tens of milliseconds per file and selection only needs line structure, so bulk selection drops from ~20-40ms per file to ~0.1-1.2ms. - GPUI diff-edit code moved to a window/diff_edit folder module. - Docs: user guide, Help Book, shortcut cheatsheet, and shell-parity matrix updated.
Reworks the Diff Edit view in both shells so large changes stay scannable.
jj-diffcount_changed_lines,Repo::diff_file_stats) and matching the rendered diff rows exactly, including EOF-newline reconciliation.mod+alt+e/mod+alt+cshortcuts.j/kor Up/Down move between file cards, Left/Right collapse or expand the focused card, Return toggles it; focused cards are highlighted and scrolled into view, and the active pane is restored when leaving Diff Edit.DiffEditSessionmodel; every session load is pinned to the session's opening commit, so content that drifts mid-session (including in files no card ever rendered) fails the core staleness guard instead of being silently re-baselined. Done (keep-only-selected) strictly reloads every editable file through the shared DiffStore fetch sequence with errors propagated and absent file sides preserved, blocking with an alert on load failure or drift. The active pane is restored when leaving Diff Edit.compute_file_diff_full_plain): tree-sitter setup costs tens of milliseconds per file and selection only needs line structure, so bulk selection drops from ~20-40ms per file to ~0.1-1.2ms.From #127