mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Fix multi-device sync after persistence refactor
This commit is contained in:
@@ -2332,6 +2332,16 @@ result = {
|
||||
historyAdvanceAllowed: false,
|
||||
historyAdvanced: false,
|
||||
};
|
||||
const committedGraph = structuredClone(graph);
|
||||
committedGraph.historyState.lastProcessedAssistantFloor = 1;
|
||||
committedGraph.lastProcessedSeq = 1;
|
||||
committedGraph.batchJournal = [
|
||||
{
|
||||
id: "journal-queued-1",
|
||||
processedRange: [1, 1],
|
||||
createdAt: Date.now(),
|
||||
},
|
||||
];
|
||||
harness.api.setCurrentGraph(graph);
|
||||
harness.api.setGraphPersistenceState({
|
||||
loadState: "loaded",
|
||||
@@ -2344,6 +2354,14 @@ result = {
|
||||
pendingPersist: true,
|
||||
writesBlocked: false,
|
||||
});
|
||||
harness.api.writeGraphShadowSnapshot(
|
||||
"chat-pending-persist-retry",
|
||||
committedGraph,
|
||||
{
|
||||
revision: 7,
|
||||
reason: "queued-persist-authoritative",
|
||||
},
|
||||
);
|
||||
harness.runtimeContext.__markSyncDirtyShouldThrow = true;
|
||||
|
||||
const result = await harness.api.retryPendingGraphPersist({
|
||||
@@ -2369,6 +2387,15 @@ result = {
|
||||
harness.api.getCurrentGraph().historyState.lastBatchStatus.persistence.outcome,
|
||||
"saved",
|
||||
);
|
||||
assert.equal(
|
||||
harness.api.getCurrentGraph().batchJournal?.length,
|
||||
1,
|
||||
"pending persist retry 应把 authoritative batch journal 回填到 runtime graph",
|
||||
);
|
||||
assert.equal(
|
||||
harness.api.getCurrentGraph().batchJournal?.[0]?.id,
|
||||
"journal-queued-1",
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user