mirror of
https://github.com/morluto/rea
synced 2026-10-28 15:07:26 -04:00
b5e98915c6
Remove REA permission grants, scope ceilings, approval confirmations, and inert settings. Preserve selected local evidence, accept caller-chosen commands and paths, and report actual runtime failures. Harden provider results, schema serialization, snapshot evidence binding, archive paths, source maps, native screenshots, managed EH parsing, and cancellation cleanup. Regenerate tool metadata and document direct invocation. BREAKING CHANGE: Removed permission configuration and policy commands, approval fields, filesystem scope inputs, and fixed confirmation options. Process capture inherits the host environment and accepts command names; callers must refresh tool schemas and migrate removed fields.
71 lines
2.1 KiB
TypeScript
71 lines
2.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { ProcessCaptureError } from "../../../src/application/ProcessCaptureError.js";
|
|
import { analysisErrorProjectionSchema } from "../../../src/contracts/errorSchemas.js";
|
|
import {
|
|
ArtifactOperationError,
|
|
EvidenceFileError,
|
|
HopperRemoteError,
|
|
UnknownRegistryError,
|
|
projectAnalysisError,
|
|
type AnalysisError,
|
|
} from "../../../src/domain/errors.js";
|
|
|
|
describe("analysis error projection contract", () => {
|
|
it("accepts every closed error-reason variant without exposing diagnostics", () => {
|
|
const variants: AnalysisError[] = [
|
|
...(
|
|
[
|
|
"cancelled",
|
|
"format",
|
|
"integrity",
|
|
"limit",
|
|
"path",
|
|
"unavailable",
|
|
"io",
|
|
] as const
|
|
).map(
|
|
(reason) => new ArtifactOperationError("inventory_artifact", reason),
|
|
),
|
|
...(["not-file", "exists", "invalid-json", "io"] as const).map(
|
|
(reason) => new EvidenceFileError("read", reason),
|
|
),
|
|
...(
|
|
[
|
|
"not-found",
|
|
"already-exists",
|
|
"revision-conflict",
|
|
"invalid-transition",
|
|
"integrity",
|
|
"limit",
|
|
] as const
|
|
).map((reason) => new UnknownRegistryError(reason)),
|
|
...(["capture_failed", "cleanup_incomplete", "cancelled"] as const).map(
|
|
(reason) =>
|
|
new ProcessCaptureError("SECRET capture diagnostic", { reason }),
|
|
),
|
|
...(
|
|
[
|
|
"remote",
|
|
"authorization",
|
|
"invalid_request",
|
|
"bridge_exception",
|
|
] as const
|
|
).map(
|
|
(diagnostic) =>
|
|
new HopperRemoteError(9, "safe", { diagnosticType: diagnostic }),
|
|
),
|
|
];
|
|
|
|
for (const variant of variants) {
|
|
const projected = projectAnalysisError(variant);
|
|
expect(
|
|
analysisErrorProjectionSchema.safeParse(projected),
|
|
JSON.stringify({ variant, projected }),
|
|
).toMatchObject({ success: true });
|
|
expect(projected.code).toMatch(/^[a-z][a-z0-9_]*$/u);
|
|
expect(JSON.stringify(projected)).not.toContain("SECRET");
|
|
}
|
|
});
|
|
});
|