Watch: snooze finished threads, name the files a file approval would edit, Settle on finished notifications, an instant launch from the saved feed, plain Loading states, and no more cancelled errors
Gateway / check (push) Successful in 9s
Gateway / image (push) Successful in 22s

Gateway: an approval push for a file change says which files it would edit
This commit is contained in:
gib committed 2026-11-02 14:45:34 -05:00
1 parent 4dc4e57dac
commit edc4b88990
35 files changed
+1162 -144

No files matched your search

+32 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, it } from "bun:test";
import { Notifier, type Push } from "../src/notify.ts";
import { approvalBody, Notifier, type Push } from "../src/notify.ts";
import type { T3Host } from "../src/t3/host.ts";
import type { ThreadShell } from "../src/t3/types.ts";
import { SummaryCache } from "../src/views.ts";
@@ -145,3 +145,34 @@ describe("question pushes", () => {
});
});
});
describe("approvalBody", () => {
const approval = (kind: string, files: Array<{ name: string; additions: number | null; deletions: number | null }>) => ({
id: "r-1",
kind,
prompt: "Edit: deploy/compose.yml",
reason: null,
options: [],
questions: [],
files: files.map((file) => ({ ...file, path: `deploy/${file.name}`, preview: [] })),
});
it("names the file a file approval would edit, with counts only when known", () => {
expect(approvalBody(approval("file-change", [{ name: "compose.yml", additions: 9, deletions: 6 }]))).toBe(
"Wants to edit compose.yml +9 \u22126",
);
expect(approvalBody(approval("file-change", [{ name: "compose.yml", additions: null, deletions: null }]))).toBe(
"Wants to edit compose.yml",
);
});
it("counts several files and lists their names", () => {
const files = ["compose.yml", "Containerfile", "health.ts"].map((name) => ({ name, additions: null, deletions: null }));
expect(approvalBody(approval("file-change", files))).toBe("Wants to edit 3 files: compose.yml, Containerfile, health.ts");
});
it("falls back to the prompt without files", () => {
expect(approvalBody(approval("file-change", []))).toBe("Wants to run: Edit: deploy/compose.yml");
expect(approvalBody(null)).toBe("Needs your approval.");
});
});