Skip to content

B-Extra: live file lists through the root room - #445

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

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

Conversation

@bubulux

@bubulux bubulux commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Part of #426 (B-Extra), round 3, step 5: live file lists (R14).

How it works

  • Which roots changed: the access checks a write goes through (checkAccess for files; assertAccess/assertRef for projects; rootFrom for the home) note the roots the request may change. Notes are taken only at editor rank and above, so reads note nothing.
  • Telling them: after a write that went through (status < 400), the Worker tells each noted root's room changed. Taking or renewing an edit lock does not count.
  • The rooms: the existing CanvasRoom Durable Object class under the name root:<project id> or root:home:<user id>. No new class, so the deploy changes nothing.
  • Watching: GET /api/live/root?project_id= or ?home=1 opens a viewer's socket (viewer access is enough).
  • Studio: each root that a window shows keeps one socket. On changed it reads the root again (once for a burst of changes, 250 ms) and again after a reconnect. A photo uploaded from the phone, or a change made in another browser, shows without a reload, so no Reload button is needed.

Cost

One Durable Object request per write per root, plus one idle socket per open root per browser (hibernating).

Checked

  • make check green, with a new route test: another workspace cannot watch, and a watcher hears a folder made and binned. Tenancy has an entry for the route.
  • Clicked through: a folder created with a raw API call (as the phone does) appeared in another tab after 0.46 s. The test folder was purged again.
  • Not tested: the phone's Media list (it still reads on focus and sync).

🤖 Generated with Claude Code

…ged (#426)

- Worker: the access checks note the roots a request may change; after a write that went through,
  each root's room (the CanvasRoom class named root:<project> or root:home:<user>) says "changed".
  Lock takes and renewals do not count. GET /api/live/root opens a watcher's socket.
- Studio: every root on screen keeps a socket and reads itself again on "changed" (once for a burst)
  and after a reconnect; a photo uploaded from a phone shows without a reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bubulux
bubulux merged commit 1686455 into main Nov 25, 2026
5 checks passed
@bubulux bubulux mentioned this pull request Nov 25, 2026
41 tasks done
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