mirror of
https://github.com/morluto/rea
synced 2026-10-27 14:42:18 -04:00
4a6073810a
* fix(cli): validate native scenario and preserve JSON paths * fix(process): reject invalid UTF-8 JSON inputs * fix(cli): retain missing JSON path diagnostics * test(cli): cover relative brace and bracket JSON paths * test(cli): reject missing native scenario steps * fix(mcp): advertise reserved process environment key * fix(process): reject NUL in process scenario values * fix(process): advertise NUL input constraints to MCP * fix(cli): report scenario input schema issues * fix(contracts): align CLI and MCP input validation * fix(mcp): document semantic output constraints * fix(mcp): describe process journal compatibility * docs: regenerate catalog after schema grouping * docs: regenerate catalog after main merge * fix(cli): preserve JSON and native UI input diagnostics * test(mcp): reuse advertised tool schemas in managed flow
75 lines
2.0 KiB
TypeScript
75 lines
2.0 KiB
TypeScript
import { describe, expect } from "vitest";
|
|
|
|
import { cliTest } from "../../support/cli/cliFixture.js";
|
|
import type { TestCli } from "../../support/cli/cliFixture.js";
|
|
|
|
const runCapture = async (cli: TestCli, steps: string | undefined) => {
|
|
const arguments_ = [
|
|
"capture-native-ui-scenario",
|
|
"/provider-must-not-be-invoked",
|
|
"--pid",
|
|
"1",
|
|
"--window-id",
|
|
"1",
|
|
];
|
|
if (steps !== undefined) arguments_.push("--steps", steps);
|
|
arguments_.push("--json");
|
|
return cli.run({
|
|
arguments: arguments_,
|
|
environment: { REA_LOG_LEVEL: "silent" },
|
|
});
|
|
};
|
|
|
|
describe("native UI scenario CLI input", () => {
|
|
cliTest(
|
|
"rejects omitted steps under the shared scenario contract",
|
|
async ({ cli }) => {
|
|
const result = await runCapture(cli, undefined);
|
|
|
|
expect(result.exitCode).not.toBe(0);
|
|
expect(result.json).toMatchObject({
|
|
code: "invalid_request",
|
|
details: {
|
|
operation: "capture_native_ui_scenario",
|
|
issues: [{ path: ["steps"], reason: "missing_argument" }],
|
|
},
|
|
});
|
|
},
|
|
);
|
|
|
|
cliTest("rejects malformed JSON as invalid input", async ({ cli }) => {
|
|
const result = await runCapture(cli, "[");
|
|
|
|
expect(result.exitCode).not.toBe(0);
|
|
expect(result.json).toMatchObject({
|
|
code: "invalid_request",
|
|
details: {
|
|
operation: "capture_native_ui_scenario",
|
|
issues: [
|
|
{
|
|
path: ["steps"],
|
|
reason: "invalid_format",
|
|
expected: "JSON",
|
|
},
|
|
],
|
|
},
|
|
});
|
|
});
|
|
|
|
cliTest(
|
|
"requires at least one schema-valid scenario step",
|
|
async ({ cli }) => {
|
|
const result = await runCapture(cli, "[]");
|
|
|
|
expect(result.exitCode).not.toBe(0);
|
|
expect(result.json).toMatchObject({
|
|
code: "invalid_request",
|
|
details: {
|
|
operation: "capture_native_ui_scenario",
|
|
issues: [{ path: ["steps"], reason: "out_of_range", minimum: 1 }],
|
|
},
|
|
});
|
|
},
|
|
);
|
|
});
|