perf: optimize persist delta gating and diagnostics

This commit is contained in:
Youzini-afk
2026-04-13 16:11:22 +08:00
parent 8f7572b615
commit b16785e56f
30 changed files with 4495 additions and 47 deletions

View File

@@ -9,6 +9,7 @@ import {
buildGraphFromSnapshot,
buildPersistDelta,
buildSnapshotFromGraph,
evaluatePersistNativeDeltaGate,
} from "../sync/bme-db.js";
import { onMessageReceivedController } from "../host/event-binding.js";
import {
@@ -880,6 +881,7 @@ async function createGraphPersistenceHarness({
buildGraphFromSnapshot,
buildPersistDelta,
buildSnapshotFromGraph,
evaluatePersistNativeDeltaGate,
buildBmeDbName,
scheduleUpload() {
if (runtimeContext.__scheduleUploadShouldThrow) {
@@ -2619,6 +2621,12 @@ result = {
7,
"附属步骤失败时IndexedDB 主写仍应视为成功",
);
const persistDeltaDiagnostics = harness.api.getGraphPersistenceState().persistDelta;
assert.equal(Boolean(persistDeltaDiagnostics), true);
assert.equal(persistDeltaDiagnostics.status, "committed");
assert.equal(persistDeltaDiagnostics.path, "js");
assert.equal(persistDeltaDiagnostics.requestedNative, false);
assert.equal(Number.isFinite(Number(persistDeltaDiagnostics.buildMs)), true);
}
{