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:
@@ -12,12 +12,15 @@ function createRuntime(persistResult) {
|
||||
nodes: [],
|
||||
edges: [],
|
||||
historyState: {},
|
||||
batchJournal: [],
|
||||
};
|
||||
let processedHistoryUpdates = 0;
|
||||
let persistedGraphSnapshot = null;
|
||||
|
||||
return {
|
||||
graph,
|
||||
processedHistoryUpdates,
|
||||
persistedGraphSnapshot,
|
||||
ensureCurrentGraphRuntimeState() {},
|
||||
throwIfAborted() {},
|
||||
getCurrentGraph() {
|
||||
@@ -64,6 +67,7 @@ function createRuntime(persistResult) {
|
||||
};
|
||||
},
|
||||
async persistExtractionBatchResult() {
|
||||
persistedGraphSnapshot = arguments[0]?.graphSnapshot || null;
|
||||
return persistResult;
|
||||
},
|
||||
finalizeBatchStatus,
|
||||
@@ -73,13 +77,20 @@ function createRuntime(persistResult) {
|
||||
updateProcessedHistorySnapshot() {
|
||||
processedHistoryUpdates += 1;
|
||||
},
|
||||
appendBatchJournal() {},
|
||||
appendBatchJournal(targetGraph, entry) {
|
||||
if (!targetGraph.batchJournal) targetGraph.batchJournal = [];
|
||||
targetGraph.batchJournal.push(entry);
|
||||
},
|
||||
createBatchJournalEntry() {
|
||||
return { id: "journal-1" };
|
||||
return { id: "journal-1", processedRange: [5, 5] };
|
||||
},
|
||||
computePostProcessArtifacts() {
|
||||
return [];
|
||||
},
|
||||
applyProcessedHistorySnapshotToGraph(targetGraph, _chat, floor) {
|
||||
targetGraph.historyState.lastProcessedAssistantFloor = floor;
|
||||
targetGraph.lastProcessedSeq = floor;
|
||||
},
|
||||
getGraphPersistenceState() {
|
||||
return { chatId: "chat-test" };
|
||||
},
|
||||
@@ -87,6 +98,9 @@ function createRuntime(persistResult) {
|
||||
get processedHistoryUpdates() {
|
||||
return processedHistoryUpdates;
|
||||
},
|
||||
get persistedGraphSnapshot() {
|
||||
return persistedGraphSnapshot;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -119,6 +133,14 @@ function createRuntime(persistResult) {
|
||||
runtime.graph.historyState.lastBatchStatus.historyAdvanceAllowed,
|
||||
false,
|
||||
);
|
||||
assert.equal(
|
||||
runtime.persistedGraphSnapshot?.historyState?.lastProcessedAssistantFloor,
|
||||
5,
|
||||
);
|
||||
assert.equal(
|
||||
runtime.persistedGraphSnapshot?.batchJournal?.length,
|
||||
1,
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -150,6 +172,14 @@ function createRuntime(persistResult) {
|
||||
runtime.graph.historyState.lastBatchStatus.historyAdvanceAllowed,
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
runtime.persistedGraphSnapshot?.historyState?.lastProcessedAssistantFloor,
|
||||
5,
|
||||
);
|
||||
assert.equal(
|
||||
runtime.persistedGraphSnapshot?.batchJournal?.length,
|
||||
1,
|
||||
);
|
||||
}
|
||||
|
||||
console.log("extraction-persistence-gating tests passed");
|
||||
|
||||
Reference in New Issue
Block a user