fix(authority): continue replica sync after partial failures

This commit is contained in:
OpenCode
2026-05-15 17:08:20 +00:00
parent 30565e79cb
commit 71d39abe22
5 changed files with 113 additions and 10 deletions

View File

@@ -1740,6 +1740,9 @@ result = {
getAuthoritySnapshotForChat(chatId) {
return globalThis.__getAuthoritySnapshotForChat(chatId);
},
setAuthoritySnapshotForChat(chatId, snapshot) {
return globalThis.__setAuthoritySnapshotForChat(chatId, snapshot);
},
getAuthorityBlobWrites() {
return Array.from(globalThis.__authorityBlobWrites.entries()).map(([path, payload]) => [
path,
@@ -4812,6 +4815,19 @@ result = {
const checkpointGraph = deserializeGraph(checkpointPayload?.serializedGraph || "{}");
assert.equal(checkpointGraph.nodes[0]?.fields?.title, "事件-luker-authority-sql");
assert.notEqual(checkpointGraph.nodes[0]?.fields?.title, "事件-runtime-stale-checkpoint");
harness.api.setAuthoritySnapshotForChat(persistenceChatId, null);
const writeCountBeforeFailedCheckpoint = globalThis.__authorityBlobWrites.size;
const failedCheckpointResult = await harness.api.writeAuthorityCheckpointFromCurrentGraph({
reason: "authority-sql-checkpoint-source-missing-test",
});
assert.equal(failedCheckpointResult.success, false);
assert.equal(failedCheckpointResult.error, "authority-sql-checkpoint-source-empty");
assert.equal(
globalThis.__authorityBlobWrites.size,
writeCountBeforeFailedCheckpoint,
"Authority SQL canonical checkpoint must fail instead of writing stale runtime graph",
);
}
{