test(errors): assert recovery kind and retryability instead of remediation prose (#10791)

Input-contract and timeout failures already carry structured recovery
(recovery.kind, operation, timeout_ms) and retryable. Tests pinned the
remediation and message sentences beside those fields, and banned phrases
from earlier wording. Assert the structured facts instead; keep caller data
and protocol values such as operation names and tools/list.

Refs #10508
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 15:11:25 +08:00
1 parent fa53f7070a
commit 8d7eaf9693
4 files changed
+3 -28

No files matched your search

+3 -18
View File
@@ -110,8 +110,9 @@ describe("agent recovery metadata", () => {
expect(projected).toMatchObject({
code: "invalid_request",
retryable: false,
remediation: {
action: expect.stringContaining("Do not repeat the unchanged call."),
recovery: {
kind: "inspect_input_contract",
operation: "extract_firmware",
},
});
expect(analysisErrorProjectionSchema.parse(projected)).toEqual(projected);
@@ -126,9 +127,6 @@ describe("agent recovery metadata", () => {
category: "invalid_input",
retryable: false,
details: { reason: "already-exists" },
remediation: {
action: expect.stringContaining("do not repeat record_unknown"),
},
});
expect(analysisErrorProjectionSchema.parse(duplicate)).toEqual(duplicate);
expect(
@@ -187,8 +185,6 @@ describe("agent recovery metadata", () => {
},
});
expect(projected.remediation.action).toContain("tools/list");
expect(projected.remediation.action).toMatch(/correct.*fields.*retry/iu);
expect(projected.remediation.action).toMatch(/not repeat.*unchanged/iu);
expect(analysisErrorProjectionSchema.parse(projected)).toEqual(projected);
});
@@ -236,18 +232,7 @@ describe("agent recovery metadata", () => {
operation: "inspect_binary_layout",
timeout_ms: 2_500,
},
message: expect.stringContaining("server/provider deadline"),
remediation: {
action: expect.stringContaining("provider diagnostics"),
},
});
expect(projected.message).toContain("not a client-side timeout");
expect(projected.remediation.action).not.toContain(
"raise its tool deadline",
);
expect(projected.remediation.action).not.toMatch(
/declared timeout controls|larger server\/provider budget|without assuming adjustable limits|do not assume adjustable/u,
);
expect(analysisErrorProjectionSchema.parse(projected)).toEqual(projected);
});
});
@@ -195,10 +195,6 @@ cliTest(
expect(parseMcpToolError(response)).toMatchObject({
error: {
code: "provider_timeout",
message: expect.stringContaining("server/provider deadline"),
remediation: {
action: expect.stringContaining("MCP client"),
},
recovery: {
kind: "inspect_timeout_state",
operation: "analyze_javascript_application",
@@ -58,11 +58,8 @@ const expectMissingInputFailureText = (text: string, path: string): void => {
for (const value of [
"invalid_request",
"invalid_input",
"Read the declared input schema or CLI usage",
"trace-application-feature",
"tools/list",
"Correct the listed fields, then retry.",
"Do not repeat the unchanged call.",
"inspect_input_contract",
path,
"read-failed",
@@ -781,9 +781,6 @@ it("preserves graph constraint facts and rejects atomically until input is corre
category: "invalid_input",
retryable: false,
details: { reason: "constraint", constraint },
remediation: {
action: expect.stringContaining("Do not repeat the unchanged call"),
},
});
expect(await good("get_evidence_bundle")).toEqual(empty);
}