fix(tickets): normalise createdBy manquant sur les payloads legacy
Les tickets legacy sans champ createdBy faisaient noircir la fenêtre tickets côté frontend. Les adapters (ticket.ts, streamGateways.ts) normalisent désormais ce champ absent, avec couverture de test dédiée. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -55,7 +55,7 @@ describe("TauriTicketGateway invoke payloads", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("normalizes legacy ticket list rows that omit assignedAgentIds", async () => {
|
||||
it("normalizes legacy ticket list rows that omit assignedAgentIds and createdBy", async () => {
|
||||
invoke.mockResolvedValueOnce({
|
||||
items: [
|
||||
{
|
||||
@ -64,7 +64,6 @@ describe("TauriTicketGateway invoke payloads", () => {
|
||||
title: "Legacy row",
|
||||
status: "open",
|
||||
priority: "medium",
|
||||
createdBy: { kind: "user" },
|
||||
updatedAt: 1,
|
||||
},
|
||||
],
|
||||
@ -73,6 +72,7 @@ describe("TauriTicketGateway invoke payloads", () => {
|
||||
const list = await new TauriTicketGateway().list("proj-1");
|
||||
|
||||
expect(list.items[0]?.assignedAgentIds).toEqual([]);
|
||||
expect(list.items[0]?.createdBy).toEqual({ kind: "user" });
|
||||
});
|
||||
|
||||
it("wraps ticket attachment commands in the request DTO", async () => {
|
||||
@ -118,7 +118,7 @@ describe("TauriTicketGateway invoke payloads", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("normalizes legacy ticket payloads that omit array fields", async () => {
|
||||
it("normalizes legacy ticket payloads that omit array fields and actors", async () => {
|
||||
invoke.mockResolvedValueOnce({
|
||||
id: "issue-1",
|
||||
ref: "#12",
|
||||
@ -127,8 +127,6 @@ describe("TauriTicketGateway invoke payloads", () => {
|
||||
description: "",
|
||||
status: "open",
|
||||
priority: "medium",
|
||||
createdBy: { kind: "user" },
|
||||
updatedBy: { kind: "user" },
|
||||
createdAt: 1,
|
||||
updatedAt: 1,
|
||||
version: 1,
|
||||
@ -139,5 +137,29 @@ describe("TauriTicketGateway invoke payloads", () => {
|
||||
expect(ticket.links).toEqual([]);
|
||||
expect(ticket.assignedAgentIds).toEqual([]);
|
||||
expect(ticket.attachments).toEqual([]);
|
||||
expect(ticket.createdBy).toEqual({ kind: "user" });
|
||||
expect(ticket.updatedBy).toEqual({ kind: "user" });
|
||||
});
|
||||
|
||||
it("normalizes malformed ticket actors", async () => {
|
||||
invoke.mockResolvedValueOnce({
|
||||
id: "issue-1",
|
||||
ref: "#12",
|
||||
number: 12,
|
||||
title: "Legacy",
|
||||
description: "",
|
||||
status: "open",
|
||||
priority: "medium",
|
||||
createdBy: { kind: "agent" },
|
||||
updatedBy: { kind: "unknown" },
|
||||
createdAt: 1,
|
||||
updatedAt: 1,
|
||||
version: 1,
|
||||
});
|
||||
|
||||
const ticket = await new TauriTicketGateway().read("proj-1", "#12", true);
|
||||
|
||||
expect(ticket.createdBy).toEqual({ kind: "user" });
|
||||
expect(ticket.updatedBy).toEqual({ kind: "user" });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user