feat(cli): support custom WebSocket query params in collaboration config (SD-2543)#2799
Merged
caio-pizzol merged 5 commits intomainfrom Apr 13, 2026
Conversation
SD-2543: Adds an optional `params` field to the CLI collaboration config, forwarded as query parameters on the y-websocket URL and as `parameters` on the Hocuspocus provider. Validates that values are strings and rejects the reserved `token` key (set automatically from `tokenEnv`). The field is omitted from the public collaboration summary since it may contain identifying metadata.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0bc8cee0c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…ed fields Follow-up to SD-2543 addressing two correctness bugs surfaced in review: 1. normalizeWebSocketProfile in context.ts dropped params when rehydrating persisted collab metadata from disk, so the reconnect reopened without the user-supplied query params. 2. profileToFingerprint in session-pool.ts used JSON.stringify's array replacer as a sort helper, but that filter applies at every depth and silently stripped nested objects. Two profiles differing only in params hashed identically, causing the pool to reuse the wrong session. Replaces the fingerprint helper with a recursive stable-stringify and adds params validation/preservation to the context normalizer. Adds mocked runtime tests covering the y-websocket and hocuspocus provider handoffs, the params+token merge order, and fingerprint key-order independence.
Adds a "Forward custom WebSocket query parameters" section to the SDK guide covering the new `params` field: scope (y-websocket and Hocuspocus only, not Liveblocks), the string-only shape, and the reserved `token` key.
The CLI's JSON schema validator crashed on `type: 'object'` schemas that
omitted the `properties` map (e.g. schemas that only declare
`additionalProperties`). `Object.entries(schema.properties)` threw
`Cannot convert undefined or null to object` before reaching the
downstream parser.
Default `schema.properties` to `{}` in both the request and response
validators so these schemas pass through to the layer that can actually
validate their contents. Exposed by SD-2543's collaboration.params
schema, which is the first schema in the repo to use this shape.
…parameters-in-collaboration
Contributor
|
🎉 This PR is included in superdoc-cli v0.7.0-next.9 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-sdk v1.6.0-next.6 |
Contributor
|
🎉 This PR is included in superdoc-cli v0.7.0 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-sdk v1.6.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional
params: Record<string, string>to the CLI collaboration config, forwarded onto the y-websocket / Hocuspocus WebSocket URL so customers can attach per-session metadata (activity tracking, tenant identifiers, etc.) without wrapping the provider themselves.paramswith the auth token intoproviderOptions.params. Hocuspocus: passed as its nativeparametersoption.tokenkey rejected with a pointer totokenEnv.normalizeWebSocketProfilepreservesparamsacross session reloads;profileToFingerprintuses a recursive stable stringify so the session pool distinguishes profiles that differ only in nestedparams.validateValueAgainstTypeSpecontype: 'object'schemas without an explicitpropertiesmap — activated by the new params schema and would have broken all--collaboration-jsonusage with websocket providers.@hocuspocus/server— custom params arrived at itsonConnecthook intact.apps/docs/document-engine/sdks.mdx.Resolves SD-2543, unblocks IT-915.