diff --git a/src/application/python/PythonPycService.test.ts b/src/application/python/PythonPycService.test.ts index 3f6fa12048..8ae0d90224 100644 --- a/src/application/python/PythonPycService.test.ts +++ b/src/application/python/PythonPycService.test.ts @@ -66,28 +66,6 @@ const report: PythonPyc = { ], }; -it.each([ - { - flags: 1, - hash_based: true, - source_hash_hex: "", - source_mtime: null, - source_size: null, - }, - { flags: 1 }, -])("refuses inconsistent provider header facts %j", async (header) => { - const result = await new PythonPycService({ - close: async () => {}, - identity, - inspect: async () => - ok({ ...report, header: { ...report.header, ...header } }), - }).inspect({ path: report.artifact.path }); - expect(result).toMatchObject({ - ok: false, - error: { _tag: "AnalysisOutputError" }, - }); -}); - it("rejects a relative path and extra arguments before reading", async () => { let calls = 0; const service = new PythonPycService({ @@ -110,25 +88,6 @@ it("rejects a relative path and extra arguments before reading", async () => { expect(calls).toBe(0); }); -it("records the selected artifact and the header plus marshal ranges", async () => { - const result = await new PythonPycService({ - close: async () => {}, - identity, - inspect: () => Promise.resolve(ok(report)), - }).inspect({ path: report.artifact.path }); - if (!result.ok) throw result.error; - expect(result.value).toMatchObject({ - confidence: "observed", - subject: { identity: { format: "file" } }, - normalized_result: report, - }); - expect(result.value.locations).toEqual([ - { kind: "artifact-path", path: report.artifact.path }, - { kind: "file-offset-range", start: 0, end: 16 }, - { kind: "file-offset-range", start: 16, end: report.artifact.bytes }, - ]); -}); - it("retains completed pyc Evidence and the opaque caller reason on late cancellation", async () => { const controller = new AbortController(); const reason = new AnalysisInputError("opaque caller metadata"); @@ -176,24 +135,30 @@ it("retains a pre-admission cancellation reason without calling the pyc provider expect(calls).toBe(0); }); -it("preserves malformed provider output instead of relabeling it as a late abort", async () => { - const controller = new AbortController(); - const service = new PythonPycService({ - close: async () => {}, - identity, - inspect: async () => { - controller.abort(new Error("later caller stop")); - return ok({ - ...report, - artifact: { ...report.artifact, path: "/different.pyc" }, - }); - }, - }); - const result = await service.inspect( - { path: report.artifact.path }, - { signal: controller.signal }, - ); - if (result.ok) throw new Error("Expected output failure"); - expect(result.error).toBeInstanceOf(AnalysisOutputError); - expect(result.error.partialObservation).toBeUndefined(); -}); +it.each([ + [ + "artifact identity", + { ...report, artifact: { ...report.artifact, path: "/different.pyc" } }, + ], + ["header facts", { ...report, header: { ...report.header, flags: 1 } }], +] as const)( + "preserves a provider %s failure instead of relabeling it as a late abort", + async (_name, badReport) => { + const controller = new AbortController(); + const service = new PythonPycService({ + close: async () => {}, + identity, + inspect: async () => { + controller.abort(new Error("later caller stop")); + return ok(badReport); + }, + }); + const result = await service.inspect( + { path: report.artifact.path }, + { signal: controller.signal }, + ); + if (result.ok) throw new Error("Expected output failure"); + expect(result.error).toBeInstanceOf(AnalysisOutputError); + expect(result.error.partialObservation).toBeUndefined(); + }, +); diff --git a/src/domain/python/pythonPyc.test.ts b/src/domain/python/pythonPyc.test.ts index 6cff9962d8..52f7568b90 100644 --- a/src/domain/python/pythonPyc.test.ts +++ b/src/domain/python/pythonPyc.test.ts @@ -1,10 +1,5 @@ import { expect, it } from "vitest"; -import { - inspectPythonPycInputSchema, - pythonPycMarshalProfile, - PYTHON_PYC_MARSHAL_PROFILES, - pythonPycHeaderSchema, -} from "./pythonPyc.js"; +import { pythonPycMarshalProfile, pythonPycHeaderSchema } from "./pythonPyc.js"; import { observePythonBytecodePrefix, pythonBytecodeIdentity, @@ -100,7 +95,6 @@ it("keeps pinned CPython identity separate from standalone marshal coverage", () } expect(pythonPycMarshalProfile(3450)).toBeNull(); expect(pythonPycMarshalProfile(62171)).toBeNull(); - expect(PYTHON_PYC_MARSHAL_PROFILES.size).toBeGreaterThan(80); }); it("retains little-endian magic inside a borrowed, partially available prefix", () => { @@ -125,12 +119,3 @@ it("retains little-endian magic inside a borrowed, partially available prefix", expect(complete.prefix.byteOffset).toBe(bytes.byteOffset); expect(complete.prefix.byteLength).toBe(4); }); - -it("rejects extra inspect arguments", () => { - expect( - inspectPythonPycInputSchema.safeParse({ - path: "/artifacts/module.pyc", - detail: "complete", - }).success, - ).toBe(false); -}); diff --git a/src/domain/python/pythonPyc.ts b/src/domain/python/pythonPyc.ts index ccb3623c45..cc7c43a265 100644 --- a/src/domain/python/pythonPyc.ts +++ b/src/domain/python/pythonPyc.ts @@ -58,7 +58,7 @@ const consecutiveProfiles = ( ); /** Standalone marshal coverage; source identity and header shape have a separate owner. */ -export const PYTHON_PYC_MARSHAL_PROFILES: ReadonlyMap< +const PYTHON_PYC_MARSHAL_PROFILES: ReadonlyMap< number, PythonPycMarshalProfile > = new Map([ @@ -324,6 +324,18 @@ export const pythonPycSchema = z message: "Code-object coverage disagrees with the listed code objects.", }); } + // Every decoded object consumes at least its one-byte marshal tag, and + // the report can list only code objects reached during that walk. + if ( + report.coverage.objects < report.code_objects.length || + report.coverage.objects > marshalBytes + ) + context.addIssue({ + code: "custom", + path: ["coverage", "objects"], + message: + "Marshal objects must cover all listed code objects and cannot exceed the marshal byte count.", + }); report.code_objects.forEach((code, owner) => { if ( code.localspluskinds_hex !== null && diff --git a/src/python/PythonPycBytecodeEquality.test.ts b/src/python/PythonPycBytecodeEquality.test.ts deleted file mode 100644 index d5b6a393cb..0000000000 --- a/src/python/PythonPycBytecodeEquality.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { createHash } from "node:crypto"; -import { expect, it } from "vitest"; - -import { pythonPycBytecodeIdentity } from "./PythonPycBytecodeEquality.js"; - -const raw = (bytes: Buffer): string => - createHash("sha256").update(bytes).digest("hex"); -const identity = (bytes: Buffer, magic: number): string => - pythonPycBytecodeIdentity(bytes, magic, raw(bytes)); - -it("skips inline-cache units only under the pinned 3.14 and 3.15 magics", () => { - // Opcode 80 carries nine cache code units in the 3627 table; only the cache - // bytes differ between the two bytecodes. - const first = Buffer.from([80, 0, ...Array(18).fill(1), 83, 0]); - const second = Buffer.from([80, 0, ...Array(18).fill(9), 83, 0]); - expect(identity(first, 3627)).toBe(identity(second, 3627)); - // A magic with no pinned table keeps the raw bytecode digest, so code - // objects that differ only in cache units stay distinct. - expect(identity(first, 3619)).toBe(`${String(first.length)}:${raw(first)}`); - expect(identity(first, 3619)).not.toBe(identity(second, 3619)); -}); diff --git a/src/python/PythonPycParser.test.ts b/src/python/PythonPycParser.test.ts index da277264ac..05a108555d 100644 --- a/src/python/PythonPycParser.test.ts +++ b/src/python/PythonPycParser.test.ts @@ -108,9 +108,16 @@ it.each([ { magic: 3571, opcode: 82, cacheUnits: 9 }, { magic: 3627, opcode: 80, cacheUnits: 9 }, { magic: 3666, opcode: 128, cacheUnits: 1 }, + { + magic: 3394, + layout: "py37" as const, + opcode: 80, + cacheUnits: 9, + distinct: 5, + }, ])( - "uses the $magic cache width for code equality and retains raw bytecode", - ({ magic, opcode, cacheUnits }) => { + "uses the $magic bytecode equality rules and retains raw bytecode", + ({ magic, layout = "py311" as const, opcode, cacheUnits, distinct = 4 }) => { const cache = Buffer.alloc(cacheUnits * 2); const bytecode = (arg: number, cachePayload: Buffer, nextArg = 0) => Buffer.concat([ @@ -129,15 +136,17 @@ it.each([ bytecode(1, cache), bytecode(0, cache, 1), Buffer.concat([original, Buffer.from([0, 0])]), - ].map((code) => marshalCode("py311", { bytecode: code })), + ].map((code) => marshalCode(layout, { bytecode: code })), ]); const report = parse( Buffer.concat([ pythonPycHeader(magic), - marshalCode("py311", { consts: [frozenSet] }), + marshalCode(layout, { consts: [frozenSet] }), ]), ); - expect(root(report).consts).toEqual([{ kind: "frozenset", length: 4 }]); + expect(root(report).consts).toEqual([ + { kind: "frozenset", length: distinct }, + ]); expect(report.code_objects[1]?.bytecode).toEqual({ bytes: original.length, sha256: createHash("sha256").update(original).digest("hex"), diff --git a/tests/acceptance/applications/pythonPycViews.test.ts b/tests/acceptance/applications/pythonPycViews.test.ts index aaf094c9b0..b35c48878b 100644 --- a/tests/acceptance/applications/pythonPycViews.test.ts +++ b/tests/acceptance/applications/pythonPycViews.test.ts @@ -4,14 +4,23 @@ import { expect } from "vitest"; import { z } from "zod"; import { readEvidenceBundle } from "../../../src/application/EvidenceBundleFiles.js"; import { toolContract } from "../../../src/contracts/toolContracts.js"; -import { evidenceSchema } from "../../../src/domain/evidence.js"; -import { pythonPycSchema } from "../../../src/domain/python/pythonPyc.js"; +import { + createEvidence, + evidenceSchema, + type Evidence, +} from "../../../src/domain/evidence.js"; +import { + pythonPycSchema, + type PythonPyc, +} from "../../../src/domain/python/pythonPyc.js"; import { digestCanonicalValue } from "../../../src/domain/canonicalDigest.js"; import { analysisViewResultSchema } from "../../../src/domain/analysisView/analysisViewResult.js"; import { marshalCode, pythonPycHeader, } from "../../../src/python/PythonPyc.fixture.js"; +import { fileSubjectTarget } from "../../fixtures/evidenceSubject.js"; +import { parseMcpToolError } from "../../fixtures/mcpToolError.js"; import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js"; import { cliTest, type SharedMcpCall } from "../../support/cli/cliFixture.js"; @@ -68,6 +77,59 @@ const assertSparseSelectors = async ( } }; +const assertImpossibleMarshalCounts = async ( + call: SharedMcpCall, + parent: Pick< + Evidence, + | "subject" + | "provider" + | "operation" + | "parameters" + | "confidence" + | "locations" + | "limitations" + >, + completeReport: PythonPyc, +): Promise => { + const target = fileSubjectTarget(parent.subject); + const invalidCounts = [ + { objects: 2, view: { kind: "summary" } }, + { + objects: completeReport.coverage.marshal_bytes + 1, + view: { kind: "python-pyc", collection: "code_objects" }, + }, + ]; + for (const { objects, view: request } of invalidCounts) { + const evidence = createEvidence(target, parent.provider, { + operation: parent.operation, + parameters: parent.parameters, + confidence: parent.confidence, + locations: parent.locations, + limitations: parent.limitations, + result: { + ...completeReport, + coverage: { ...completeReport.coverage, objects }, + }, + }); + const response = await call("inspect_analysis_view", { + source: { kind: "inline", evidence }, + view: request, + }); + expect(response.isError).toBe(true); + expect(parseMcpToolError(response).error).toMatchObject({ + code: "invalid_request", + details: { + issues: [ + { + path: ["source", "normalized_result", "coverage", "objects"], + reason: "invalid_value", + }, + ], + }, + }); + } +}; + cliTest( "queries same-name pyc objects through CLI/MCP after deleting the source", async ({ cli }) => { @@ -214,6 +276,8 @@ cliTest( expect(offline.exitCode, offline.stderr).toBe(0); expect(viewContract.outputSchema.parse(offline.json)).toEqual(page); await assertSparseSelectors(call, source); + + await assertImpossibleMarshalCounts(call, parent, completeReport); }, ); diff --git a/tests/boundary/filesystem/pythonPyc.test.ts b/tests/boundary/filesystem/pythonPyc.test.ts index 25226f9f35..2cadaf9c8b 100644 --- a/tests/boundary/filesystem/pythonPyc.test.ts +++ b/tests/boundary/filesystem/pythonPyc.test.ts @@ -39,42 +39,42 @@ describe("Python pyc stable filesystem boundary", () => { } }); - it("returns typed resource and cancellation failures", async () => { + it("reports each selected pyc limit and reopens the same artifact successfully", async () => { const root = await createTestTempDirectory("rea-python-pyc-budget-"); const path = join(root, "sample.pyc"); const bytes = pythonPycFixture("py311", { nested: true }); await writeFile(path, bytes); const service = createPythonPycService(); - const tooSmall = await service.inspect({ path, max_file_bytes: 16 }); - if (tooSmall.ok) throw new Error("Expected resource budget failure"); - expect(tooSmall.error._tag).toBe("AnalysisResourceConstraintError"); - for (const [field, selected] of [ - ["max_objects", 1], - ["max_depth", 1], - ["max_string_bytes", 2], + for (const [field, maximum, resource] of [ + ["max_file_bytes", 16, "file-size"], + ["max_objects", 1, "memory"], + ["max_depth", 1, "capacity"], + ["max_string_bytes", 2, "memory"], ] as const) { - const refused = await service.inspect({ path, [field]: selected }); + const refused = await service.inspect({ path, [field]: maximum }); if (refused.ok) throw new Error(`Expected ${field} refusal`); - if (field === "max_objects") - expect(refused.error._tag).toBe("AnalysisResourceConstraintError"); - const projected = projectAnalysisError(refused.error); - expect(projected).toMatchObject({ + expect(projectAnalysisError(refused.error)).toMatchObject({ code: "resource_constraint", retryable: false, + details: { + resource, + reported_limits: + field === "max_file_bytes" + ? { max_file_bytes: maximum } + : { boundary: field, maximum }, + }, remediation: { action: expect.stringContaining( `${field} (--${field.replaceAll("_", "-")})`, ), }, }); - const control = await service.inspect({ path }); - expect(control.ok).toBe(true); } - const cancelled = await service.inspect( - { path }, - { signal: AbortSignal.abort() }, - ); - if (cancelled.ok) throw new Error("Expected cancellation"); - expect(cancelled.error._tag).toBe("AnalysisCancelledError"); + const control = await service.inspect({ path }); + if (!control.ok) throw control.error; + expect(control.value.normalized_result).toMatchObject({ + artifact: { path, bytes: bytes.length }, + coverage: { status: "complete", code_objects: 2 }, + }); }); }); diff --git a/tests/boundary/mcp/pythonPycMcp.test.ts b/tests/boundary/mcp/pythonPycMcp.test.ts index e3d68195c9..b586ef7b57 100644 --- a/tests/boundary/mcp/pythonPycMcp.test.ts +++ b/tests/boundary/mcp/pythonPycMcp.test.ts @@ -2,6 +2,7 @@ import { canonicalOutputSchema, withCanonicalOutputSchema, } from "../../fixtures/canonicalOutputSchema.js"; +import { createHash } from "node:crypto"; import { writeFile } from "node:fs/promises"; import { join } from "node:path"; import { createMcpSchemaValidation } from "../../fixtures/mcpSchemaValidation.js"; @@ -34,9 +35,6 @@ const marshalInt32 = (value: number): Buffer => { return Buffer.concat([Buffer.from([0x69]), payload]); }; -const marshalSingleItemTuple = (item: Buffer): Buffer => - Buffer.concat([Buffer.from([0x29, 1]), item]); - const schemaValidation = createMcpSchemaValidation(); afterAll(() => schemaValidation.clear()); @@ -58,56 +56,34 @@ it("reads signed TYPE_INT64 constants and rejects a truncated payload", async () const { client, close } = await connect(); try { const root = await createTestTempDirectory("rea-python-pyc-mcp-int64-"); - for (const [name, value, bits] of [ - ["positive", 42n, 6], - ["negative", -1n, 1], - ["minimum", -(1n << 63n), 64], - ["maximum", (1n << 63n) - 1n, 63], - ] as const) { - const path = join(root, `${name}.pyc`); - await writeFile( - path, - Buffer.concat([ - pythonPycHeader(3531), - marshalCode("py311", { - constsObject: marshalSingleItemTuple(marshalInt64(value)), - }), - ]), - ); - const response = await client.callTool({ - name: "inspect_python_pyc", - arguments: { path }, - }); - expect(response.isError, JSON.stringify(response.content)).not.toBe(true); - const evidence = completePycEvidenceSchema.parse( - response.structuredContent, - ); - expect(evidence.normalized_result.code_objects[0]?.consts).toContainEqual( - { kind: "int", bits, value: value.toString() }, - ); - } - - const ordinaryPath = join(root, "ordinary-int.pyc"); + const path = join(root, "signed.pyc"); await writeFile( - ordinaryPath, + path, Buffer.concat([ pythonPycHeader(3531), marshalCode("py311", { - constsObject: marshalSingleItemTuple(marshalInt32(-42)), + consts: [ + ...[42n, -1n, -(1n << 63n), (1n << 63n) - 1n].map(marshalInt64), + marshalInt32(-42), + ], }), ]), ); - const ordinary = await client.callTool({ + const response = await client.callTool({ name: "inspect_python_pyc", - arguments: { path: ordinaryPath }, + arguments: { path }, }); - expect(ordinary.isError, JSON.stringify(ordinary.content)).not.toBe(true); - const ordinaryEvidence = completePycEvidenceSchema.parse( - ordinary.structuredContent, + expect(response.isError, JSON.stringify(response.content)).not.toBe(true); + const { normalized_result } = completePycEvidenceSchema.parse( + response.structuredContent, ); - expect( - ordinaryEvidence.normalized_result.code_objects[0]?.consts, - ).toContainEqual({ kind: "int", bits: 6, value: "-42" }); + expect(normalized_result.code_objects[0]?.consts).toEqual([ + { kind: "int", bits: 6, value: "42" }, + { kind: "int", bits: 1, value: "-1" }, + { kind: "int", bits: 64, value: "-9223372036854775808" }, + { kind: "int", bits: 63, value: "9223372036854775807" }, + { kind: "int", bits: 6, value: "-42" }, + ]); const truncatedPath = join(root, "truncated.pyc"); await writeFile( @@ -163,16 +139,11 @@ it("advertises inspect_python_pyc and reads nested code objects", async () => { name: "inner", firstlineno: -7, }); - await writeFile( - path, - Buffer.concat([ - pythonPycHeader(3531), - marshalCode("py311", { - firstlineno: -1, - consts: [nested], - }), - ]), - ); + const bytes = Buffer.concat([ + pythonPycHeader(3531), + marshalCode("py311", { firstlineno: -1, consts: [nested] }), + ]); + await writeFile(path, bytes); const response = await client.callTool( { name: "inspect_python_pyc", arguments: { path } }, { toolDefinition: withCanonicalOutputSchema(advertised) }, @@ -181,7 +152,20 @@ it("advertises inspect_python_pyc and reads nested code objects", async () => { const evidence = completePycEvidenceSchema.parse( response.structuredContent, ); - expect(evidence.normalized_result.header.python_version).toBe("3.12"); + const sha256 = createHash("sha256").update(bytes).digest("hex"); + expect(evidence).toMatchObject({ + confidence: "observed", + subject: { identity: { format: "file", sha256 }, local_path: path }, + normalized_result: { + artifact: { path, sha256, bytes: bytes.length }, + header: { magic: 3531, python_version: "3.12", code_layout: "py311" }, + }, + }); + expect(evidence.locations).toEqual([ + { kind: "artifact-path", path }, + { kind: "file-offset-range", start: 0, end: 16 }, + { kind: "file-offset-range", start: 16, end: bytes.length }, + ]); expect(evidence.normalized_result.code_objects[0]?.firstlineno).toBe(-1); expect(evidence.normalized_result.code_objects[1]?.name).toBe("inner"); expect(evidence.normalized_result.code_objects[1]?.firstlineno).toBe(-7); @@ -221,62 +205,29 @@ it("advertised pyc output schema preserves historical signed fields", async () = if (advertised === undefined) throw new Error("Missing inspect_python_pyc output schema"); const root = await createTestTempDirectory("rea-python-pyc-mcp-flags-"); - for (const testCase of [ - { - name: "legacy-negative", - magic: 3394, - layout: "py37" as const, - fields: { stacksize: 0xffffffff }, - expected: { stacksize: -1, flags: 0 }, - }, - { - name: "alpha-3401-negative-flags", - magic: 3401, - layout: "py37" as const, - fields: { flags: 0x80000000 }, - expected: { stacksize: 1, flags: -0x80000000 }, - }, - { - name: "ambiguous-3410-negative-fields", - magic: 3410, - layout: "py38" as const, - fields: { stacksize: 0xffffffff, flags: 0x80000000 }, - expected: { stacksize: -1, flags: -0x80000000 }, - }, - { - name: "unknown-positive", - magic: 3531, - layout: "py311" as const, - fields: { flags: 0x40000000 }, - expected: { flags: 0x40000000 }, - }, - ]) { - const path = join(root, `${testCase.name}.pyc`); - await writeFile( - path, - Buffer.concat([ - pythonPycHeader(testCase.magic), - marshalCode(testCase.layout, testCase.fields), - ]), - ); - const response = await client.callTool( - { name: "inspect_python_pyc", arguments: { path } }, - { toolDefinition: withCanonicalOutputSchema(advertised) }, - ); - expect(response.isError, JSON.stringify(response.content)).not.toBe(true); - const evidence = completePycEvidenceSchema.parse( - response.structuredContent, - ); - expect(evidence.normalized_result.code_objects[0]).toMatchObject( - testCase.expected, - ); - if (testCase.magic === 3410) - expect(evidence.normalized_result.limitations).toEqual( - expect.arrayContaining([ - expect.stringContaining("Magic 3410 is shared"), - ]), - ); - } + const path = join(root, "ambiguous-3410.pyc"); + await writeFile( + path, + Buffer.concat([ + pythonPycHeader(3410), + marshalCode("py38", { stacksize: 0xffffffff, flags: 0x80000000 }), + ]), + ); + const response = await client.callTool( + { name: "inspect_python_pyc", arguments: { path } }, + { toolDefinition: withCanonicalOutputSchema(advertised) }, + ); + expect(response.isError, JSON.stringify(response.content)).not.toBe(true); + const { normalized_result } = completePycEvidenceSchema.parse( + response.structuredContent, + ); + expect(normalized_result.code_objects[0]).toMatchObject({ + stacksize: -1, + flags: -0x80000000, + }); + expect(normalized_result.limitations).toEqual( + expect.arrayContaining([expect.stringContaining("Magic 3410 is shared")]), + ); } finally { await close(); } @@ -286,41 +237,32 @@ it("rejects negative code fields for magics after constructor validation was add const { client, close } = await connect(); try { const root = await createTestTempDirectory("rea-python-pyc-mcp-signed-"); - for (const { name, fields, message } of [ - { - name: "negative-stacksize", - fields: { stacksize: 0xffffffff }, - message: "co_stacksize is negative", + const path = join(root, "negative-flags.pyc"); + await writeFile( + path, + Buffer.concat([ + pythonPycHeader(3411), + marshalCode("py38", { flags: 0x80000000 }), + ]), + ); + const response = await client.callTool({ + name: "inspect_python_pyc", + arguments: { path }, + }); + expect(response.isError).toBe(true); + expect(parseMcpToolError(response).error).toMatchObject({ + code: "invalid_request", + details: { + operation: "inspect_python_pyc", + issues: [ + { + path: ["path"], + reason: "invalid_format", + message: expect.stringContaining("co_flags is negative"), + }, + ], }, - { - name: "negative-flags", - fields: { flags: 0x80000000 }, - message: "co_flags is negative", - }, - ]) { - const path = join(root, `${name}.pyc`); - await writeFile( - path, - Buffer.concat([pythonPycHeader(3411), marshalCode("py38", fields)]), - ); - const response = await client.callTool({ - name: "inspect_python_pyc", - arguments: { path }, - }); - expect(response.isError).toBe(true); - expect(parseMcpToolError(response).error).toMatchObject({ - code: "invalid_request", - details: { - operation: "inspect_python_pyc", - issues: [ - { - reason: "invalid_format", - message: expect.stringContaining(message), - }, - ], - }, - }); - } + }); } finally { await close(); } diff --git a/tests/support/providerLifecycleCoverage.ts b/tests/support/providerLifecycleCoverage.ts index cedbdcf8b1..946e82435d 100644 --- a/tests/support/providerLifecycleCoverage.ts +++ b/tests/support/providerLifecycleCoverage.ts @@ -1643,7 +1643,12 @@ export const PROVIDER_LIFECYCLE_COVERAGE: Readonly< "reads signed TYPE_INT64 constants and rejects a truncated payload", ), ), - typedFailures("tests/boundary/filesystem/pythonPyc.test.ts"), + covered( + test( + "src/application/python/PythonPycService.test.ts", + "retains completed pyc Evidence and the opaque caller reason on late cancellation", + ), + ), ), "rea-release-exposure": inProcess( covered(