Skip to content

[WIKI-682] feat: hocuspocus v3 server migration#7880

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
feat/hocuspocus-v3
Sep 30, 2025
Merged

[WIKI-682] feat: hocuspocus v3 server migration#7880
sriramveeraghanta merged 2 commits intopreviewfrom
feat/hocuspocus-v3

Conversation

@Palanikannan1437
Copy link
Copy Markdown
Member

@Palanikannan1437 Palanikannan1437 commented Sep 30, 2025

Description

Upgrades hocuspocus to v3

Type of Change

  • [ x] Feature (non-breaking change which adds functionality)

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • Chores

    • Upgraded Hocuspocus packages to v3 for live collaboration components.
  • Refactor

    • Updated server initialization to the new Hocuspocus API.
    • Adjusted Redis message publishing to use encoded messages with publish.
    • Revised shutdown flow to close connections directly, with updated logging.

Impact: Improves compatibility with the latest collaboration engine and streamlines connection handling for more reliable live sessions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 30, 2025

Walkthrough

Upgrades Hocuspocus packages to v3, updates server initialization to the new Hocuspocus constructor, adjusts Redis extension to use encodeMessage with publish, and changes shutdown to closeConnections without awaiting destroy. No public API exports changed.

Changes

Cohort / File(s) Summary
Dependencies: Hocuspocus v3 bump
apps/live/package.json
Bumps @hocuspocus/extension-database, -logger, -redis, and server from ^2.15.0 to ^3.0.0.
Server initialization API update
apps/live/src/hocuspocus.ts
Switches from Server.configure(...) to new Hocuspocus({...}); updates import to only Hocuspocus; preserves options including extensions and debounce.
Redis publish/encoding change
apps/live/src/extensions/redis.ts
Replaces publishBuffer with publish; removes manual prefix framing; sends this"encodeMessage" directly.
Shutdown flow adjustment
apps/live/src/server.ts
Replaces await server.destroy() with server.closeConnections(); updates log message to reflect connection closure.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant Hocuspocus
  participant Extensions
  participant Redis

  rect rgba(230,240,255,0.5)
    note over Hocuspocus: Initialization (v3)
    Client->>Hocuspocus: Connect
    Hocuspocus->>Extensions: Load extensions
  end

  rect rgba(240,255,240,0.5)
    note over Extensions,Redis: Redis broadcast (updated)
    Extensions->>Extensions: encodeMessage(message.toUint8Array())
    Extensions->>Redis: publish(encodedMessage)
  end

  rect rgba(255,245,230,0.5)
    note over Hocuspocus: Shutdown (changed)
    Client-->>Hocuspocus: Disconnect/Signal
    Hocuspocus->>Hocuspocus: closeConnections()
    note over Hocuspocus: Connections closed (server not destroyed here)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I thump my feet, v3 is here—hip hop, hooray!
New Hocuspocus blooms, connections lead the way.
Redis hums with tidy bytes, no prefixes to chase,
We close the links, not worlds, with gentle rabbit grace.
Patch by patch, I nibble code—spring-cleaned space! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description includes the required Description and Type of Change sections but omits any details in the Test Scenarios section and leaves the Screenshots and References blocks unfilled, thus missing critical verification information. Please add a summary of the tests you ran under the Test Scenarios heading, explicitly mark the Screenshots section as N/A or include relevant media if applicable, and link any related issue or work item (e.g., WIKI-682) in the References section.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and succinctly summarizes the primary change by indicating the feature scope and Hocuspocus v3 server migration, following conventional commit style and including the relevant ticket reference.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/hocuspocus-v3

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.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

@makeplane
Copy link
Copy Markdown

makeplane Bot commented Sep 30, 2025

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/live/src/extensions/redis.ts (1)

23-28: Consider requesting public API for custom broadcasting.

If broadcastToDocument is a common pattern in your codebase, consider opening a feature request with the Hocuspocus project to expose a public API for custom broadcast operations. This would eliminate the fragile dependency on private methods and provide a stable extension point.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e110ef5 and 098a616.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • apps/live/package.json (1 hunks)
  • apps/live/src/extensions/redis.ts (1 hunks)
  • apps/live/src/hocuspocus.ts (2 hunks)
  • apps/live/src/server.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/live/src/server.ts (1)
packages/logger/src/config.ts (1)
  • logger (14-14)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
apps/live/src/hocuspocus.ts (2)

1-1: LGTM! Correct import for v3 migration.

The import has been correctly updated from Server to Hocuspocus, aligning with the v3 API separation where Hocuspocus is used for library/embedding patterns (as opposed to the standalone Server class for built-in server scenarios).

Based on learnings.


39-45: LGTM! Correct instantiation pattern for v3.

The migration correctly replaces Server.configure({...}) with new Hocuspocus({...}), which is the primary breaking change in the v3 upgrade. The configuration object structure (name, hooks, extensions, debounce) remains compatible.

Based on learnings.

apps/live/src/server.ts (1)

102-103: Verify closeConnections() does not require awaiting
The migration replaced await destroy() with a synchronous call to closeConnections(). If closeConnections() returns a Promise (e.g., for flushing pending messages or notifying clients), not awaiting it can cause incomplete cleanup or race conditions before shutting down Redis and the HTTP server. Confirm via the library’s TypeScript definitions or documentation that closeConnections() is truly synchronous.

apps/live/src/extensions/redis.ts (1)

23-28: Verify private Redis extension APIs and publish signature
• Confirm pubKey and encodeMessage remain available and stable in @hocuspocus/extension-redis v3.
• Ensure encodeMessage(message.toUint8Array()) produces the correct wire format (including any metadata prefixes).
• Verify publish accepts a raw Uint8Array payload rather than a structured object.
Manually inspect the installed v3 package (for example via npm explore @hocuspocus/extension-redis -- cat src/index.ts) to confirm these APIs and signatures.

apps/live/package.json (1)

24-27: Verify resolved @hocuspocus versions post-install. Run npm install (or npm ci), then confirm in your lockfile that @hocuspocus/server, @hocuspocus/extension-database, @hocuspocus/extension-logger, and @hocuspocus/extension-redis are resolved to v3.2.3 (or another tested 3.x release), and re-run the security advisory check to ensure no vulnerabilities.

@sriramveeraghanta sriramveeraghanta merged commit ee68895 into preview Sep 30, 2025
6 of 7 checks passed
@sriramveeraghanta sriramveeraghanta deleted the feat/hocuspocus-v3 branch September 30, 2025 15:25
zy1000 pushed a commit to zy1000/plane that referenced this pull request Oct 1, 2025
* fix: hocuspocus v3

* fix: publishing messages across redis extension
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