Skip to content

feat(workspace): prove collaboration durability - #52

Merged
Programcode merged 3 commits into
mainfrom
debate-workspace-implementation
Sep 20, 2026
Merged

Programcode merged 3 commits into
mainfrom
debate-workspace-implementation

Conversation

@Programcode

@Programcode Programcode commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • pin the minimum open-source Tiptap, Yjs, and Hocuspocus stack
  • prove structured two-client convergence and local-only undo
  • gate SyncStep2 and Update on durable append before apply, broadcast, and sequence acknowledgement
  • prove duplicate delivery, append failure, stale epoch, invalid schema, size limits, serialized writers, acknowledgement replay, and SIGKILL recovery

This is an isolated Phase 0 spike. It adds no application route and authorizes no deployment.

Verification

  • npm run test:collaboration — 10/10 passed
  • npx vitest run src/test/workspace/collaboration.test.ts — 2/2 passed
  • npm run verify — passed
    • 1,131 covered Vitest tests
    • 186 native Edge tests
    • production build
    • 210 Chromium E2E passed, 1 skipped
    • one existing mobile navigation timing test failed its first attempt and passed the configured retry; a focused rerun behaved the same
  • git diff --check — passed

Boundaries

  • No database migration or RLS change in this spike
  • No staging or production migration/deployment
  • No OAuth, credential, secret, billing, or paid-service change
  • PostgreSQL advisory locks remain P2.1 work; this spike proves one-process serialization only

Summary by CodeRabbit

  • New Features

    • Added real-time collaborative workspace editing with shared document synchronization.
    • Added support for paragraphs, lists, links, tables, and local undo while preserving remote edits.
    • Added durable collaboration updates with replay after reconnecting or recovering from a server restart.
    • Added validation for document structure, update size, access, and stale changes.
  • Bug Fixes

    • Prevented updates from being acknowledged or broadcast until successfully persisted.
    • Improved recovery of acknowledged changes after connection interruptions.
  • Documentation

    • Added collaboration service documentation covering durability, recovery, and current limitations.

@vercel

vercel Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
debate-navigator Ready Ready Preview Sep 20, 2026 4:41pm UTC

Copilot AI lite review requested due to automatic review settings September 20, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 436d8e5a-332a-4ea3-ae91-f372d600bf28

📥 Commits

Reviewing files that changed from the base of the PR and between 9e380c6 and 18ccfed.

📒 Files selected for processing (8)
  • .github/workflows/deploy.yml
  • AGENTS.md
  • docs/development.md
  • docs/testing.md
  • package.json
  • services/collaboration/src/crash.test.ts
  • services/collaboration/src/server.test.ts
  • src/test/workspace/collaboration.test.ts
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: d307c7f8-889e-40df-a9cb-23323a2e1d9e

📥 Commits

Reviewing files that changed from the base of the PR and between 5d68baa and 9e380c6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • .hermes/plans/2026-09-20_131317-debate-workspace.md
  • package.json
  • services/collaboration/README.md
  • services/collaboration/src/crash.test.ts
  • services/collaboration/src/server.test.ts
  • services/collaboration/src/server.ts
  • services/collaboration/src/test/crash-server.ts
  • services/collaboration/src/test/document.ts
  • services/collaboration/vitest.config.ts
  • src/lib/workspace/editor-schema.ts
  • src/lib/workspace/schema.ts
  • src/test/workspace/collaboration.test.ts
  • tsconfig.app.json

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Added workspace Yjs editing, a durable Hocuspocus collaboration server, append-only crash recovery, and tests for synchronization, validation, acknowledgements, concurrency, size limits, and restart recovery.

Changes

Workspace collaboration foundation

Layer / File(s) Summary
Workspace schema, editor wiring, and collaboration validation
src/lib/workspace/schema.ts, src/lib/workspace/editor-schema.ts, src/test/workspace/*, services/collaboration/src/test/document.ts, package.json, tsconfig.app.json, services/collaboration/vitest.config.ts
Added Tiptap and Yjs workspace support. Added document helpers and tests for synchronization, concurrent edits, links, lists, and local undo behavior.

Durable collaboration server

Layer / File(s) Summary
Durable update processing and acknowledgement flow
services/collaboration/src/server.ts, services/collaboration/src/server.test.ts
Added authenticated document loading, schema and size validation, per-document serialization, durable append handling, deterministic mutation IDs, bounded acknowledgement queries, and tests for failures, duplicates, epochs, concurrency, and replay.

Crash recovery

Layer / File(s) Summary
Append-only persistence and restart recovery
services/collaboration/src/test/crash-server.ts, services/collaboration/src/crash.test.ts, services/collaboration/README.md, .hermes/plans/2026-09-20_131317-debate-workspace.md, package.json
Added a JSON-lines store and crash-test server. Tests verify persistence across forced termination and restart. Documentation and scripts describe the Phase 0 collaboration spike.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant CollaborationServer
  participant DurableUpdateStore
  participant ReconnectedClient
  Client->>CollaborationServer: Submit Yjs update
  CollaborationServer->>DurableUpdateStore: Append update
  DurableUpdateStore-->>CollaborationServer: Confirm durable sequence
  CollaborationServer-->>Client: Send acknowledgement
  ReconnectedClient->>CollaborationServer: Load document
  CollaborationServer->>DurableUpdateStore: Read persisted updates
  DurableUpdateStore-->>CollaborationServer: Return updates
  CollaborationServer-->>ReconnectedClient: Restore document content
Loading

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

Comment @coderabbitai help to get the list of available commands.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Programcode
Programcode merged commit 7b1e20c into main Sep 20, 2026
4 of 5 checks passed
@Programcode
Programcode deleted the debate-workspace-implementation branch September 20, 2026 16:41

This branch was successfully deployed

1 active deployment
Preview — 18ccfed7 Deployed Sep 20, 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.

2 participants