test(mcp): assert snapshot-import and unknown-receipt facts instead of guidance prose (#11004)

This commit is contained in:
morluto authored and GitHub committed 2026-11-15 17:58:12 +08:00
1 parent b3cdbb92ee
commit 4a13082efc
2 files changed
+10 -15

No files matched your search

@@ -193,7 +193,6 @@ it("rejects divergent imported histories without suggesting an unchanged retry",
expect(parseMcpToolError(conflict).error).toMatchObject({
code: "evidence_integrity_mismatch",
retryable: false,
remediation: { action: expect.stringContaining("cannot reconcile") },
details: { diagnostics: { unknown_id: initial.unknown_id, revision: 2 } },
});
const after = await client.callTool({
@@ -569,9 +568,6 @@ it("reports contradictory unknown input as a correctable request", async () => {
category: "invalid_input",
retryable: false,
details: { reason: "already-exists" },
remediation: {
action: expect.stringContaining("do not repeat record_unknown"),
},
});
const evidenceId = created.mutation_evidence_ids[0];
@@ -679,17 +675,11 @@ it("returns exact committed unknown receipts when creation and update replies ov
},
},
},
remediation: {
action: expect.stringContaining(
"Do not repeat the completed mutation",
),
},
},
});
const recovery = parseMcpToolError(response).error.remediation.action;
expect(recovery).toContain("export_evidence_bundle");
expect(recovery).not.toContain("or page list_unknowns");
expect(recovery).toContain("may be too large");
for (const id of unknown.mutation_evidence_ids)
expect(session.evidenceById(id)).toBeDefined();
};
@@ -792,12 +792,14 @@ const expectSnapshotImportGuidance = async (mcp: Client, path: string) => {
arguments: { path },
});
const error = parseMcpToolError(imported).error;
expect(error.code).toBe("invalid_request");
expect(error).toMatchObject({
code: "invalid_request",
details: { operation: "read", reason: "wrong-kind" },
});
// No structured field names the detected snapshot; its restore routes do.
expect(error.remediation.action).toContain("open_binary");
expect(error.remediation.action).toContain("snapshot_path");
expect(error.remediation.action).toContain("--snapshot");
expect(error.remediation.action).toContain("loads and updates");
expect(error.remediation.action).toContain("not been validated");
expect((await readFile(path)).equals(before)).toBe(true);
};
@@ -826,8 +828,11 @@ it("does not authenticate snapshot-shaped or unrelated malformed bundle input",
arguments: { path: snapshotPath },
}),
).error;
expect(snapshotLike.code).toBe("invalid_request");
expect(snapshotLike.remediation.action).toContain("not been validated");
expect(snapshotLike).toMatchObject({
code: "invalid_request",
details: { operation: "read", reason: "wrong-kind" },
});
expect(snapshotLike.remediation.action).toContain("snapshot_path");
await writeFile(
snapshotPath,