Skip to content

B-Extra: edit locks always live through the Durable Object - #440

Merged
bubulux merged 1 commit into
mainfrom
feat/426-live-locks
Nov 25, 2026
Merged

bubulux merged 1 commit into
mainfrom
feat/426-live-locks

Conversation

@bubulux

@bubulux bubulux commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Part of #426 (B-Extra), round 2: edit locks are always live.

What changed

  • Worker (live.ts, canvas.ts, files.ts):
    • The lock routes tell the file's CanvasRoom when the lock is taken, renewed or released (tellRoom).
    • Every save of a lockable file tells the room saved.
    • An alarm at the lock's end announces that it ran out (unless it was renewed).
    • A viewer that joins late hears who holds the lock at once, even when the holder has no socket (the device).
    • The live socket opens in every project; canvas_live now only decides whether clients stream the content.
  • Studio (timeline, shot, flow via lock.ts; canvas): the socket opens in every project. Who edits updates at once. When the lock is freed, the window shows "Nobody is editing" and reads the last save. Content (doc, draft) streams only in a realtime project.
  • Device Flows editor: joins the room. It takes the lock as soon as it is free, and while someone else edits it reads each of their saves at once.
  • Cost: one Durable Object request per lock take, renewal (every 20–30 s) and save, plus one alarm per lock.

Checked

  • make check green, including a new route test: lock taken, saved, then released reaches a viewer without an editor socket. The old test now expects the socket to open in a 5-seconds project.
  • Clicked through on your make all: a timeline in two tabs; when the first stops editing, the second shows "Nobody is editing" after 0.2 s.
  • Not tested: the device editor joining the room, and the alarm on a real expiry (it fires 60 s after the last renewal).

🤖 Generated with Claude Code

@bubulux bubulux mentioned this pull request Nov 25, 2026
41 tasks done
- Worker: the lock routes tell the file's room when the lock is taken, renewed or let go; every save
  of a lockable file tells it "saved"; an alarm at the lock's end says when it ran out; a viewer that
  joins hears who holds it at once. The live socket opens in every project.
- Studio (timeline, shot, flow, canvas): the room's socket in every project; the content streams only
  in a realtime project. Freed: "Nobody is editing" and the last save at once.
- Device Flows editor: joins the room; takes the lock as soon as it is free, reads every save made
  elsewhere at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bubulux
bubulux force-pushed the feat/426-live-locks branch from 73d8c5b to 95b9363 Compare November 25, 2026 16:02
@bubulux
bubulux merged commit e500ed1 into main Nov 25, 2026
5 checks passed
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