Repository navigation
fix(ws): restore live websocket URL helpers - #11465
RohitChauhan13 wants to merge 2 commits into
Conversation
Restore sanitizeLiveWsPort() and resolveLiveWsUrl() exports that were missing after the runtime public URL refactor, fixing a build error where useLiveDashboard.ts could not resolve these named imports.
|
I hit this from the other side — the production build is red on every open PR right now — and had a restore ready before I found yours. Yours is better than mine, so I am dropping mine. Two things from the verification that may be worth having on the record. Your patch passes the pinned test. With your diff applied to that tip: 11 pass, 0 fail, On the root cause — the helpers were not dropped by a refactor. They were added by #11388, which merged into Three of the four are on the v3.8.51 tip. Your version is stricter than the original in four places, and none of them is covered by the tests. I diffed the two implementations by running both:
All four are improvements — the original happily handed an But the 11 existing assertions pass either way, which means nothing stops the strictness being refactored back out. If you want it pinned, four one-liners in |
Thanks for the detailed verification and for pointing out the untested stricter behavior. I’ve added regression coverage for all four cases you mentioned:
The test suite now passes with 15/15 tests passing, 0 failures. |
|
Confirmed on my side. Applied your head ( I also checked the two port tests actually hold the line rather than just passing, by reverting So those two are load-bearing — the strictness cannot be refactored back out silently now. I did not get a clean mutation on the URL-guard half; my substitution did not match your code shape and I did not want to hand-edit your logic to force it. Worth saying rather than implying I checked all four. This unblocks the production build on every open PR, so from my side it is good to go. |
Thanks again for verifying the fix. Since this issue currently affects the production build and can cause problems for new users using the affected functionality, could you please help get this PR merged as soon as possible? This would prevent other users from running into the same issue. Thanks! |
ntdatt812
left a comment
There was a problem hiding this comment.
I should be straight about what I can and cannot do here: I have no write access to this repo, so I cannot merge this or put it in the queue. Approving is the whole of my leverage, and I have done that above.
What I can add is the part a maintainer will want before queueing it, stated as scope rather than as a blanket "LGTM":
- Verified: your head
1e133b0cfapplied to therelease/v3.8.51tip6435f618fgives 15 pass / 0 fail. The two port assertions are load-bearing — revertingsanitizeLiveWsPortto the loose original turns exactly those two red. Without this branch the pinned test file cannot even load on that tip (does not provide an export named 'resolveLiveWsUrl'), so the failure is not subtle. - Not verified by me: the URL-guard half, in the mutation sense. The assertions pass; I did not prove they would fail against a looser implementation.
- Blast radius: restores one file,
src/shared/utils/wsPath.ts, that #11388 added and the per-file assembly of this release branch dropped. Nothing else on the tip imports a symbol this changes.
On timing — merges here go through the Mergify queue, and both of its checks are currently neutral, meaning it has not been queued rather than that anything failed. That step needs someone with write access; the semgrep scan is already green. Nothing further is needed from either of us to make it mergeable.
If it helps make the case: this is not only a new-user problem. Every open PR targeting release/v3.8.51 currently inherits the broken production build, so a red run on any of them says nothing about that PR until this lands.
Thanks for the detailed verification and for approving the PR. I also completed the URL-guard mutation check locally to cover the part you could not verify:
So the URL-guard assertions are load-bearing as well. Thanks again for the approval and for providing the verification details for the maintainer. |
|
Reproduced your mutation independently, and it holds — same two, same counts: I dropped only the two scheme guards inside More important: the base moved under this PR, so my earlier "nothing further is needed" is out of date. The tip is now Re-measured on the new tip:
Also worth correcting something I wrote earlier, since it will read as odd to anyone checking now: I said |
Thanks for re-checking the mutation independently and for verifying the PR against the updated base. Glad to see that all four regression behaviours are now confirmed as load-bearing, and that the merged result on Also thanks for clarifying the earlier Everything looks good from my side. Hopefully it can now be queued through Mergify and merged. Thanks again for the thorough verification and approval. |
|
Thanks for catching this — closing in favor of #11502, which already landed the identical fix and merged today: No distinct value remains to carry forward — same root cause (the #11331 fix's exports getting overwritten by a same-day competing PR's hunk), same fix shape. Appreciate the independent catch. |
Thanks for the update and for confirming that the same fix has landed in #11502. Glad the root cause and the fix were independently confirmed. Appreciate the thorough verification and review throughout this PR. |
Fix PR: Restore live WebSocket URL export compatibility
Summary
This fix resolves the build error caused by a stale import in the live dashboard hook:
resolveLiveWsUrlandsanitizeLiveWsPortThe fix restores the expected helper API while preserving the newer runtime URL behavior for
LIVE_WS_PUBLIC_URLandNEXT_PUBLIC_LIVE_WS_PUBLIC_URL.Root cause
The module src/shared/utils/wsPath.ts was refactored to expose
deriveLiveWsPath()andresolveLiveWsPublicUrl(), but the live dashboard hook and the regression tests were still importing older helpers:resolveLiveWsUrlsanitizeLiveWsPortThat mismatch caused the build-time import error:
Files changed
What was added
The module now exports:
sanitizeLiveWsPort(port)resolveLiveWsUrl({ ... })deriveLiveWsPath(publicUrl?)resolveLiveWsPublicUrl(env?)getLiveWsPath()This keeps compatibility with the dashboard hook while preserving the runtime-aware reverse-proxy logic introduced for the websocket handshake fix.
Why this is correct
The restored helper functions implement the intended behavior:
wsUrlwhen the caller passes one.LIVE_WS_PUBLIC_URLas the runtime override while keepingNEXT_PUBLIC_LIVE_WS_PUBLIC_URLas a fallback.This matches the design expected by the dashboard and prevents the regression behind reverse-proxy deployments.
Validation
I validated the fix with the existing targeted regression tests:
Command run:
Result:
This command covers: