Repository navigation
feat(native): open a file change's tool-call diff from the transcript - #62
Merged
Merged
Conversation
Owner
Author
|
Review round 1, all three findings were real; fixed in 7a471aa:
|
This was referenced Nov 2, 2026
Open
This was referenced Nov 2, 2026
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.
Refs #58. Ledger row TR-DIFF is now
partial: side chats do not offer the diff yet (see Gaps), so #58 stays open for that.Problem
On the web, a
file_changework row's details have an Open diff button that opens the diff panel on that one tool call's recorded patch (selectToolCall,DiffPanel.tsx's tool-call scope). Native had no way to see what a single tool call changed: the diff panel only offered the git and turn scopes.Approach
crates/core/src/diff/tool_call.rs,diff/whitespace.rs,diff/scope.rs), ported fromlib/toolCallDiff.ts,diffPanelStore.tsanddiffRendering.ts:tool_call_diff: complete patches stay as recorded; bare hunks getdiff --git/---/+++headers (renames usechanges[0].oldPath); recorded add/delete contents become one all-added or all-deleted hunk unless the patch already covers every recorded file one-sidedly; the transport truncation marker is dropped and reported; content recorded without a diff is returned for the panel to show.ToolCallTargetandresolve(resolveToolCallDiffTarget): the fetch is keyed byturnItemDetailRevisionof the row the thread shows now, so a change opened while running is fetched again when it settles.DiffSelection::ToolCallpersists as the web's{"kind":"tool-call",threadId,itemId,revision};DiffScope::ToolCalllabels "Tool call".hide_whitespace_changes(hideWhitespaceChanges): the whitespace toggle (default on, as on the web) applies to a tool call's patch client-side, re-diffing each hunk with whitespace removed (Myers, bounded at 1,000 edits per hunk).crates/app/src/diff/): the tool-call scope fetchesorchestration.getTurnItemon the network runtime and parses both whitespace variants there, so the toggle only swaps them. It works outside a git repository (!isGitRepo && !toolCallSelection), shows the web's banners ("This preview exceeds the size limit…", "This tool call changed N files. The recorded patch omits M of them."), the error line, "The provider recorded file content without a diff." with "Recorded content before/after" and "Empty content.", the loading skeleton, and "No net changes in this selection." / "No patch available for this selection.". Folds are kept pertool-call:<thread>:<item>scope. A newer revision of a loaded tool call keeps the old patch on screen but is always fetched, including one requested while the panel was hidden (needs_fetch). The way back is the scope menu (Changes, Uncommitted, Latest turn, Turn), where no entry is checked while a tool call is shown, as on the web.xsoutline Open diff button in the expanded file-change details (V2ItemInspector.tsx), wired throughThreadView::open_tool_call_diff→AppState::open_tool_call_diff. Thework.rschange is the button and aContext<ThreadView>onentry_details. Only the open thread's transcript offers it (see Gaps). The web has no menu, palette or keybinding entry for this.--click x,y(repeatable) so offscreen captures can drive a row and a button; documented intest-t3-native.Evidence
Offscreen snapshots against the smoke server (thread "Write Approval Demo File", 1440x900 @2x, dark):
/private/tmp/claude-501/-Volumes-DevSSD-t3code-native/3ca997f3-68be-482e-8fff-7893917dbe2a/scratchpad/pr58/before-row.pngdiffFilesCollapsed):/private/tmp/claude-501/-Volumes-DevSSD-t3code-native/3ca997f3-68be-482e-8fff-7893917dbe2a/scratchpad/pr58/after-open.png/private/tmp/claude-501/-Volumes-DevSSD-t3code-native/3ca997f3-68be-482e-8fff-7893917dbe2a/scratchpad/pr58/after-diff.png/private/tmp/claude-501/-Volumes-DevSSD-t3code-native/3ca997f3-68be-482e-8fff-7893917dbe2a/scratchpad/pr58/after-menu.png/private/tmp/claude-501/-Volumes-DevSSD-t3code-native/3ca997f3-68be-482e-8fff-7893917dbe2a/scratchpad/pr58/after-back.pngTests (
crates/core/src/diff/tests.rs, ports oftoolCallDiff.test.tsplus the target and whitespace logic):tool_call_hunks_get_file_headers_including_renamed_paths,tool_call_added_and_deleted_contents_become_one_sided_hunks,tool_call_content_without_a_diff_is_kept_out_of_the_patch,tool_call_drops_transport_truncation_markers,tool_call_keeps_complete_patches_and_unsupported_output,tool_call_target_follows_the_row_the_thread_shows,hiding_whitespace_turns_whitespace_only_edits_into_context; and incrates/app/src/diff/source.rs,a_newer_revision_shows_the_old_patch_but_is_still_fetched(fails under the oldsame_sourcefreshness rule).Gates:
cargo clippy --workspace --all-targets -- -D warnings(and with--features snapshot),cargo test --workspace,node scripts/gen-theme.ts --check,node --test parity/sync.test.ts,node ../../apps/native/conformance/generate.ts --checkall pass.Gaps
reviewSectionTitle("Tool call") only titles diff review comments, which native does not have (DF-COMMENTS).getTurnItem; those paths are covered by the core tests.