mirror of
https://github.com/morluto/rea.git
synced 2026-11-06 23:06:18 +00:00
fix(cli): publish the GPU inventory digest format in the CLI schema (#9062)
inspect-gpu-code-objects declared --expected_sha256 as any string. The CLI schema accepted an upper-case digest, as PowerShell's Get-FileHash prints it, and the command then refused it as invalid_request. Reuse the shared lowercase SHA-256 field so argument parsing refuses it with the CLI field name.
This commit is contained in:
2 files changed
+34
-4
No files matched your search
@@ -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()
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user