feat(FN-4966): complete Step 2 — add PrInfo conflict diagnostics shape
Fusion-Task-Id: FN-4966 Fusion-Task-Lineage: 8f5ea300-feaa-469c-aeed-f7304a5a1b6d
This commit is contained in:
@@ -868,6 +868,44 @@ describe("TaskStore", () => {
|
||||
expect(fetched.prInfo).toEqual(prInfo);
|
||||
});
|
||||
|
||||
it("round-trips PR conflict diagnostics and keeps the field optional", async () => {
|
||||
const task = await createTestTask();
|
||||
const prInfo = {
|
||||
url: "https://github.com/owner/repo/pull/42",
|
||||
number: 42,
|
||||
status: "open" as const,
|
||||
title: "Fix the bug",
|
||||
headBranch: "kb-001-fix-bug",
|
||||
baseBranch: "main",
|
||||
commentCount: 5,
|
||||
mergeable: "conflicting" as const,
|
||||
conflictDiagnostics: {
|
||||
conflictingFiles: ["packages/dashboard/src/github.ts"],
|
||||
suggestedCommands: ["git fetch origin", "git rebase origin/main"],
|
||||
capturedAt: "2026-05-18T00:00:00.000Z",
|
||||
},
|
||||
};
|
||||
|
||||
await store.updatePrInfo(task.id, prInfo);
|
||||
const fetched = await store.getTask(task.id);
|
||||
expect(fetched.prInfo).toEqual(prInfo);
|
||||
|
||||
const taskJsonPath = join(rootDir, ".fusion", "tasks", task.id, "task.json");
|
||||
const raw = await readFile(taskJsonPath, "utf-8");
|
||||
const serialized = JSON.parse(raw) as Task;
|
||||
expect(serialized.prInfo?.conflictDiagnostics?.conflictingFiles).toEqual(["packages/dashboard/src/github.ts"]);
|
||||
|
||||
const prInfoWithoutDiagnostics = {
|
||||
...prInfo,
|
||||
mergeable: "clean" as const,
|
||||
conflictDiagnostics: undefined,
|
||||
};
|
||||
await store.updatePrInfo(task.id, prInfoWithoutDiagnostics);
|
||||
|
||||
const fetchedWithoutDiagnostics = await store.getTask(task.id);
|
||||
expect(fetchedWithoutDiagnostics.prInfo?.conflictDiagnostics).toBeUndefined();
|
||||
});
|
||||
|
||||
it("updates updatedAt timestamp", async () => {
|
||||
const task = await createTestTask();
|
||||
const before = task.updatedAt;
|
||||
|
||||
@@ -742,6 +742,12 @@ Do NOT spend time on nits when no real issues exist.`,
|
||||
|
||||
export type PrConflictState = "clean" | "conflicting" | "behind" | "blocked" | "unknown";
|
||||
|
||||
export interface PrConflictDiagnostics {
|
||||
conflictingFiles: string[];
|
||||
suggestedCommands: string[];
|
||||
capturedAt: string;
|
||||
}
|
||||
|
||||
export interface PrInfo {
|
||||
url: string;
|
||||
number: number;
|
||||
@@ -758,6 +764,7 @@ export interface PrInfo {
|
||||
lastMergeErrorAt?: string;
|
||||
checkRollup?: "success" | "failure" | "pending" | "none";
|
||||
mergeable?: PrConflictState;
|
||||
conflictDiagnostics?: PrConflictDiagnostics;
|
||||
lastCommentAt?: string;
|
||||
lastCheckedAt?: string;
|
||||
lastReviewDecision?: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | null;
|
||||
|
||||
Reference in New Issue
Block a user