Acquire installed portable operations with explicit authority and input coverage

This commit is contained in:
Timothy J. Aveni
2026-09-20 02:19:00 -07:00
parent 8fd800e69a
commit d9bd5b2800
18 changed files with 477 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { loadReaderWorkspace } from "./reader-fixture.js";
import { compileExecutionPlan, checkResultProjection, publicOperationKey } from "../src/execution-world/index.js";
test("factory result observation checks direct replica roots against the result contract", async () => {
const plan = compileExecutionPlan(await loadReaderWorkspace());
const query = (id: string) => JSON.stringify(["package:reader-runtime@1", id]);
const create = publicOperationKey(
"atom:reader:document",
"interface:reader:document-factory@1",
"document:create:call",
);
const annotate = publicOperationKey(
"atom:reader:document",
"interface:reader:document-actions@1",
"document:annotate:call",
);
assert.equal(checkResultProjection(plan, create, query("reader:replica-inputs")).id, query("reader:replica-inputs"));
assert.equal(checkResultProjection(plan, annotate, query("reader:editor-inputs")).id, query("reader:editor-inputs"));
assert.throws(() => checkResultProjection(plan, create, query("reader:editor-inputs")), {
code: "RESULT_PROJECTION_MISMATCH",
});
assert.throws(() => checkResultProjection(plan, annotate, query("reader:highlight-scope")), {
code: "INVALID_RESULT_PROJECTION",
});
assert.throws(() => checkResultProjection(plan, annotate, query("reader:editor-view")), {
code: "INVALID_RESULT_PROJECTION",
});
});