Fix cloud backup restore runtime refresh

This commit is contained in:
Hao19911125
2026-04-21 14:47:03 +08:00
parent 076618bc25
commit 5e238423d6
2 changed files with 50 additions and 1 deletions

View File

@@ -1936,6 +1936,51 @@ result = {
);
}
{
const harness = await createGraphPersistenceHarness({
chatId: "chat-sync-refresh-restore",
chatMetadata: {
integrity: "chat-sync-refresh-restore-ready",
},
});
harness.api.setCurrentGraph(
normalizeGraphRuntimeState(
createMeaningfulGraph("chat-sync-refresh-restore", "stale-runtime-restore"),
"chat-sync-refresh-restore",
),
);
harness.api.setGraphPersistenceState({
loadState: "loaded",
chatId: "chat-sync-refresh-restore",
reason: "runtime-stale",
revision: 5,
lastPersistedRevision: 5,
dbReady: true,
writesBlocked: false,
});
harness.api.setIndexedDbSnapshot(
buildSnapshotFromGraph(
createMeaningfulGraph("chat-sync-refresh-restore", "fresh-indexeddb-restore"),
{
chatId: "chat-sync-refresh-restore",
revision: 9,
},
),
);
const runtimeOptions = harness.api.buildBmeSyncRuntimeOptions();
await runtimeOptions.onSyncApplied({
chatId: "chat-sync-refresh-restore",
action: "restore-backup",
});
assert.equal(
harness.api.getCurrentGraph().nodes[0]?.fields?.title,
"事件-fresh-indexeddb-restore",
"restore-backup 后应刷新当前运行时图谱",
);
}
{
const harness = await createGraphPersistenceHarness({
chatId: "chat-sync-refresh-active",