Q155: batch approval decides one request at a time and reports each result
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ec183ec60e
commit
41359e268a
5 files changed
+138
-14
No files matched your search
@@ -118,6 +118,20 @@ test("the pinned CEO conversation is the Messages front door", async () => {
|
||||
await page.getByRole("button", { name: "Review" }).first().click();
|
||||
await expect(review.getByRole("textbox", { name: "Decision notes" })).toHaveValue("");
|
||||
await review.getByRole("button", { name: "Close" }).click();
|
||||
// A batch approval says how far it got, item by item.
|
||||
await page.evaluate(async () => {
|
||||
const api = (window as unknown as { agentCompany: {
|
||||
loadSnapshot: () => Promise<{ ok: true; data: { activeOrgId: string } }>;
|
||||
createApproval: (input: unknown) => Promise<{ ok: boolean }>;
|
||||
} }).agentCompany;
|
||||
const orgId = (await api.loadSnapshot()).data.activeOrgId;
|
||||
for (const title of ["Order stickers", "Renew the domain"]) {
|
||||
await api.createApproval({ orgId, kind: "purchase", title, details: "Small spend.", risk: "low", requestedByType: "system", requestedById: null });
|
||||
}
|
||||
});
|
||||
await expect(page.getByText("Renew the domain")).toBeVisible();
|
||||
await page.getByRole("button", { name: "Approve all low risk" }).click();
|
||||
await expect(page.getByRole("status").filter({ hasText: "Approved" })).toContainText("Approved 2 of 2.");
|
||||
await page.getByRole("button", { name: "Work" }).click();
|
||||
await page.getByRole("button", { name: /Operationalize goal: Ship the FlowPilot MVP\./ }).first().click();
|
||||
// Blocking says why on the task and stops it; work can also move backwards.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { decideEach } from "../../src/renderer/src/pages/approvals/decide-each";
|
||||
|
||||
describe("deciding several requests", () => {
|
||||
test("decides one at a time, reports progress, and returns each result", async () => {
|
||||
const order: string[] = [];
|
||||
const progress: number[] = [];
|
||||
const result = await decideEach(
|
||||
[{ id: "a", title: "A" }, { id: "b", title: "B" }, { id: "c", title: "C" }],
|
||||
async (item) => {
|
||||
order.push(item.id);
|
||||
if (item.id === "b") throw new Error("Approval was already decided.");
|
||||
},
|
||||
(done) => progress.push(done),
|
||||
);
|
||||
expect(order).toEqual(["a", "b", "c"]);
|
||||
expect(progress).toEqual([1, 2, 3]);
|
||||
expect(result).toEqual({ approved: ["a", "c"], failed: [{ id: "b", title: "B", reason: "Approval was already decided." }] });
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user