feat: open Changes as a workspace tab (#2298)

Open the complete working comparison in a desktop workspace tab while preserving inline sidebar diffs when the tab is closed.

Working and commit comparisons share one diff panel, and workspace layout is the sole owner of live tab persistence and identity.

Refs #1520
This commit is contained in:
nikuscs
2026-07-22 20:57:18 +02:00
committed by GitHub
parent 76a5edb020
commit 512c9b31a8
61 changed files with 1581 additions and 2012 deletions
@@ -44,6 +44,42 @@ describe("provider subagent tab identity", () => {
});
});
describe("working diff tab identity", () => {
const target = {
kind: "working_diff" as const,
focusPath: "src/example.ts",
focusRequestId: 1,
};
it("normalizes file focus navigation", () => {
expect(
normalizeWorkspaceTabTarget({
...target,
focusPath: " src\\example.ts ",
}),
).toEqual(target);
});
it("treats focus as navigation state rather than tab identity", () => {
expect(workspaceTabTargetsEqual(target, target)).toBe(true);
expect(workspaceTabTargetsEqual(target, { ...target, focusPath: "src/other.ts" })).toBe(false);
expect(workspaceTabTargetsEqual(target, { ...target, focusRequestId: 2 })).toBe(false);
const workingDiffId = buildDeterministicWorkspaceTabId(target);
const otherFocusId = buildDeterministicWorkspaceTabId({
...target,
focusPath: "src/other.ts",
});
const fileId = buildDeterministicWorkspaceTabId({
kind: "file",
path: target.focusPath,
});
expect(workingDiffId).toBe("working_diff");
expect(workingDiffId).toBe(otherFocusId);
expect(workingDiffId).not.toBe(fileId);
});
});
describe("commit diff tab identity", () => {
it("keys a commit diff tab by its sha", () => {
expect(buildDeterministicWorkspaceTabId({ kind: "commit_diff", sha: "abc123" })).toBe(