Yjs persistence redesign#462
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (27)
📝 WalkthroughWalkthroughThis PR introduces significant backend persistence redesign for Durable Objects (switching from debounced full-doc persistence to SQL-backed incremental Yjs updates), expands tool resource content models, adds persistence recovery E2E tests, refactors multiple worker routes for type safety, and includes various frontend component refinements and documentation updates. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as WebSocket Client
participant ProjectDoc
participant DOState as Durable Object State<br/>(SQL + KV)
participant Logger as PersistenceLogger
Note over Client,Logger: Runtime Update Event
Client->>ProjectDoc: Y.Doc update event
ProjectDoc->>ProjectDoc: Capture update payload
ProjectDoc->>DOState: INSERT INTO yjs_updates<br/>(kind='update', payload)
DOState-->>ProjectDoc: Insert complete
ProjectDoc->>Logger: Log persistence_insert_failed<br/>(if error)
Logger-->>ProjectDoc: Logged
Note over ProjectDoc,DOState: Opportunistic Compaction Check
alt rowCount >= COMPACTION_THRESHOLD
ProjectDoc->>ProjectDoc: Collect all rows<br/>from SQL
ProjectDoc->>ProjectDoc: Reconstruct Y.Doc<br/>from updates/snapshots
ProjectDoc->>ProjectDoc: chunkSnapshot()<br/>into CHUNK_SIZE pieces
ProjectDoc->>DOState: BEGIN TRANSACTION
DOState->>DOState: DELETE old rows
DOState->>DOState: INSERT chunked<br/>snapshot rows
DOState-->>ProjectDoc: COMMIT
ProjectDoc->>Logger: Log compaction_failed<br/>(if INSERT fails)
alt Compaction succeeded
Logger-->>ProjectDoc: Success logged
else Compaction failed
Logger-->>ProjectDoc: Failure logged
ProjectDoc->>DOState: Rollback to<br/>pre-compaction rows
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
corates-workers-prod | b33e022 | Apr 07 2026, 07:24 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
corates | b33e022 | Apr 07 2026, 07:26 PM |
Summary by CodeRabbit
Release Notes
New Features
Improvements
Documentation