Skip to content

feat(desktop): generate ports.json in setup and fix static ports watcher#1479

Merged
Kitenite merged 2 commits into
mainfrom
kitenite/port-map-naming
Feb 14, 2026
Merged

feat(desktop): generate ports.json in setup and fix static ports watcher#1479
Kitenite merged 2 commits into
mainfrom
kitenite/port-map-naming

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Feb 14, 2026

Setup script now generates .superset/ports.json with human-readable labels for all allocated ports. Also fixes the static ports subscription which was passing an empty workspaceId, causing the file watcher to never start.

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

Release Notes

  • New Features
    • Added real-time synchronization of port information across all workspaces
    • Implemented centralized port monitoring and configuration system for improved reliability

Setup script now generates .superset/ports.json with human-readable labels
for all allocated ports. Also fixes the static ports subscription which
was passing an empty workspaceId, causing the file watcher to never start.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 14, 2026

📝 Walkthrough

Walkthrough

This pull request adds port management functionality by introducing a ports.json generation mechanism in the setup script, adding a global subscription endpoint for port changes across all workspaces in the TRPC router, and updating the frontend hook to use this new global subscription instead of per-workspace subscriptions.

Changes

Cohort / File(s) Summary
Port Configuration Generation
.superset/setup.sh
Adds logic to generate .superset/ports.json mapping multiple service ports (Web, API, Marketing, Admin, Docs, etc.) to their numbers with human-readable labels when SUPERSET_PORT_BASE is set.
TRPC Router Enhancement
apps/desktop/src/lib/trpc/routers/ports/ports.ts
Introduces subscribeAllStatic subscription endpoint that manages watchers for all workspaces, initializes static port watchers, and emits workspace change events with cleanup on unsubscribe.
Frontend Subscription Update
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/PortsList/hooks/usePortsData.ts
Shifts subscription scope from per-workspace to global by updating subscription call to use undefined instead of specific workspaceId, maintaining the same invalidation side effect.

Sequence Diagram

sequenceDiagram
    participant Client as Renderer Hook
    participant Server as TRPC Router
    participant Watchers as Workspace Watchers

    Client->>Server: Subscribe to subscribeAllStatic
    Server->>Watchers: Initialize watchers for all workspaces
    Watchers-->>Server: Ready
    Server-->>Client: Subscription active
    
    Note over Watchers: Monitor workspace port changes
    Watchers->>Server: Port change detected
    Server->>Client: Emit {type: "change", workspaceId}
    Client->>Client: Invalidate getAllStatic cache
    
    Client->>Server: Unsubscribe
    Server->>Watchers: Unwatch all workspaces
    Watchers-->>Server: Cleanup complete
    Server-->>Client: Subscription closed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hop-hip-hooray for ports so grand!
A JSON map across the land,
Subscriptions flow from all around,
Global watchers, tightly bound!

🚥 Pre-merge checks | ✅ 1 | ❌ 3
❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (24 files):

⚔️ .superset/setup.sh (content)
⚔️ apps/api/src/app/api/github/install/route.ts (content)
⚔️ apps/api/src/app/api/integrations/linear/connect/route.ts (content)
⚔️ apps/api/src/app/api/integrations/slack/connect/route.ts (content)
⚔️ apps/api/src/app/api/integrations/slack/events/process-app-home-opened/process-app-home-opened.ts (content)
⚔️ apps/api/src/app/api/integrations/slack/events/process-assistant-message/process-assistant-message.ts (content)
⚔️ apps/api/src/app/api/integrations/slack/events/process-mention/process-mention.ts (content)
⚔️ apps/api/src/app/api/integrations/slack/events/utils/run-agent/run-agent.ts (content)
⚔️ apps/api/src/app/api/integrations/slack/link/route.ts (content)
⚔️ apps/desktop/src/lib/trpc/routers/ports/ports.ts (content)
⚔️ apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/PortsList/hooks/usePortsData.ts (content)
⚔️ apps/marketing/src/lib/blog-utils.ts (content)
⚔️ apps/marketing/src/lib/blog.ts (content)
⚔️ apps/marketing/src/lib/changelog-utils.ts (content)
⚔️ apps/marketing/src/lib/changelog.ts (content)
⚔️ apps/marketing/src/lib/compare-utils.ts (content)
⚔️ apps/marketing/src/lib/compare.ts (content)
⚔️ apps/web/src/app/(dashboard)/settings/billing/page.tsx (content)
⚔️ bun.lock (content)
⚔️ packages/db/drizzle/meta/_journal.json (content)
⚔️ packages/db/src/utils/index.ts (content)
⚔️ packages/trpc/src/router/integration/utils.ts (content)
⚔️ packages/trpc/src/router/organization/organization.ts (content)
⚔️ packages/trpc/src/router/user/user.ts (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
Description check ❓ Inconclusive The description covers the main changes but lacks specifics in Type of Change, Testing, and Related Issues sections required by the template. Select appropriate Type of Change option(s), describe testing steps performed, and link any related GitHub issues using keywords like 'closes' or 'fixes'.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes both main changes: generating ports.json in setup and fixing the static ports watcher issue.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/port-map-naming
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch kitenite/port-map-naming
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
apps/desktop/src/lib/trpc/routers/ports/ports.ts (1)

192-201: Workspace list is snapshotted at subscription time — newly added workspaces won't be watched.

If a workspace is created after this subscription starts, its ports.json changes won't trigger events until the client re-subscribes. This is likely acceptable for the current use case, but worth noting if workspaces are frequently added/removed during a session. A future enhancement could listen for workspace add/remove events and dynamically update the watch set.


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

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 14, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ⚠️ Electric Fly.io app
  • ⚠️ Streams Fly.io app

Thank you for your contribution! 🎉

@Kitenite Kitenite merged commit 34b93ec into main Feb 14, 2026
14 of 15 checks passed
@Kitenite Kitenite deleted the kitenite/port-map-naming branch February 27, 2026 09:29
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.

1 participant