FN-5677: add per-task auto-merge override controls
Add dashboard and API support to set or clear per-task auto-merge overrides during review. - add TaskReviewTab UI controls and styles for selecting or clearing an auto-merge override - wire legacy dashboard API request handling for task auto-merge override updates - update task workflow routes to persist override operations - add dashboard and route tests covering set/clear override behavior Files changed: packages/dashboard/app/__tests__/api-tasks.test.ts | 26 +++++++++ packages/dashboard/app/api/legacy.ts | 1 + packages/dashboard/app/components/TaskReviewTab.css | 17 ++++++ packages/dashboard/app/components/TaskReviewTab.tsx | 55 +++++++++++++++++- packages/dashboard/app/components/__tests__/TaskReviewTab.test.tsx | 48 ++++++++++++++++ packages/dashboard/src/__tests__/routes-tasks-ops.test.ts | 65 ++++++++++++++++++++++ packages/dashboard/src/routes/register-task-workflow-routes.ts | 7 ++- 7 files changed, 216 insertions(+), 3 deletions(-) Fusion-Task-Id: FN-5677 Fusion-Task-Lineage: 4503e605-1190-4a32-8736-dd11eb2756b8
This commit is contained in:
@@ -2953,6 +2953,71 @@ describe("PATCH /tasks/:id", () => {
|
||||
const updateArg = (store.updateTask as ReturnType<typeof vi.fn>).mock.calls[0][1];
|
||||
expect(updateArg).not.toHaveProperty("executionMode");
|
||||
});
|
||||
|
||||
it("forwards autoMerge to store.updateTask", async () => {
|
||||
(store.updateTask as ReturnType<typeof vi.fn>).mockResolvedValue({
|
||||
...FAKE_TASK_DETAIL,
|
||||
autoMerge: true,
|
||||
});
|
||||
|
||||
const res = await REQUEST(buildApp(), "PATCH", "/api/tasks/KB-001", JSON.stringify({
|
||||
autoMerge: true,
|
||||
}), {
|
||||
"Content-Type": "application/json",
|
||||
});
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
expect(store.updateTask).toHaveBeenCalledWith("KB-001", {
|
||||
autoMerge: true,
|
||||
});
|
||||
});
|
||||
|
||||
it("accepts null to clear autoMerge via PATCH", async () => {
|
||||
(store.updateTask as ReturnType<typeof vi.fn>).mockResolvedValue({
|
||||
...FAKE_TASK_DETAIL,
|
||||
autoMerge: undefined,
|
||||
});
|
||||
|
||||
const res = await REQUEST(buildApp(), "PATCH", "/api/tasks/KB-001", JSON.stringify({
|
||||
autoMerge: null,
|
||||
}), {
|
||||
"Content-Type": "application/json",
|
||||
});
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
expect(store.updateTask).toHaveBeenCalledWith("KB-001", {
|
||||
autoMerge: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
it("returns 400 for invalid autoMerge value via PATCH", async () => {
|
||||
const res = await REQUEST(buildApp(), "PATCH", "/api/tasks/KB-001", JSON.stringify({
|
||||
autoMerge: "yes",
|
||||
}), {
|
||||
"Content-Type": "application/json",
|
||||
});
|
||||
|
||||
expect(res.status).toBe(400);
|
||||
expect(res.body.error).toContain("autoMerge must be a boolean");
|
||||
});
|
||||
|
||||
it("omission does not overwrite autoMerge via PATCH", async () => {
|
||||
const existingTask = {
|
||||
...FAKE_TASK_DETAIL,
|
||||
autoMerge: false,
|
||||
};
|
||||
(store.updateTask as ReturnType<typeof vi.fn>).mockResolvedValue(existingTask);
|
||||
|
||||
const res = await REQUEST(buildApp(), "PATCH", "/api/tasks/KB-001", JSON.stringify({
|
||||
title: "Updated Title",
|
||||
}), {
|
||||
"Content-Type": "application/json",
|
||||
});
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
const updateArg = (store.updateTask as ReturnType<typeof vi.fn>).mock.calls[0][1];
|
||||
expect(updateArg).not.toHaveProperty("autoMerge");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user