F3 polish: active-editor status bar + E2E for command wrapper and toggle (PUC-5) (#6)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-10 11:09:04 -07:00
parent 644e7b77a6
commit d85194224f
2 changed files with 31 additions and 1 deletions
+2
View File
@@ -326,8 +326,10 @@ export class AttributionController implements vscode.Disposable {
editor.setDecorations(this.humanType, humanRanges);
}
}
if (document === vscode.window.activeTextEditor?.document) {
this.renderStatus(s);
}
}
private renderStatus(s: DocAttribution | undefined): void {
const n = s?.orphans.length ?? 0;
+28
View File
@@ -131,4 +131,32 @@ suite("F3 live attribution (host E2E — seam-driven, no LLM)", () => {
assert.ok(!spans.some((s) => s.authorKind === "agent"), "mangled agent span not rendered");
assert.ok(api.attributionController.getOrphanCount(DOC_REL) >= 1, "…it is orphaned instead (INV-1)");
});
test("the applyAgentEdit command wrapper and the toggle command work end-to-end", async () => {
const doc = await openDoc();
const api = await getApi();
const anchor = "stable first paragraph";
const start = doc.getText().indexOf(anchor);
const ok = await vscode.commands.executeCommand<boolean>("cowriting.applyAgentEdit", {
uri: doc.uri.toString(),
start,
end: start + anchor.length,
newText: "stable COMMAND-EDITED paragraph",
model: "sonnet",
sessionId: "e2e-cmd",
turnId: "turn-e2e-cmd",
});
assert.strictEqual(ok, true, "command wrapper applies via the seam");
await settle();
const spans = api.attributionController.getSpans(DOC_REL);
const agent = spans.find((s) => s.turnId === "turn-e2e-cmd");
assert.ok(agent, "command-driven agent span exists");
assert.strictEqual(agent!.authorKind, "agent");
assert.strictEqual(api.attributionController.isVisible(), true);
await vscode.commands.executeCommand("cowriting.toggleAttribution");
assert.strictEqual(api.attributionController.isVisible(), false, "toggle hides (PUC-5)");
await vscode.commands.executeCommand("cowriting.toggleAttribution");
assert.strictEqual(api.attributionController.isVisible(), true, "toggle restores");
});
});