Repository navigation
Conversation
Add an optional `protocol` ("http" | "https") field to `.superset/ports.json`
entries. When set to "https", the sidebar port-open action opens
https://localhost:PORT instead of http://, which fixes opening dev servers
that run behind a local TLS certificate (e.g. mkcert).
The field is resolved alongside `label` and travels the same query and
`port:changed` event paths to the renderer, then is consumed by both the v2
and v1 sidebar open actions. Omitting `protocol` is unchanged (defaults to
http), so the change is backward compatible.
Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
📝 WalkthroughWalkthroughStatic port configuration now supports optional HTTP/HTTPS protocols. Protocol values are validated, cached, exposed through host and desktop APIs, propagated through events and sidebar state, and used when opening local ports. ChangesProtocol-aware static ports
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Config as ports.json
participant Scanner as port-scanner
participant Host as host-service
participant Client as workspace-client
participant UI as port-opening UI
Config->>Scanner: Parse protocol
Scanner->>Host: Validated StaticPortLabel
Host->>Client: port:changed with protocol
Client->>UI: PortChangedPayload
UI->>UI: Build protocol://localhost:PORT
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Ready to review this PR? Stage has broken it down into 6 individual chapters for you: Chapters generated by Stage for commit 11b929c on Jul 27, 2026 7:36pm UTC. |
|
Thanks for the https-ports idea. #6330 lands the same ports.json protocol field against current main, so we're keeping that one. |
What
Adds an optional
protocolfield ("http"|"https") to each entry in aworkspace's
.superset/ports.json. When set to"https", the sidebar'sport-open action opens
https://localhost:PORTinstead ofhttp://.{ "ports": [ { "port": 3000, "label": "Frontend Dev Server", "protocol": "https" }, { "port": 8080, "label": "API Server" } ] }Why
Port open actions were hardcoded to
http://localhost:PORT(
usePortOpenActions.ts,MergedPortBadge.tsx). Dev servers running behind alocal TLS cert (e.g.
mkcert) 301/refuse onhttp://, so opening them fromthe sidebar lands on a broken page and you have to retype the URL with
https://. There was no config or preference to control the scheme.This rides the same rails the existing
labelfield already uses, so it'spurely additive and backward compatible — omit
protocoland behavior isunchanged (defaults to
http).How
protocolis resolved fromports.jsonalongsidelabeland travels the twoexisting paths that carry
labelto the renderer:parseStaticPortsConfig→ static-port label caches (desktopports.getAllenrichment →EnrichedPort/DashboardSidebarPort.port:changedbroadcast →workspace-clientPortChangedPayload→applyPortEventsToHostPortsResult.Both the v2 sidebar (
usePortOpenActions) and the v1 sidebar(
MergedPortBadge) then build the URL as`${port.protocol ?? "http"}://localhost:${port.port}`.The label caches'
Map<number, string>(port → label) becomesMap<number, StaticPortLabel>so the same lookup yields both label andprotocol.
Validation
parseStaticPortsConfigrejects anyprotocolthat isn't exactly"http"or"https"withports[N].protocol must be "http" or "https", consistent withthe existing per-field error messages. Malformed files are still ignored
wholesale (unchanged behavior).
Testing
bun run typecheckbun run lintbun run test— added cases:static-portsloader: loadshttps/http, omits when absent, rejects aninvalid protocol.
applyPortEventsToHostPortsResult: carriesprotocolfrom an add eventonto the port row.
Notes
protocolserialize and behave exactlyas before (
toEqualon existing loader fixtures is unchanged).apps/docs/content/docs/ports.mdx.it to one focused change per the contributing guide.
Summary by cubic
Add optional HTTPS support for sidebar port-open actions via a new
protocolfield in.superset/ports.json. Defaults to HTTP, so existing configs work unchanged.protocol("http" | "https") to.superset/ports.json; when set to "https", ports open athttps://localhost:PORT.protocolthrough label cache, hostport:changedevents, TRPC, and renderer; exposed onEnrichedPortandPortChangedPayload.usePortOpenActionsandMergedPortBadgeto useprotocol ?? "http".@superset/port-scanner; tests and docs updated.Written for commit 11b929c. Summary will update on new commits.
Summary by CodeRabbit
httporhttps.