harden state durability and disable destructive snapshot sync

This commit is contained in:
Codex
2026-02-18 15:24:49 +00:00
parent 331b66506a
commit 4814342156
6 changed files with 123 additions and 35 deletions

View File

@@ -23,6 +23,7 @@ export const saveSnapshot = mutation({
args: {
snapshot: v.any(),
updatedAt: v.string(),
syncToDomain: v.optional(v.boolean()),
},
handler: async (ctx, args) => {
const latest = await ctx.db
@@ -30,7 +31,10 @@ export const saveSnapshot = mutation({
.order("desc")
.first();
const syncSummary = await syncFromEngineSnapshot(ctx, args.snapshot);
const shouldSync = Boolean(args.syncToDomain);
const syncSummary = shouldSync
? await syncFromEngineSnapshot(ctx, args.snapshot)
: null;
if (latest) {
await ctx.db.patch(latest._id, {