mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-06-13 18:31:16 +08:00
test: cover Luker persistence without Authority
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -4525,6 +4525,74 @@ result = {
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
const chatId = "chat-luker-no-authority-primary";
|
||||
const harness = await createGraphPersistenceHarness({
|
||||
chatId,
|
||||
globalChatId: chatId,
|
||||
characterId: "char-luker-no-authority",
|
||||
chatMetadata: {
|
||||
integrity: "meta-luker-no-authority-primary",
|
||||
},
|
||||
});
|
||||
harness.runtimeContext.Luker = {
|
||||
getContext() {
|
||||
return harness.runtimeContext.__chatContext;
|
||||
},
|
||||
};
|
||||
harness.runtimeContext.extension_settings[MODULE_NAME] = {
|
||||
authorityEnabled: "on",
|
||||
authorityPrimaryWhenAvailable: true,
|
||||
authorityStorageMode: "server-primary",
|
||||
authoritySqlPrimary: true,
|
||||
authorityBrowserCacheMode: "minimal",
|
||||
};
|
||||
harness.api.setAuthorityCapabilityState({
|
||||
installed: false,
|
||||
healthy: false,
|
||||
serverPrimaryReady: false,
|
||||
storagePrimaryReady: false,
|
||||
reason: "authority-not-installed",
|
||||
});
|
||||
harness.api.setCurrentGraph(
|
||||
stampPersistedGraph(
|
||||
createMeaningfulGraph(chatId, "luker-no-authority"),
|
||||
{
|
||||
revision: 7,
|
||||
integrity: "meta-luker-no-authority-primary",
|
||||
chatId,
|
||||
reason: "luker-no-authority-seed",
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
const result = await harness.api.persistExtractionBatchResult({
|
||||
reason: "luker-no-authority-persist",
|
||||
lastProcessedAssistantFloor: 5,
|
||||
});
|
||||
|
||||
assert.equal(result.accepted, true);
|
||||
assert.equal(result.storageTier, "luker-chat-state");
|
||||
assert.equal(result.acceptedBy, "luker-chat-state");
|
||||
assert.equal(result.primaryTier, "luker-chat-state");
|
||||
assert.equal(result.cacheTier, "none");
|
||||
const manifest = await harness.runtimeContext.__chatContext.getChatState(
|
||||
LUKER_GRAPH_MANIFEST_NAMESPACE,
|
||||
);
|
||||
assert.equal(manifest?.storageTier, "luker-chat-state");
|
||||
assert.equal(manifest?.headRevision, result.revision);
|
||||
assert.equal(
|
||||
Number(harness.api.getIndexedDbSnapshot()?.meta?.revision || 0),
|
||||
0,
|
||||
"Authority 不可用时,Luker 主存储不应回退写浏览器大图谱缓存 revision",
|
||||
);
|
||||
assert.equal(
|
||||
Number(harness.api.getIndexedDbSnapshot()?.nodes?.length || 0),
|
||||
0,
|
||||
"Authority 不可用时,Luker 主存储不应回退写浏览器大图谱缓存 nodes",
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
const harness = await createGraphPersistenceHarness({
|
||||
chatId: "chat-luker-queued-save-detached",
|
||||
|
||||
Reference in New Issue
Block a user