Skip to content

fix(realtime): answer each field edit only once its own flush settles - #10713

Open
kowshikdev wants to merge 1 commit into
simstudioai:stagingfrom
kowshikdev:fix/realtime-confirm-own-flush
Open

kowshikdev wants to merge 1 commit into
simstudioai:stagingfrom
kowshikdev:fix/realtime-confirm-own-flush

Conversation

@kowshikdev

Copy link
Copy Markdown

Summary

Each subblock and variable flush now takes the value, operations and audit actor it stores. Flushes of one field run in order. The broadcast skips senders whose newer edit is still waiting, and the pending entry is removed only when no newer edit is queued.

Reviewer note: the first editor now receives the newer stored value, as in any non-overlapping sequence. If they are still typing with operations queued on the client, it can briefly overwrite their local value until their own operation lands.

Fixes #10712

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

New apps/realtime/src/handlers/field-update-flush.test.ts drives both real handlers with overlapping edits and held transactions (13 of 14 cases fail before the fix). The handler and middleware tests pass (186). The *.integration.ts race tests were not run.

Also checked, with this change stacked on staging (0f6b0d4) together with my other independent fixes, on Windows:

  • The new tests fail with the source change reverted and pass with it.
  • bun run type-check: 33/33 packages pass.
  • biome check on the changed files: no findings.
  • check-block-registry.ts origin/staging passes, and bun run generate leaves the tree clean (skills:sync cannot run on this checkout, which has no symlinks).
  • bun run check:audits: the 12 audits that fail also fail on a clean staging checkout on this machine (mostly Windows path handling). No additional audit fails.

Not run: the full bun run test suite, the integration suites (no Docker here), or a live run of the app.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

N/A

🤖 Generated with Claude Code

A subblock or variable edit that arrived while an earlier flush of the same
field was being stored joined that flush's operations. The earlier flush then
confirmed it before its value was written, so when its own write failed the
client had already dropped the operation and the edit was lost. The earlier
sender also stayed excluded from the later broadcast and kept a stale value,
and the variable audit named the later editor for the earlier change.

Each flush now takes the value, operations and actor it stores, flushes of a
field run in order, and the pending entry is removed only when no newer edit
is waiting, so an edit made during a flush is no longer dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Dec 3, 2026 2:35pm UTC

Request Review

This branch was previously deployed

1 inactive deployment
Preview — 8ab05f13 Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant