fix: deep repair p0-p1 persistence runtime merge and integrity

This commit is contained in:
Youzini-afk
2026-03-31 02:38:27 +08:00
parent 10c6db258b
commit a2bed39e28
8 changed files with 1152 additions and 54 deletions

View File

@@ -24,6 +24,24 @@ const cleanDetection = detectHistoryMutation(chat, {
});
assert.equal(cleanDetection.dirty, false);
const missingHashesDetection = detectHistoryMutation(chat, {
lastProcessedAssistantFloor: 3,
processedMessageHashes: {},
});
assert.equal(missingHashesDetection.dirty, true);
assert.equal(missingHashesDetection.earliestAffectedFloor, 0);
const sparseHashesDetection = detectHistoryMutation(chat, {
lastProcessedAssistantFloor: 3,
processedMessageHashes: {
0: hashes[0],
2: hashes[2],
3: hashes[3],
},
});
assert.equal(sparseHashesDetection.dirty, true);
assert.equal(sparseHashesDetection.earliestAffectedFloor, 1);
const editedChat = structuredClone(chat);
editedChat[1].mes = "我改过内容了。";
const editedDetection = detectHistoryMutation(editedChat, {