Skip to content

Refactor desktop types + remove ipc channels#423

Merged
Kitenite merged 5 commits intomainfrom
gorgeous-silverfish-3a53bb
Dec 19, 2025
Merged

Refactor desktop types + remove ipc channels#423
Kitenite merged 5 commits intomainfrom
gorgeous-silverfish-3a53bb

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Dec 19, 2025

  • update .env.example and refactor types

Description

Related Issues

Type of Change

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

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

  • Chores

    • Reorganized shared type surface and simplified internal IPC surface; removed legacy deep-link polling hook and some typed IPC contracts (internal refactor may affect deep-link behavior).
  • Configuration

    • Added FREESTYLE_API_KEY to the example environment template.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 19, 2025

Walkthrough

Replaces a monolithic desktop types surface with several domain-specific type modules and an index re-export; removes the centralized IPC channel type surface and related deep-link/terminal/tab/proxy/ui/window channel files; switches preload IPC invoke to an untyped form; removes a deep-link polling hook; adds FREESTYLE_API_KEY to .env.example.

Changes

Cohort / File(s) Summary
New domain type modules
apps/desktop/src/shared/types/config.ts, apps/desktop/src/shared/types/database.ts, apps/desktop/src/shared/types/electron.ts, apps/desktop/src/shared/types/mosaic.ts, apps/desktop/src/shared/types/tab.ts, apps/desktop/src/shared/types/workspace.ts, apps/desktop/src/shared/types/worktree.ts
Adds domain-specific type declarations: SetupConfig, RecentProject, WindowProps (with route id/query), MosaicNode<T>, Tab, CreateTabInput, UpdatePreviewTabInput, Workspace, and Worktree.
Type index aggregation
apps/desktop/src/shared/types/index.ts
New centralized re-export surface: export * from the new type modules.
Monolith removed
apps/desktop/src/shared/types.ts
Deleted the previous single-file types export that contained all former type/interfaces.
IPC channel types removed (central + domain files)
apps/desktop/src/shared/ipc-channels/index.ts, apps/desktop/src/shared/ipc-channels/types.ts, apps/desktop/src/shared/ipc-channels/deep-link.ts, apps/desktop/src/shared/ipc-channels/external.ts, apps/desktop/src/shared/ipc-channels/proxy.ts, apps/desktop/src/shared/ipc-channels/tab.ts, apps/desktop/src/shared/ipc-channels/terminal.ts, apps/desktop/src/shared/ipc-channels/ui.ts, apps/desktop/src/shared/ipc-channels/window.ts, apps/desktop/src/shared/ipc-channels.ts
Removes centralized and per-domain IPC channel type definitions and helper types (IpcChannels, IpcRequest/IpcResponse helpers, NoRequest/NoResponse/SuccessResponse) and all channel interfaces (deep-link, proxy, tab, terminal, ui, window, external).
Preload IPC API simplified
apps/desktop/src/preload/index.ts
Replaces strongly-typed invoke signature with an untyped invoke: (channel: string, ...args: any[]) => ipcRenderer.invoke(channel, ...args) and removes typed IPC channel imports.
Deep-link hook removed
apps/desktop/src/renderer/hooks/useDeepLink.ts
Deleted the useDeepLink hook that polled window.ipcRenderer.invoke("deep-link-get-url") and invoked a handler on received URLs.
Env example updated
.env.example
Appended FREESTYLE_API_KEY= under the Freestyle section.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay attention to import updates where consumers previously referenced apps/desktop/src/shared/types.ts — ensure they now import from the new index or explicit modules.
  • Verify all IPC usages relying on typed channel names or helper types are updated to the untyped invoke or migrated to alternative (tRPC) patterns.
  • Review preload/index.ts changes for security/typing implications and ensure expected channels remain reachable.
  • Confirm removal of useDeepLink does not leave dangling calls or runtime expectations.

Possibly related PRs

Poem

🐰
I hopped and split the tangled vines,
Types now in tidy little lines.
Tabs and worktrees, leaves aligned—
A tiny key for Freestyle's signs.
Carrot cheers for code redesign 🌿

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is minimal and incomplete, with only a single-line summary provided and all required template sections left unfilled or marked with placeholders. Complete the description section explaining the refactoring rationale, fill in the Related Issues field if applicable, select a Type of Change checkbox (likely 'Refactor'), describe testing performed, and provide any additional context about breaking changes or migration guidance.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: refactoring desktop types and removing IPC channels, which aligns with the substantial structural changes throughout the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 gorgeous-silverfish-3a53bb

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4e34ad and 7b7fc9c.

📒 Files selected for processing (12)
  • apps/desktop/src/preload/index.ts (1 hunks)
  • apps/desktop/src/renderer/hooks/useDeepLink.ts (0 hunks)
  • apps/desktop/src/shared/ipc-channels.ts (0 hunks)
  • apps/desktop/src/shared/ipc-channels/deep-link.ts (0 hunks)
  • apps/desktop/src/shared/ipc-channels/external.ts (0 hunks)
  • apps/desktop/src/shared/ipc-channels/index.ts (0 hunks)
  • apps/desktop/src/shared/ipc-channels/proxy.ts (0 hunks)
  • apps/desktop/src/shared/ipc-channels/tab.ts (0 hunks)
  • apps/desktop/src/shared/ipc-channels/terminal.ts (0 hunks)
  • apps/desktop/src/shared/ipc-channels/types.ts (0 hunks)
  • apps/desktop/src/shared/ipc-channels/ui.ts (0 hunks)
  • apps/desktop/src/shared/ipc-channels/window.ts (0 hunks)
💤 Files with no reviewable changes (11)
  • apps/desktop/src/shared/ipc-channels/tab.ts
  • apps/desktop/src/shared/ipc-channels/deep-link.ts
  • apps/desktop/src/shared/ipc-channels/external.ts
  • apps/desktop/src/shared/ipc-channels/index.ts
  • apps/desktop/src/shared/ipc-channels/window.ts
  • apps/desktop/src/shared/ipc-channels/ui.ts
  • apps/desktop/src/shared/ipc-channels/terminal.ts
  • apps/desktop/src/shared/ipc-channels/proxy.ts
  • apps/desktop/src/shared/ipc-channels.ts
  • apps/desktop/src/shared/ipc-channels/types.ts
  • apps/desktop/src/renderer/hooks/useDeepLink.ts
🧰 Additional context used
📓 Path-based instructions (4)
apps/desktop/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx,js,jsx}: For Electron interprocess communication, ALWAYS use trpc as defined in src/lib/trpc
Use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary.

Files:

  • apps/desktop/src/preload/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Avoid using any type in TypeScript - maintain type safety unless absolutely necessary

Files:

  • apps/desktop/src/preload/index.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Run Biome for formatting, linting, import organization, and safe fixes at the root level using bun run lint:fix

Files:

  • apps/desktop/src/preload/index.ts
apps/desktop/src/{main,renderer,preload}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use type-safe IPC communication - define channel types in apps/desktop/src/shared/ipc-channels.ts before implementing handlers

Files:

  • apps/desktop/src/preload/index.ts
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T23:19:10.405Z
Learning: Applies to apps/desktop/src/{main,renderer,preload}/**/*.{ts,tsx} : Use type-safe IPC communication - define channel types in apps/desktop/src/shared/ipc-channels.ts before implementing handlers
📚 Learning: 2025-12-18T23:19:10.405Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T23:19:10.405Z
Learning: Applies to apps/desktop/src/{main,renderer,preload}/**/*.{ts,tsx} : Use type-safe IPC communication - define channel types in apps/desktop/src/shared/ipc-channels.ts before implementing handlers

Applied to files:

  • apps/desktop/src/preload/index.ts
📚 Learning: 2025-12-18T23:19:10.405Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T23:19:10.405Z
Learning: Applies to apps/desktop/src/main/**/*.ts : Accept object parameters in IPC handlers - do not use positional parameters in ipcMain.handle()

Applied to files:

  • apps/desktop/src/preload/index.ts
📚 Learning: 2025-12-18T17:26:38.664Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-12-18T17:26:38.664Z
Learning: Applies to apps/desktop/**/*.{ts,tsx,js,jsx} : For Electron interprocess communication, ALWAYS use trpc as defined in `src/lib/trpc`

Applied to files:

  • apps/desktop/src/preload/index.ts
📚 Learning: 2025-12-18T23:19:10.405Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T23:19:10.405Z
Learning: Applies to apps/desktop/src/renderer/**/*.{ts,tsx} : Never import Node.js modules in renderer process or shared code - use only in main process (src/main/)

Applied to files:

  • apps/desktop/src/preload/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Deploy Web
  • GitHub Check: Deploy Admin
  • GitHub Check: Deploy Docs
  • GitHub Check: Deploy API
  • GitHub Check: Build
🔇 Additional comments (2)
apps/desktop/src/preload/index.ts (2)

28-30: [rewritten review comment]
[classification tag]


24-26: Clarify the purpose of the exposed ipcRendererAPI or remove it to enforce type-safe IPC constraints.

The documentation correctly states that tRPC is the primary IPC communication method. However, the exposed ipcRendererAPI (lines 27-54) provides untyped, unconstrained access to direct Electron IPC methods that contradicts the guideline: "ALWAYS use tRPC." No direct IPC usage exists in the codebase currently, but exposing this API with any types and the vague justification "for low-level IPC needs" creates an escape hatch that violates type-safety standards. Either:

  • Remove the unused ipcRendererAPI exposure and rely exclusively on tRPC as the guidelines mandate, or
  • Explicitly document when and why direct IPC is permitted (e.g., admin/debug scenarios) and update coding guidelines accordingly.

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 Dec 19, 2025

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) View Branch
Vercel API (Vercel) Open Preview
Vercel Web (Vercel) Open Preview
Vercel Marketing (Vercel) Open Preview
Vercel Admin (Vercel) Open Preview
Vercel Docs (Vercel) Open Preview

Preview updates automatically with new commits

@Kitenite Kitenite changed the title Refactor desktop types Refactor desktop types + remove ipc channels Dec 19, 2025
@Kitenite Kitenite merged commit 7b82266 into main Dec 19, 2025
10 of 11 checks passed
@Kitenite Kitenite deleted the gorgeous-silverfish-3a53bb branch December 19, 2025 00:20
@coderabbitai coderabbitai Bot mentioned this pull request Jan 19, 2026
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