F6 #34: delete the dead two-pane diff-view UI, keep the baseline data layer

F10 (#29) made the rendered preview the single review surface and hid the F6
two-pane vscode.diff view (command + ctrl+alt+d set when:false). This removes
that now-unreachable view code:

- DiffViewController: drop toggle/findDiffTab/epochLabel/isDiffOpen, the
  `cowriting-baseline:` TextDocumentContentProvider + BASELINE_SCHEME + baselineUri
  + the content-provider change emitter, and the toggleDiffView command. The
  baseline DATA layer is fully intact — ensureBaseline/advance/pin/capture,
  getBaseline, baselineFilePath, onDidChangeBaseline, persistence (INV-19), and
  the machine-landing auto-advance (INV-18) that F7/F10 consume.
- package.json: remove the toggleDiffView command, its commandPalette entry, and
  the ctrl+alt+d keybinding.
- E2E: diffView suite keeps the baseline-data-layer tests, drops the two-pane
  view tests; the F10 + no-workspace suites assert toggleDiffView is now absent
  (was: declared-but-hidden).

Deliberate deviation from the issue's literal acceptance: pinDiffBaseline is
KEPT. The canonical Solution Design (coauthoring-interactive-review.md §6.7)
scopes the removal to the two-pane VIEW only ("keep the controller + baseline
store"); pin() lives in the baseline lifecycle (§6.4), never touches vscode.diff,
and is exercised by live F7 baseline-reset tests. Where the P3 capture draft and
the approved spec conflict, the spec wins (documentation-leads-automation).

194 unit + 49 E2E green; typecheck + build clean. No F7/F10 behavior change.

Closes #34

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-12 02:10:14 -07:00
parent fd263ec674
commit 3520397e41
6 changed files with 64 additions and 199 deletions
+17 -15
View File
@@ -40,8 +40,11 @@ suite("no-workspace authoring (F8 — real folder-less, #8 lineage)", () => {
"cowriting.toggleAttribution",
"cowriting.acceptProposal",
"cowriting.rejectProposal",
// #34: the F6 two-pane diff VIEW was removed (F10 preview is the single
// review surface); its toggle command is gone (the baseline store stays).
"cowriting.toggleDiffView",
]) {
assert.ok(!all.includes(retired), `${retired} is retired (F10 preview-only)`);
assert.ok(!all.includes(retired), `${retired} is retired`);
}
});
@@ -73,25 +76,24 @@ suite("no-workspace authoring (F8 — real folder-less, #8 lineage)", () => {
assert.strictEqual(api.sidecarRouter.sidecarPath(key), undefined, "untitled artifact is in-memory only (no disk)");
});
// F6 (#19) is workspace-INDEPENDENT: its commands are real (not stubs) even
// with no folder open, and the toggle works on an untitled buffer.
test("F6 toggle works with no folder open (untitled buffer)", async () => {
// F6 (#19) baseline data layer is workspace-INDEPENDENT: it captures a baseline
// for an untitled buffer even with no folder open (the two-pane VIEW was
// removed in #34; only the data layer remains). pinDiffBaseline stays real.
test("F6 baseline data layer works with no folder open (untitled buffer)", async () => {
const all = await vscode.commands.getCommands(true);
assert.ok(all.includes("cowriting.toggleDiffView"), "toggleDiffView registered");
assert.ok(all.includes("cowriting.pinDiffBaseline"), "pinDiffBaseline registered");
const ext = vscode.extensions.getExtension("benstull.vscode-cowriting-plugin")!;
const api = (await ext.activate()) as CowritingApi;
const untitled = await vscode.workspace.openTextDocument({ content: "no-folder scratch\n", language: "markdown" });
await vscode.window.showTextDocument(untitled);
await new Promise((r) => setTimeout(r, 300));
await vscode.commands.executeCommand("cowriting.toggleDiffView");
const key = untitled.uri.toString();
const baseline = api.diffViewController.getBaseline(key);
assert.ok(baseline, "baseline captured for the untitled buffer with no folder");
assert.strictEqual(baseline!.reason, "opened");
// pin resets the baseline to now — works folder-less.
await vscode.commands.executeCommand("cowriting.pinDiffBaseline");
await new Promise((r) => setTimeout(r, 300));
const opened = vscode.window.tabGroups.all.some((g) =>
g.tabs.some(
(t) =>
t.input instanceof vscode.TabInputTextDiff &&
t.input.original.scheme === "cowriting-baseline" &&
t.input.modified.toString() === untitled.uri.toString(),
),
);
assert.ok(opened, "a cowriting-baseline diff opened for the untitled buffer with no folder");
assert.strictEqual(api.diffViewController.getBaseline(key)!.reason, "pinned", "pin works with no folder");
});
});
+13 -51
View File
@@ -23,10 +23,13 @@ async function getApi(): Promise<CowritingApi> {
}
const settle = () => new Promise((r) => setTimeout(r, 300));
// Order-dependent (F2F4 pattern): later tests consume earlier state. Owns
// docs/diffview.md exclusively. F6 works on ANY file (#19), so the last two
// tests use an out-of-workspace file and an untitled buffer.
suite("F6 diff-view toggle (host E2E — any file, programmatic seam ingress, no LLM)", () => {
// The F6 two-pane vscode.diff VIEW was removed in #34 (F10's rendered preview is
// the single review surface); only the baseline DATA layer survives, consumed by
// F7/F10. This suite covers that data layer. Order-dependent (F2F4 pattern):
// later tests consume earlier state. Owns docs/diffview.md exclusively. The
// baseline works on ANY file (#19), so the last two tests use an out-of-workspace
// file and an untitled buffer.
suite("F6 baseline data layer (host E2E — any file, programmatic seam ingress, no LLM)", () => {
const TARGET = "A target sentence Claude will rewrite via the seam.";
const REPLACEMENT = "A SENTENCE CLAUDE REWROTE via the seam.";
@@ -40,21 +43,6 @@ suite("F6 diff-view toggle (host E2E — any file, programmatic seam ingress, no
assert.strictEqual(baseline!.text, doc.getText(), "baseline = open-time buffer");
});
test("toggle opens a diff tab (original scheme cowriting-baseline) over the live doc (PUC-1)", async () => {
const api = await getApi();
assert.strictEqual(api.diffViewController.isDiffOpen(docUri()), false, "no diff open yet");
await vscode.commands.executeCommand("cowriting.toggleDiffView");
await settle();
assert.strictEqual(api.diffViewController.isDiffOpen(docUri()), true, "diff tab open");
const active = vscode.window.tabGroups.activeTabGroup.activeTab;
assert.ok(active && active.input instanceof vscode.TabInputTextDiff, "active tab is a diff");
assert.strictEqual(
(active!.input as vscode.TabInputTextDiff).original.scheme,
"cowriting-baseline",
"left side served by the baseline provider",
);
});
test("typing leaves the baseline unchanged while the buffer diverges", async () => {
const doc = await openDoc();
const api = await getApi();
@@ -105,17 +93,17 @@ suite("F6 diff-view toggle (host E2E — any file, programmatic seam ingress, no
);
});
test("pin resets the baseline to now: baseline == buffer, reason pinned (PUC-3)", async () => {
test("pin resets the baseline to now: baseline == buffer, reason pinned", async () => {
const doc = await openDoc();
const api = await getApi();
await vscode.commands.executeCommand("cowriting.pinDiffBaseline");
await settle();
const baseline = api.diffViewController.getBaseline(docUri())!;
assert.strictEqual(baseline.reason, "pinned");
assert.strictEqual(baseline.text, doc.getText(), "pinned baseline == current buffer (diff empties)");
assert.strictEqual(baseline.text, doc.getText(), "pinned baseline == current buffer (change-marks empty)");
});
test("the baseline is persisted in GLOBAL storage, never the repo (PUC-4, INV-19)", async () => {
test("the baseline is persisted in GLOBAL storage, never the repo (INV-19)", async () => {
await openDoc();
const api = await getApi();
const p = api.diffViewController.baselineFilePath(docUri());
@@ -131,25 +119,7 @@ suite("F6 diff-view toggle (host E2E — any file, programmatic seam ingress, no
assert.ok(p!.includes(`${path.sep}baselines${path.sep}`), "baseline lives under <globalStorage>/baselines/");
});
test("toggle again closes the diff tab and reveals the normal editor (PUC-1)", async () => {
const api = await getApi();
if (!api.diffViewController.isDiffOpen(docUri())) {
await openDoc();
await vscode.commands.executeCommand("cowriting.toggleDiffView");
await settle();
}
assert.strictEqual(api.diffViewController.isDiffOpen(docUri()), true, "diff open before close");
await vscode.commands.executeCommand("cowriting.toggleDiffView");
await settle();
assert.strictEqual(api.diffViewController.isDiffOpen(docUri()), false, "diff tab closed");
assert.strictEqual(
vscode.window.activeTextEditor?.document.uri.toString(),
docUri(),
"the normal editor for the doc is active after closing the diff",
);
});
test("toggle works on a file OUTSIDE the workspace folder, persisted in global storage (#19)", async () => {
test("a baseline is captured + persisted for a file OUTSIDE the workspace folder (#19)", async () => {
const api = await getApi();
const outsideDir = fs.mkdtempSync(path.join(os.tmpdir(), "cowriting-outside-"));
const outsidePath = path.join(outsideDir, "outside.md");
@@ -162,19 +132,14 @@ suite("F6 diff-view toggle (host E2E — any file, programmatic seam ingress, no
const baseline = api.diffViewController.getBaseline(outsideUri.toString());
assert.ok(baseline, "baseline captured for an out-of-folder file");
assert.strictEqual(baseline!.reason, "opened");
await vscode.commands.executeCommand("cowriting.toggleDiffView");
await settle();
assert.strictEqual(api.diffViewController.isDiffOpen(outsideUri.toString()), true, "diff opens for the outside file");
const fp = api.diffViewController.baselineFilePath(outsideUri.toString());
assert.ok(fp && fs.existsSync(fp), "outside-file baseline persisted in global storage");
assert.ok(!fp!.startsWith(WS + path.sep), "not under the workspace folder");
// close it so it doesn't bleed into the untitled test's active-tab checks
await vscode.commands.executeCommand("cowriting.toggleDiffView");
await settle();
fs.rmSync(outsideDir, { recursive: true, force: true });
void doc;
});
test("toggle works on an UNTITLED buffer, baseline in-memory only (#19)", async () => {
test("an UNTITLED buffer gets an in-memory baseline, never persisted to disk (#19)", async () => {
const api = await getApi();
const untitled = await vscode.workspace.openTextDocument({ content: "scratch line\n", language: "markdown" });
await vscode.window.showTextDocument(untitled);
@@ -184,8 +149,5 @@ suite("F6 diff-view toggle (host E2E — any file, programmatic seam ingress, no
const baseline = api.diffViewController.getBaseline(key);
assert.ok(baseline, "untitled buffer got an in-memory baseline");
assert.strictEqual(api.diffViewController.baselineFilePath(key), undefined, "untitled is NOT persisted to disk");
await vscode.commands.executeCommand("cowriting.toggleDiffView");
await settle();
assert.strictEqual(api.diffViewController.isDiffOpen(key), true, "diff opens for the untitled buffer");
});
});
+8 -5
View File
@@ -215,16 +215,19 @@ suite("F10 interactive review (host E2E — preview is the single review surface
api.attributionController.getSpans("docs/f10clean.md").some((s) => s.authorKind === "agent"),
"agent span recorded (attribution data layer intact)",
);
// the retired toggle is gone from the palette (no editor decorations — INV-32).
// the retired in-editor surfaces are gone from the palette (no editor decorations — INV-32).
const all = await vscode.commands.getCommands(true);
assert.ok(!all.includes("cowriting.toggleAttribution"), "cowriting.toggleAttribution is retired");
// the F6 diff toggle's keybinding is hidden (when:false) — it is not a user surface.
// #34: the F6 two-pane diff VIEW was removed (F10 preview is the single review
// surface) — its toggle command + ctrl+alt+d keybinding are gone entirely.
assert.ok(!all.includes("cowriting.toggleDiffView"), "cowriting.toggleDiffView command is gone (#34)");
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "../../../../package.json"), "utf8"));
const dKb = (pkg.contributes.keybindings as Array<{ command: string; key: string; when?: string }>).find(
(k) => k.command === "cowriting.toggleDiffView" && k.key === "ctrl+alt+d",
(k) => k.command === "cowriting.toggleDiffView",
);
assert.ok(dKb, "the ctrl+alt+d toggleDiffView keybinding is declared");
assert.strictEqual(dKb!.when, "false", "…but hidden (when:false) — F6 is a data layer, not a user surface");
assert.ok(!dKb, "the toggleDiffView keybinding is gone from package.json (#34)");
// …but the F6 baseline data layer survives: pinDiffBaseline stays a real command.
assert.ok(all.includes("cowriting.pinDiffBaseline"), "pinDiffBaseline (baseline data layer) is kept");
void key;
});
});