mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-06-14 02:40:45 +08:00
test(vector): lock authority protocol contracts
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user