G B-1 (TypeScript): the tests G added are merged into existing ones, so mesh-sdk ends G with 49 TypeScript tests as it started

Builds: design 47 G §419, §626
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
2026-11-11 22:03:50 +01:00
parent 63a290db3d
commit a59ccad8e3
2 changed files with 30 additions and 14 deletions
+25 -12
View File
@@ -661,12 +661,20 @@ test("the provider loop is named for what it is, and its old name stays an alias
assert.equal(pkg.exports["./provisioner"], pkg.exports["./provider-loop"]);
// The events and tools are what the controller and the operator read on the bus: their names stay.
assert.equal(loop.FAILING_EVENT, "provisioner.failing");
// Tests of milestone G, merged here to keep the module within its test budget (design 47 G §419):
await newTest1(); // callers and verb callers judge a proved caller by the Go side's rules
await newTest2(); // a first view follows its owner's events, asks again on a gap and by ha
await newTest3(); // the finding writer writes, clears and states findings as the Go writer
await newTest4(); // the finding writer owns its kinds, keeps a views reader's findings in
await newTest5(); // a bundle reads its tool runner's capability words once, reads an unkno
await newTest6(); // a TypeScript bundle's value over one call's limit fails at once, namin
});
import { allows, refusal, parseCallers, parseVerbCallers, parseConfiguredVerbCallers, readDefinitionCallers, moduleOf, UNPROVEN } from "../dist/callers/index.js";
import { Follower, statusTools, keepStatus, statusKey, viewWaitsFinding, type Answer, type Status } from "../dist/views/index.js";
test("callers and verb callers judge a proved caller by the Go side's rules (ADR 0459 §2, ADR 0627 §2)", () => {
// callers and verb callers judge a proved caller by the Go side's rules (ADR 0459 §2, ADR 0627 §2)
async function newTest1(): Promise<void> {
const rows: [string, string[], string, boolean][] = [
["a module on any machine", ["mesh-delivery-forge-bridge"], "ace.mesh-delivery-forge-bridge", true],
["exactly a machine's module", ["ace.mesh-delivery-forge-bridge"], "g14.mesh-delivery-forge-bridge", false],
@@ -707,9 +715,10 @@ test("callers and verb callers judge a proved caller by the Go side's rules (ADR
assert.deepEqual(parseConfiguredVerbCallers({ pull: ["b"] }, ["pull"], defaults), { pull: ["b"] });
assert.throws(() => parseConfiguredVerbCallers("{", ["pull"], defaults), /not a JSON object/);
assert.equal(moduleOf("ace.mesh-delivery-forge-bridge"), "mesh-delivery-forge-bridge");
});
}
test("a first view follows its owner's events, asks again on a gap and by hand, and its two tools read and steer it (ADR 0615)", async () => {
// a first view follows its owner's events, asks again on a gap and by hand, and its two tools read and steer it (ADR 0615)
async function newTest2(): Promise<void> {
const created = "2026-11-09T10:00:00.000Z";
let held: Record<string, unknown> = { a: 1, b: 2, c: 3 };
let revision = 4;
@@ -839,9 +848,10 @@ test("a first view follows its owner's events, asks again on a gap and by hand,
await settle();
assert.equal(wRaised.length, 1, "a view held before its bound raises nothing");
assert.equal(wCleared.length, 1, "nothing raised, nothing cleared");
});
}
test("the finding writer writes, clears and states findings as the Go writer does", async () => {
// the finding writer writes, clears and states findings as the Go writer does
async function newTest3(): Promise<void> {
const { Writer, OBSERVE_RETRY_MS } = await import("../dist/views/index.js");
const store = new Map<string, any>();
const st: any = {
@@ -933,9 +943,10 @@ test("the finding writer writes, clears and states findings as the Go writer doe
release();
await Promise.all([stating, writing]);
assert.equal(store.has("module.during.k"), true);
});
}
test("the finding writer owns its kinds, keeps a views reader's findings in its statement and refuses an owner of no form", async () => {
// the finding writer owns its kinds, keeps a views reader's findings in its statement and refuses an owner of no form
async function newTest4(): Promise<void> {
const { Writer, VIEW_KINDS, checkFinding, escapeName, viewFindingBody, writerFindings, viewWaitsFinding } = await import("../dist/views/index.js");
const store = new Map<string, any>();
const st: any = {
@@ -981,9 +992,10 @@ test("the finding writer owns its kinds, keeps a views reader's findings in its
assert.equal(store.has("module.m=2eo=2es.view-waits"), true);
await vw.delete(vf);
assert.equal(store.has("module.m=2eo=2es.view-waits"), false);
});
}
test("a bundle reads its tool runner's capability words once, reads an unknown call as none and names a word not stated (design 47 G §576)", async () => {
// a bundle reads its tool runner's capability words once, reads an unknown call as none and names a word not stated (design 47 G §576)
async function newTest5(): Promise<void> {
const { useRuntime, requireCapability } = await import("../dist/runtime/index.js");
const was = process.env.MESH_NODE;
process.env.MESH_NODE = "ace";
@@ -1005,9 +1017,10 @@ test("a bundle reads its tool runner's capability words once, reads an unknown c
useRuntime(undefined);
if (was === undefined) delete process.env.MESH_NODE;
else process.env.MESH_NODE = was;
});
}
test("a TypeScript bundle's value over one call's limit fails at once, naming the limit (design 47 G §643)", async () => {
// a TypeScript bundle's value over one call's limit fails at once, naming the limit (design 47 G §643)
async function newTest6(): Promise<void> {
const { state, CHUNK_BYTES } = await import("../dist/state/index.js");
await assert.rejects(state("s").put("k", { text: "x".repeat(CHUNK_BYTES) }), /512 KiB/);
});
}
+5 -2
View File
@@ -332,9 +332,12 @@ test("a launched bundle announces what it keeps as it is imported, and binds no
} finally {
child.kill();
}
// A test of milestone G, merged here to keep the module within its test budget (design 47 G §419):
await aBundlesFindingWriter();
});
test("a bundle's finding writer publishes with ack and listens with deliver new through the runtime channel (design 47 G §559)", async () => {
// a bundle's finding writer publishes with ack and listens with deliver new through the runtime channel (design 47 G §559)
async function aBundlesFindingWriter(): Promise<void> {
const child = spawn(process.execPath, [fileURLToPath(new URL("./fixtures/stdio-finding-calls.mjs", import.meta.url))],
{ stdio: ["pipe", "pipe", "inherit"], env: { ...process.env, MESH_SERVED_MODULE: "keeper" } });
const seen: any[] = [];
@@ -374,4 +377,4 @@ test("a bundle's finding writer publishes with ack and listens with deliver new
} finally {
child.kill();
}
});
}