Host persistent Camino services and authenticated workspace bootstrap (WI-06)
This commit is contained in:
@@ -139,3 +139,18 @@ test("remote JS modules witness generated adapters without imposing TypeScript o
|
||||
);
|
||||
assert.deepEqual(expectedArtifactReceipt(plan, fixture.manifest, generator).receipt.generated, []);
|
||||
});
|
||||
|
||||
test("transaction process services do not promise generated TypeScript modules", async () => {
|
||||
const { expectedArtifactReceipt, checkArtifactReceipt } = await import("../src/execution-world/receipts.js");
|
||||
const plan = compileExecutionPlan(await loadReaderWorkspace()),
|
||||
fixture = buildArtifactFixture(plan);
|
||||
fixture.manifest.implementations = fixture.manifest.implementations.filter(
|
||||
(i) => i.compatibility === "quixos-service-v1",
|
||||
);
|
||||
const generator = "a".repeat(64),
|
||||
{ receipt } = expectedArtifactReceipt(plan, fixture.manifest, generator);
|
||||
assert.deepEqual(receipt.generated, []);
|
||||
await checkArtifactReceipt(plan, fixture.manifest, receipt, generator, async () => {
|
||||
throw Error("No adapter claimed");
|
||||
});
|
||||
});
|
||||
|
||||
+41
-8
@@ -6,22 +6,52 @@ import { compileExecutionPlan } from "../src/execution-world/plan.js";
|
||||
import { compileKernelProgram } from "../src/execution-world/kernel.js";
|
||||
import { compileQueryProgram } from "../src/execution-world/queries.js";
|
||||
const source = { repository: "https://example.test/device-owner.git", commit: "a".repeat(40) };
|
||||
const pkg = compileCapabilityResourceSource(
|
||||
`package Owner id "package:owner" revision "package:owner@1" {
|
||||
function identity id "identity" : int32 -> record { pid: int32; child: int32; } execution remote;
|
||||
const factory = compileCapabilityResourceSource(
|
||||
`external atom Entry id "atom:entry";
|
||||
interface EntryFactory id "interface:entry-factory" revision "interface:entry-factory@1" {
|
||||
static operation create id "entry:create" : unit -> atom-ref<Entry> {
|
||||
call id "entry:create:call" execution transaction targets [server];
|
||||
}
|
||||
}`,
|
||||
{ source },
|
||||
);
|
||||
assert.ok(pkg.ok && pkg.resource.kind === "package", JSON.stringify(pkg.diagnostics));
|
||||
for (const variant of ["base", "added"]) {
|
||||
const commit = (variant === "base" ? "a" : "b").repeat(40);
|
||||
assert.ok(factory.ok && factory.resource.kind === "interface", JSON.stringify(factory.diagnostics));
|
||||
for (const variant of ["base", "added", "gateway", "gateway-next"]) {
|
||||
const gateway = variant.startsWith("gateway"),
|
||||
commit = { base: "a", added: "b", gateway: "c", "gateway-next": "d" }[variant]!.repeat(40);
|
||||
const pkg = compileCapabilityResourceSource(
|
||||
`${gateway ? 'external atom Entry id "atom:entry";' : ""}
|
||||
package Owner id "package:owner" revision "package:owner@1" {
|
||||
function identity id "identity" : int32 -> record { pid: int32; child: int32; } execution remote;
|
||||
${gateway ? 'function create id "create" : unit -> atom-ref<Entry> execution transaction targets [server] requires { creation entry id "entry:birth" : Entry input unit; };' : ""}
|
||||
}`,
|
||||
{ source },
|
||||
);
|
||||
assert.ok(pkg.ok && pkg.resource.kind === "package", JSON.stringify(pkg.diagnostics));
|
||||
const result = compileCapabilitySource(
|
||||
`workspace Managed id "workspace:managed-process" revision "workspace:managed-process@${variant}" commit "${commit}" {
|
||||
import package Owner;
|
||||
${variant === "added" ? 'atom Independent id "atom:independent";' : ""}
|
||||
${variant !== "base" ? 'atom Independent id "atom:independent";' : ""}
|
||||
${
|
||||
gateway
|
||||
? `import interface EntryFactory; atom Entry id "atom:entry";
|
||||
conform Entry as EntryFactory id "owner:entry-factory" {
|
||||
bind create.call to package Owner.create with { entry to creation Entry with {}; };
|
||||
}`
|
||||
: ""
|
||||
}
|
||||
}`,
|
||||
"workspace.qx",
|
||||
{ packages: new Map([["Owner", pkg.resource.revision]]), packageClosure: [pkg.resource.revision] },
|
||||
{
|
||||
packages: new Map([["Owner", pkg.resource.revision]]),
|
||||
packageClosure: [pkg.resource.revision],
|
||||
...(gateway
|
||||
? {
|
||||
interfaces: new Map([["EntryFactory", factory.resource.revision]]),
|
||||
interfaceClosure: [factory.resource.revision],
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
);
|
||||
assert.ok(result.ok, JSON.stringify(result.diagnostics));
|
||||
const plan = compileExecutionPlan(result.workspace),
|
||||
@@ -29,6 +59,9 @@ for (const variant of ["base", "added"]) {
|
||||
await mkdir(root, { recursive: true });
|
||||
for (const [file, value] of Object.entries({
|
||||
"candidate.json": result.workspace,
|
||||
"entry.json": gateway
|
||||
? { atom: "atom:entry", interface: "interface:entry-factory@1", operation: "entry:create:call" }
|
||||
: null,
|
||||
"execution-plan.json": plan,
|
||||
"kernel.json": compileKernelProgram(plan),
|
||||
"queries.json": compileQueryProgram(plan),
|
||||
|
||||
Reference in New Issue
Block a user