Lower checked shared edges into the portable graph model
This commit is contained in:
@@ -76,3 +76,35 @@ test("key contracts cannot silently bind to unkeyed storage or the inverse proje
|
||||
assert.match(JSON.stringify(result.diagnostics), /key type|keyed projection|signature/i);
|
||||
}
|
||||
});
|
||||
|
||||
test("checked shared edges lower without granting conformance initialization ownership", () => {
|
||||
const edge = declarations.match(/ private edge Entries[\s\S]*?\n }/)![0];
|
||||
const shared = declarations
|
||||
.replace(edge, "")
|
||||
.replace(" conform Node as", edge.replace("private edge", "shared edge") + "\n conform Node as");
|
||||
const result = compile(shared);
|
||||
assert.ok(result.ok, JSON.stringify(result.diagnostics));
|
||||
const program = compileKernelProgram(compileExecutionPlan(result.workspace)) as {
|
||||
model: { edges: { id: string; owner: string | null }[] };
|
||||
};
|
||||
assert.deepEqual(
|
||||
program.model.edges.map((edge) => ({ id: edge.id, owner: edge.owner })),
|
||||
[{ id: "entries", owner: null }],
|
||||
);
|
||||
const seeded = compile(
|
||||
shared.replace(
|
||||
" bind entries.resolve",
|
||||
" initialize { initial to edge Entries.entries; };\n bind entries.resolve",
|
||||
),
|
||||
);
|
||||
assert.ok(!seeded.ok);
|
||||
assert.ok(seeded.diagnostics.some((issue) => issue.code === "invalid-initialization"));
|
||||
const scalar = compile(
|
||||
shared.replace(
|
||||
' atom Node id "node";',
|
||||
' atom Node id "node"; shared state Shared id "shared" on Node : string policy register default "";',
|
||||
),
|
||||
);
|
||||
assert.ok(scalar.ok, JSON.stringify(scalar.diagnostics));
|
||||
assert.throws(() => compileKernelProgram(compileExecutionPlan(scalar.workspace)), /UNSUPPORTED_SHARED_STORAGE/);
|
||||
});
|
||||
|
||||
@@ -148,7 +148,9 @@ test("standalone presentation rejects a general component contract that may requ
|
||||
assert.equal(member.kind, "module");
|
||||
if (member.kind !== "module") throw Error("Expected module");
|
||||
member.contract = "org.quixos.react.component/1";
|
||||
assert.ok(validateWorkspaceRevision(candidate).some((issue) => /subject-only/.test(issue.message)));
|
||||
assert.ok(
|
||||
validateWorkspaceRevision(candidate).some((issue) => /supported React presentation contract/.test(issue.message)),
|
||||
);
|
||||
});
|
||||
|
||||
test("checked component-only artifacts install without a service and reject missing or substituted entries", async () => {
|
||||
|
||||
Reference in New Issue
Block a user