Add independently owned reconnectable execution units (WI-03)

This commit is contained in:
Timothy J. Aveni
2026-09-21 12:44:36 -07:00
parent 884b12f759
commit 89414107f9
5 changed files with 395 additions and 2 deletions
+16
View File
@@ -4,6 +4,22 @@ import { generatePortableTypeScriptBindings } from "../src/bindings/portable.js"
import { compileExecutionPlan } from "../src/execution-world/plan.js";
import { loadReaderWorkspace } from "./reader-fixture.js";
test("service bindings depend on their consumed contract, not workspace or source provenance", async () => {
const schema = compileExecutionPlan(await loadReaderWorkspace()).definition.bindingSchema;
const pkg = schema.packages[0]!;
const before = generatePortableTypeScriptBindings(schema, pkg.revisionId, { target: "server" });
const other = structuredClone(pkg);
other.revisionId = "unrelated@1" as typeof other.revisionId;
other.exports = [];
schema.packages.push(other);
pkg.source.commit = "b".repeat(40);
pkg.revisionId = "same-service-new-source@2" as typeof pkg.revisionId;
assert.equal(generatePortableTypeScriptBindings(schema, pkg.revisionId, { target: "server" }), before);
assert.doesNotMatch(before, /export const (bindingDigest|packageRevision)/);
pkg.exports[0]!.inputType = { kind: "scalar", name: "bool" };
assert.notEqual(generatePortableTypeScriptBindings(schema, pkg.revisionId, { target: "server" }), before);
});
test("reader portable bindings have selected facets, creation inputs and stable keyed calls", async () => {
const schema = compileExecutionPlan(await loadReaderWorkspace()).definition.bindingSchema;
const source = generatePortableTypeScriptBindings(schema, "package:reader-runtime@1", { target: "browser" });