fix: resolve M-01..M-02, M-05..M-08, L-01..L-03, L-05 from pre-release review
M-01: Compose OperationDefinitionSchema from OperationSpecSchema via Type.Intersect M-02: Extract from_openapi to subpath export, remove from main entry M-05: Fix mapError fragile includes() matching — use startsWith(code+':') or exact M-06: Replace any casts with MCPClientLike/MCPToolResult interfaces in from_mcp M-07: Add injectable fetch to HTTPServiceConfig for from_openapi M-08: Add OpenAPIServiceRegistry with lifecycle methods (add, remove, registerAll) L-01: Validate subscription handler type at registration and runtime L-02: Strengthen isResponseEnvelope with source-specific field validation L-03: Add logger.warn on FromSchema fallback to Type.Unknown L-04: Noted as intentional (SSE GET body handling) L-05: Add registerAll to MCPClientLoader and OpenAPIServiceRegistry
This commit is contained in:
@@ -50,6 +50,20 @@ describe("mapError", () => {
|
||||
expect(result.code).toBe("NOT_FOUND");
|
||||
});
|
||||
|
||||
it("does not false-positive on substring match (ITEM_NOT_FOUND vs NOT_FOUND)", () => {
|
||||
const result = mapError(new Error("ITEM_NOT_FOUND: nope"), [
|
||||
{ code: "NOT_FOUND", schema: {} },
|
||||
]);
|
||||
expect(result.code).toBe(InfrastructureErrorCode.EXECUTION_ERROR);
|
||||
});
|
||||
|
||||
it("matches exact code equality", () => {
|
||||
const result = mapError(new Error("NOT_FOUND"), [
|
||||
{ code: "NOT_FOUND", schema: {} },
|
||||
]);
|
||||
expect(result.code).toBe("NOT_FOUND");
|
||||
});
|
||||
|
||||
it("maps non-Error to UNKNOWN_ERROR", () => {
|
||||
const result = mapError("string error");
|
||||
expect(result.code).toBe(InfrastructureErrorCode.UNKNOWN_ERROR);
|
||||
|
||||
Reference in New Issue
Block a user