diff --git a/src/cli/gpuCommands.ts b/src/cli/gpuCommands.ts index 186c35cf4c..c6270beec4 100644 --- a/src/cli/gpuCommands.ts +++ b/src/cli/gpuCommands.ts @@ -39,10 +39,10 @@ export const registerGpuCommands = (cli: CliInstance, logger: Logger): void => { .enum(["inventory", "kernels"]) .default("inventory") .describe("Inventory GPU targets or decode selected kernel metadata"), - expected_sha256: z - .string() - .optional() - .describe("Inventory SHA-256; required with --object_ids"), + expected_sha256: + inspectGpuCodeObjectsInputSchema.shape.expected_sha256.describe( + "Inventory SHA-256 as 64 lowercase hex digits; required with --object_ids", + ), object_ids: z .string() .optional() diff --git a/tests/acceptance/gpuCodeObjectsCli.test.ts b/tests/acceptance/gpuCodeObjectsCli.test.ts index 09ca561735..a5f952775c 100644 --- a/tests/acceptance/gpuCodeObjectsCli.test.ts +++ b/tests/acceptance/gpuCodeObjectsCli.test.ts @@ -880,6 +880,36 @@ cliTest( }, ); +cliTest( + "publishes and enforces the lowercase --expected_sha256 digest", + async ({ cli }) => { + const schema = await cli.run({ + arguments: ["inspect-gpu-code-objects", "--schema", "--json"], + }); + expect(schema.exitCode, schema.stderr).toBe(0); + expect(schema.json).toMatchObject({ + options: { + properties: { expected_sha256: { pattern: "^[a-f0-9]{64}$" } }, + }, + }); + // PowerShell's Get-FileHash prints the digest in upper case. + const response = await runFileCli(cli, { + arguments: [ + "inspect-gpu-code-objects", + "/not-opened-for-invalid-selectors", + "--expected_sha256", + "AB".repeat(32), + "--json", + ], + }); + expect(response.exitCode).toBe(1); + expect(response.json).toMatchObject({ + code: "VALIDATION_ERROR", + fieldErrors: [expect.objectContaining({ path: "expected_sha256" })], + }); + }, +); + it("preserves incomplete decoder coverage through MCP target and object pages", async () => { const root = await createTestTempDirectory("rea-gpu-partial-"), { call } = await connectLocalToolsMcp();