mirror of
https://github.com/morluto/rea.git
synced 2026-10-28 18:35:53 +00:00
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.
80 lines
3.0 KiB
TypeScript
80 lines
3.0 KiB
TypeScript
import { mkdir, writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { expect, it } from "vitest";
|
|
|
|
import { analyzeJavaScriptApplication } from "../../../src/application/JavaScriptApplicationService.js";
|
|
import { parseApplicationGraphEvidence } from "../../../src/application/JavaScriptApplicationEvidenceGraph.js";
|
|
import { importReferenceSource } from "../../../src/application/ReferenceSourceImport.js";
|
|
import { compareSourceToBundle } from "../../../src/domain/sourceToBundleComparison.js";
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
|
|
it("keeps literal hash characters in historical/current filesystem paths", async () => {
|
|
const root = await createTestTempDirectory("rea-source-path-");
|
|
const previous = join(root, "previous");
|
|
const current = join(root, "current");
|
|
await Promise.all([mkdir(previous), mkdir(current)]);
|
|
await Promise.all([
|
|
writeFile(join(previous, "worker#main.js"), "export const value = 1;"),
|
|
writeFile(join(current, "worker#main.js"), "export const value = 2;"),
|
|
]);
|
|
const reference = await importReferenceSource({
|
|
root: previous,
|
|
caller: "source-to-bundle-path-test",
|
|
policy: { secretPatterns: [] },
|
|
});
|
|
if (!reference.ok) throw new Error(reference.error.message);
|
|
const analyzed = await analyzeJavaScriptApplication({ input_path: current });
|
|
if (!analyzed.ok) throw analyzed.error;
|
|
const application = parseApplicationGraphEvidence(analyzed.value);
|
|
const comparison = compareSourceToBundle({
|
|
reference: reference.value,
|
|
application: {
|
|
evidenceId: application.evidence.evidence_id,
|
|
rootArtifactSha256: application.rootArtifactSha256,
|
|
graph: application.graph,
|
|
},
|
|
});
|
|
|
|
expect(reference.value.entries).toContainEqual(
|
|
expect.objectContaining({
|
|
kind: "file",
|
|
path: "worker#main.js",
|
|
content_state: "hashed",
|
|
}),
|
|
);
|
|
expect(comparison.items).toContainEqual(
|
|
expect.objectContaining({
|
|
source_path: "worker#main.js",
|
|
candidates: expect.arrayContaining([
|
|
expect.objectContaining({
|
|
signals: expect.arrayContaining([
|
|
expect.objectContaining({
|
|
kind: "current-path-exact",
|
|
source_value: "worker#main.js",
|
|
}),
|
|
]),
|
|
}),
|
|
]),
|
|
}),
|
|
);
|
|
});
|
|
|
|
it("rejects static application Evidence whose subject path disagrees with its result", async () => {
|
|
const root = await createTestTempDirectory("rea-application-subject-path-");
|
|
const analyzed = await analyzeJavaScriptApplication({ input_path: root });
|
|
if (!analyzed.ok) throw analyzed.error;
|
|
const subject = analyzed.value.subject;
|
|
if (subject === null) throw new Error("Analysis Evidence subject missing");
|
|
const inconsistent = {
|
|
...analyzed.value,
|
|
subject: {
|
|
...subject,
|
|
local_path: join(root, "relocated"),
|
|
},
|
|
};
|
|
|
|
expect(() => parseApplicationGraphEvidence(inconsistent)).toThrow(
|
|
"JavaScript application Evidence subject does not match its result",
|
|
);
|
|
});
|