Build checked asynchronous service registries with Nix
This commit is contained in:
@@ -114,3 +114,28 @@ test("checked receipts bind regenerated code, generator identity and manifests",
|
||||
/replaced or omitted/,
|
||||
);
|
||||
});
|
||||
|
||||
test("remote JS modules witness generated adapters without imposing TypeScript on custom services", async () => {
|
||||
const { asyncObjectPlan } = await import("./async-fixture.js");
|
||||
const { expectedArtifactReceipt, checkArtifactReceipt } = await import("../src/execution-world/receipts.js");
|
||||
const plan = await asyncObjectPlan(),
|
||||
fixture = buildArtifactFixture(plan, "async:provider-runtime@2"),
|
||||
generator = "a".repeat(64);
|
||||
fixture.manifest.implementations = fixture.manifest.implementations.filter(
|
||||
(implementation) => implementation.target === "server",
|
||||
);
|
||||
const { receipt, sources } = expectedArtifactReceipt(plan, fixture.manifest, generator);
|
||||
assert.deepEqual(
|
||||
receipt.generated.map((file) => file.path),
|
||||
["share/quixos/generated/remote.ts"],
|
||||
);
|
||||
await checkArtifactReceipt(plan, fixture.manifest, receipt, generator, async (_revision, path) => sources.get(path)!);
|
||||
await assert.rejects(
|
||||
checkArtifactReceipt(plan, fixture.manifest, receipt, generator, async () => new Uint8Array()),
|
||||
/replaced or omitted/,
|
||||
);
|
||||
fixture.manifest.implementations = fixture.manifest.implementations.filter(
|
||||
(implementation) => implementation.compatibility === "quixos-service-v1",
|
||||
);
|
||||
assert.deepEqual(expectedArtifactReceipt(plan, fixture.manifest, generator).receipt.generated, []);
|
||||
});
|
||||
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
type PackageArtifacts,
|
||||
type ArtifactImplementation,
|
||||
} from "../src/execution-world/index.js";
|
||||
export const buildArtifactFixture = (plan: ExecutionPlan) => {
|
||||
const expected = plan.definition.packages[0]!;
|
||||
export const buildArtifactFixture = (plan: ExecutionPlan, revision = plan.definition.packages[0]!.revision) => {
|
||||
const expected = plan.definition.packages.find((pkg) => pkg.revision === revision)!;
|
||||
const bytes = new TextEncoder().encode("export const handlers = Object.freeze({});\n");
|
||||
const implementation = (
|
||||
id: string,
|
||||
|
||||
@@ -2,6 +2,7 @@ external atom Document id "async:document";
|
||||
import interface DocumentData;
|
||||
import interface Summarizer;
|
||||
package ControllerRuntime id "async:controller-runtime" revision "async:controller-runtime@1" {
|
||||
function echo id "async:controller:echo" : string -> string execution snapshot targets [server];
|
||||
operation refresh id "async:controller:refresh" : record { operationId: string; } -> string
|
||||
mode call execution remote receiver atom Document requires {
|
||||
interface document id "async:controller:document" : DocumentData using [content.get, summary.set];
|
||||
|
||||
@@ -14,7 +14,9 @@ test("remote adapters expose selected typed calls, lifetimes and explicit transa
|
||||
generatePortableTypeScriptBindings(schema, "async:controller-runtime@1", { target: "browser" }),
|
||||
/readonly "refresh"/,
|
||||
);
|
||||
const entry = schema.packages.find((p) => p.revisionId === "async:controller-runtime@1")!.exports[0]!;
|
||||
const entry = schema.packages
|
||||
.find((p) => p.revisionId === "async:controller-runtime@1")!
|
||||
.exports.find((entry) => entry.id === "async:controller:refresh")!;
|
||||
entry.dependencyPorts[0]!.requirement = {
|
||||
kind: "state",
|
||||
valueType: { kind: "scalar", name: "string" },
|
||||
|
||||
Reference in New Issue
Block a user