fix(cli): collab sync diagnostics β stable cherry-pick (SD-3233)#3408
Merged
Conversation
Before, COLLABORATION_SYNC_TIMEOUT details only contained
{ timeoutMs }. DNS failures, refused TCP, failed WS upgrades, and
auth rejections all collapsed to the same useless payload. The
timeout now captures last status/connection-error/connection-close/
authenticationFailed plus event counts, sanitized URL, documentId,
tokenEnv state, and paramsKeys.
Sensitive query params are redacted in URL and event payload
strings. y-websocket's [event, provider] emit pattern is reduced
to the first arg so the provider self-ref graph does not bloat
the envelope or risk leaking document content.
Mock constructors in runtime.test.ts updated: the previous pattern
returned undefined instances under bun's mock wrapping, which was
harmless when the runtime did not touch the provider synchronously.
The new attachProviderDiagnostics binding does.
decodeURIComponent throws URIError on malformed percent-encoding (e.g. a raw `%` in a query key). The diagnostics sanitizer runs inside the sync-timeout callback, so an uncaught throw would suppress the COLLABORATION_SYNC_TIMEOUT envelope entirely - the exact failure mode the rest of the module defends against. Falls back to the raw key on URIError so the sensitivity check still runs. Decoding stays in place so encoded variants like `%74oken` continue to redact correctly.
caio-pizzol
enabled auto-merge
May 20, 2026 17:19
Codecov Reportβ All modified and coverable lines are covered by tests. π’ Thoughts on this report? Let us know! |
caio-pizzol
disabled auto-merge
May 20, 2026 17:47
Contributor
|
π This PR is included in superdoc-sdk v1.10.1 |
Contributor
|
π This PR is included in @superdoc-dev/mcp v0.6.1 The release is available on GitHub release |
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.
Summary
Cherry-picks the SD-3233 collaboration-diagnostics fix from PR #3404 (
caio/collab-timeout-diagnosticsβmain) ontostableso we can cut a patch CLI release (e.g.1.8.1 β 1.8.2) without dragging in everything else onmain.Authorship preserved on both commits (Caio Pizzol).
Commits
966b3e988fix(cli): include provider diagnostics in collaboration sync timeoutsbfe0ff75ffix(cli): guard URI decode in collaboration diagnostics sanitizationBoth cherry-picked clean against
origin/stableβ no conflicts.What changes for the customer
Before:
COLLABORATION_SYNC_TIMEOUTerrors came back withdetails: { timeoutMs: 10000 }only. Customer had no way to tell whether the broker rejected auth, the TLS handshake failed, the hostname didn't resolve, or the server was just silent.After:
detailsnow includesproviderType, sanitizedurl(with?token=[REDACTED]),documentId,tokenEnvConfigured/authTokenResolvedsplit,paramsKeys,eventCounts,providerState, and per-event-typelast*snapshots (lastConnectionClose,lastConnectionError,lastAuthenticationFailed,lastClose,lastDisconnect,lastStatus).Same error code (
COLLABORATION_SYNC_TIMEOUT) β fully backward-compatible for any SDK consumer matching on the code.Verification on this branch
Suite
pnpm --filter @superdoc-dev/cli test -- --run collaborationβ 92 pass, 0 fail across 4 files.pnpm --filter @superdoc-dev/cli test(full) β 1251 pass, 0 fail, 8262 expect() across 51 files.bun build --compile.End-to-end against the real triage servers (
*.collab.superdoc.dev)Ran the customer-shape
--collaboration-jsoninvocation on the compiled SEA binary built off this branch:ok: truelastConnectionClose: { code: 1002, reason: "Expected 101 status code" },tokenEnvConfigured: false?token=[REDACTED]ok: truetokenEnvConfigured: false, stuck connectinglastAuthenticationFailed: { reason: "permission-denied" }lastConnectionClose: { code: 1006, reason: "Failed to connect" }Same envelope shape as on
main(PR #3404). Stable-line behaviour is identical.Release plan
Once merged, cut a patch from
stable(e.g.1.8.2). The customer (chynes / Lighthouse) can drop in the new binary and rerun their failing invocation; their error envelope will now includelastConnectionClose/lastAuthenticationFailed/ etc. and they can self-diagnose whether the failure is on our side or their broker.Related
main: Add collaboration provider diagnostics to sync timeout errorsΒ #3404COLLABORATION_SYNC_TIMEOUTafter 10s with no diagnostic info.