Expose bounded public reflection and presentation discovery

This commit is contained in:
Timothy J. Aveni
2026-09-22 17:22:48 -07:00
parent ca83dbd1a7
commit bcc915d597
3 changed files with 128 additions and 0 deletions
+32
View File
@@ -308,3 +308,35 @@ test("a count-only local query still requires complete relationship admission",
assert.throws(() => compileExecutionPlan(workspace), /REPLICA_TRAVERSAL_MISSING|REPLICA_RELATION_INCOMPLETE/);
}
});
test("public reflection contains nominal contracts and callable descriptors without private bindings", async () => {
const { publicDefinitionSnapshot } = await import("../src/execution-world/public-reflection.js");
const plan = compileExecutionPlan(await loadReaderWorkspace());
const installation = {
codec: "camino-execution-installation-v1" as const,
plan: plan.digest,
world: "test",
packages: plan.definition.workspace.packageImports.map((pkg) => ({
revision: pkg.revisionId,
root: "private-installation-root",
})),
components: [],
routes: {},
};
const snapshot = publicDefinitionSnapshot(plan, installation);
assert.ok(snapshot.rows.interfaces.length);
assert.ok(snapshot.rows.queries.length);
assert.ok(snapshot.rows.conformances.length);
const publicText = JSON.stringify(snapshot);
for (const privateKey of [
"privateAttachments",
"operationBindings",
"relationshipMaterializations",
"storagePolicy",
"ports",
])
assert.ok(!publicText.includes('"' + privateKey + '"'), privateKey);
assert.ok(publicText.includes('"descriptor"'));
assert.ok(publicText.includes('"scope":"class"'));
assert.equal(snapshot.id, publicDefinitionSnapshot(plan, installation).id);
});