test(FN-4892): complete Step 7 — expand intake reliability scenarios

Fusion-Task-Id: FN-4892
Fusion-Task-Lineage: 6f56b468-a827-416d-ba1f-444e1326d613
This commit is contained in:
Fusion (runfusion.ai)
2026-05-18 00:22:18 -07:00
committed by gsxdsm
parent 619070388b
commit 02f571d0cf
2 changed files with 59 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ async function createStore() {
describe("reliability interactions: same-agent duplicate intake", () => {
const fixtures: Array<Awaited<ReturnType<typeof createStore>>> = [];
afterEach(async () => {
vi.useRealTimers();
vi.restoreAllMocks();
while (fixtures.length) await fixtures.pop()!.cleanup();
});
@@ -47,6 +48,25 @@ describe("reliability interactions: same-agent duplicate intake", () => {
expect((entry?.metadata as { siblingTaskIds?: string[] } | null)?.siblingTaskIds).toEqual([a.id]);
});
it("does not archive similar tasks from different agents", async () => {
const fx = await createStore();
fixtures.push(fx);
const a = await fx.store.createTask({
title: "fix: secrets sync typecheck",
description: "typecheck error in secrets-sync",
source: { sourceType: "agent", sourceAgentId: "agent-x" },
});
const b = await fx.store.createTask({
title: "fix: secrets sync typecheck regression",
description: "typecheck error in secrets-sync",
source: { sourceType: "agent", sourceAgentId: "agent-y" },
});
expect((await fx.store.getTask(a.id)).column).toBe("triage");
expect((await fx.store.getTask(b.id)).column).toBe("triage");
});
it("does not archive unrelated tasks", async () => {
const fx = await createStore();
fixtures.push(fx);
@@ -66,6 +86,29 @@ describe("reliability interactions: same-agent duplicate intake", () => {
expect((await fx.store.getTask(b.id)).column).toBe("triage");
});
it("does not archive similar tasks outside the 24h window", async () => {
const fx = await createStore();
fixtures.push(fx);
vi.useFakeTimers();
const start = new Date("2026-01-01T00:00:00.000Z");
vi.setSystemTime(start);
const a = await fx.store.createTask({
title: "fix: secrets sync typecheck",
description: "typecheck error in secrets-sync",
source: { sourceType: "agent", sourceAgentId: "agent-x" },
});
vi.setSystemTime(new Date(start.getTime() + 25 * 60 * 60 * 1000));
const b = await fx.store.createTask({
title: "fix: secrets sync typecheck regression",
description: "typecheck error in secrets-sync",
source: { sourceType: "agent", sourceAgentId: "agent-x" },
});
expect((await fx.store.getTask(a.id)).column).toBe("triage");
expect((await fx.store.getTask(b.id)).column).toBe("triage");
});
it("fails open when duplicate detection throws", async () => {
const fx = await createStore();
fixtures.push(fx);

View File

@@ -82,6 +82,22 @@ describe("reliability interactions: ghost-bug preflight", () => {
expect(updated.column).toBe("todo");
});
it("keeps task when title is non-bug-shape and no constructs are cited", async () => {
const fx = await createFixture();
fixtures.push(fx);
const task = await fx.store.createTask({ title: "chore: dependency refresh", description: "typecheck error still reported", prompt: "draft" });
await (fx.triage as any).finalizeApprovedTask(
task,
`${basePrompt}\nNo code construct citation here.\n`,
await fx.store.getSettings(),
{},
);
const updated = await fx.store.getTask(task.id);
expect(updated.column).toBe("todo");
});
it("fails open when probe throws", async () => {
const fx = await createFixture();
fixtures.push(fx);