test(vector): lock authority protocol contracts

This commit is contained in:
youzini
2026-06-09 11:38:27 +00:00
parent 01f8368e25
commit 091ee17f8b
4 changed files with 29 additions and 0 deletions

View File

@@ -267,6 +267,16 @@ assert.equal(isAuthorityVectorConfig(config), true);
const applyCall = triviumClient.calls.find(([name]) => name === "bmeVectorApply")?.[1];
assert.equal(applyCall.items.length, 2);
assert.equal(applyCall.links.length, 1);
assert.deepEqual(applyCall.links[0].src, {
externalId: "node-a",
namespace: "st-bme::chat-authority-vector",
});
assert.deepEqual(applyCall.links[0].dst, {
externalId: "node-b",
namespace: "st-bme::chat-authority-vector",
});
assert.equal(applyCall.links[0].label, "related");
assert.equal(applyCall.links[0].weight, 0.75);
assert.equal(applyCall.observedDim, 2);
assert.equal(String(applyCall.vectorSpaceId || "").startsWith("vs_"), true);
assert.equal(applyCall.items.every((item) => item.payload?.vectorSpaceId === applyCall.vectorSpaceId), true);

View File

@@ -158,6 +158,7 @@ await runAuthorityE2eStep("trivium", async () => {
headerProvider,
});
assert.equal(linkResult.linked, graph.edges.length);
assert.ok(linkResult.linked >= 1, "Authority Trivium link sync should create at least one edge");
const searchResults = await searchAuthorityTriviumNodes(graph, "Authority E2E Alpha", config, {
namespace,
@@ -169,6 +170,10 @@ await runAuthorityE2eStep("trivium", async () => {
headerProvider,
});
assert.ok(Array.isArray(searchResults));
assert.ok(
searchResults.every((result) => typeof result?.nodeId === "string" && result.nodeId.trim()),
"Authority Trivium search results should expose external node ids",
);
const filteredIds = await filterAuthorityTriviumNodes(config, {
namespace,
@@ -191,6 +196,10 @@ await runAuthorityE2eStep("trivium", async () => {
headerProvider,
});
assert.ok(Array.isArray(neighborIds));
assert.ok(
neighborIds.includes(graph.nodes[1].id),
"Authority Trivium neighbors should resolve links through external ids",
);
return {
upserted: upsertResult.upserted,