fix(fusion): persist priority changes from PATCH /tasks/:id

The dashboard task-edit route destructured every editable body field
except priority, so changing priority via the task-detail modal was
silently dropped before reaching store.updateTask. Wire priority
through with isTaskPriority validation (null resets to default).

Without this fix the priority-aware triage/scheduler/merge ordering
shipped previously had no effect for tasks edited in the dashboard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-01 15:57:38 -07:00
parent c08a872169
commit e72eff47e9
3 changed files with 50 additions and 2 deletions

View File

@@ -3188,6 +3188,40 @@ describe("PATCH /tasks/:id", () => {
expect(res.body.dependencies).toEqual(["FN-002"]);
});
it("forwards priority to store.updateTask", async () => {
const updatedTask = { ...FAKE_TASK_DETAIL, priority: "high" as const };
(store.updateTask as ReturnType<typeof vi.fn>).mockResolvedValue(updatedTask);
const res = await REQUEST(buildApp(), "PATCH", "/api/tasks/KB-001", JSON.stringify({ priority: "high" }), {
"Content-Type": "application/json",
});
expect(res.status).toBe(200);
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { priority: "high" });
expect(res.body.priority).toBe("high");
});
it("forwards priority=null to store.updateTask (resets to default)", async () => {
const updatedTask = { ...FAKE_TASK_DETAIL, priority: "normal" as const };
(store.updateTask as ReturnType<typeof vi.fn>).mockResolvedValue(updatedTask);
const res = await REQUEST(buildApp(), "PATCH", "/api/tasks/KB-001", JSON.stringify({ priority: null }), {
"Content-Type": "application/json",
});
expect(res.status).toBe(200);
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { priority: null });
});
it("rejects unknown priority values with 400", async () => {
const res = await REQUEST(buildApp(), "PATCH", "/api/tasks/KB-001", JSON.stringify({ priority: "medium" }), {
"Content-Type": "application/json",
});
expect(res.status).toBe(400);
expect(store.updateTask).not.toHaveBeenCalled();
});
it("returns 409 when changing nodeId on an in-progress task", async () => {
(store.getTask as ReturnType<typeof vi.fn>).mockResolvedValue({
...FAKE_TASK_DETAIL,