Retain process input and unexpected failure diagnostics through the shared error projector. Preserve filesystem causes and firmware validation issues, and mark unchanged invalid requests nonretryable. Use typed stat settlement and parse unknown command failures without losing null or undefined rejection causes. Refs #5397, #5401, #5402, #5642
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { join } from "node:path";
|
|
|
|
import { expect } from "vitest";
|
|
|
|
import { analysisErrorProjectionSchema } from "../../../src/contracts/errorSchemas.js";
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
import { cliTest } from "../../support/cli/cliFixture.js";
|
|
|
|
cliTest(
|
|
"reports missing and directory objdump inputs with structured reasons",
|
|
async ({ cli }) => {
|
|
const root = await createTestTempDirectory("rea-objdump-invalid-target-");
|
|
const missing = join(root, "missing.bin");
|
|
const directory = root;
|
|
|
|
for (const [path, expectedReason] of [
|
|
[missing, "not found"],
|
|
[directory, "not a regular file"],
|
|
] as const) {
|
|
const result = await cli.run({
|
|
arguments: [
|
|
"inspect-with-objdump",
|
|
path,
|
|
"symbols",
|
|
"--format",
|
|
"json",
|
|
],
|
|
cwd: root,
|
|
});
|
|
expect(result.exitCode).toBe(1);
|
|
expect(analysisErrorProjectionSchema.safeParse(result.json).success).toBe(
|
|
true,
|
|
);
|
|
expect(result.json).toMatchObject({
|
|
code: "invalid_request",
|
|
category: "invalid_input",
|
|
retryable: false,
|
|
message: expect.stringContaining(path),
|
|
details: {
|
|
operation: "inspect_with_objdump",
|
|
issues: [
|
|
{
|
|
path: ["path"],
|
|
reason: "invalid_value",
|
|
message: expect.stringContaining(expectedReason),
|
|
},
|
|
],
|
|
},
|
|
});
|
|
}
|
|
},
|
|
);
|