Remote / Declared writes
Checking the prediction against the server
Law.check (foldkit-remote/testing) executes one declared write on both client and server (with matching now and principal) and verifies optimistic predictions and refusals agree:
ts
import { Law } from 'foldkit-remote/testing'
const report = Law.check(Data, {
model,
holds: [{ entity: Product, ids: ['p1'] }],
mutation: Sell,
input: { id: 'p1', quantity: -2 },
now: 0,
}).pipe(Effect.provide(Remote.clientLayer(LawServer.handlers(lawServer, principal))))Enable Remote.make({ verifyPredictions: true }) in development to log PredictionMismatch diagnostics whenever a live server response disagrees with a client overlay.