WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@p-delorme
Copy link
Contributor

@p-delorme p-delorme commented Oct 14, 2025

Summary by CodeRabbit

  • New Features

    • Organization support throughout recording and export flows: selectable organization in UI, org-aware recording startup, and org-scoped uploads.
    • Desktop app now fetches and surfaces available organizations (used to prefill selectors and export choices).
  • Chores

    • Broadened Node.js engine requirements to >=20 across packages.
    • Added a new building icon to the UI icon set.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

Adds organization support end-to-end: new Organization type and GET /organizations API, fetch/populate organizations in AuthStore, propagate organization_id through recording, upload, and export flows, add UI selectors and state, and relax Node engine constraints across manifests.

Changes

Cohort / File(s) Summary
API & Auth (Rust)
apps/desktop/src-tauri/src/api.rs, apps/desktop/src-tauri/src/auth.rs
Add public Organization struct and fetch_organizations() API client; extend AuthStore with organizations: Vec<Organization> and populate it during auth plan update.
Upload plumbing (Rust)
apps/desktop/src-tauri/src/upload.rs, apps/desktop/src-tauri/src/lib.rs, apps/desktop/src-tauri/src/api.rs
Add organization_id: Option<String> parameter to create_or_get_video / upload_exported_video call chain; conditionally append &orgId= to server requests; forward organization_id through upload flows.
Recording inputs & settings (Rust)
apps/desktop/src-tauri/src/recording.rs, apps/desktop/src-tauri/src/recording_settings.rs, apps/desktop/src-tauri/src/deeplink_actions.rs
Add organization_id: Option<String> to StartRecordingInputs and RecordingSettingsStore; deeplink and recording start now include organization_id.
Frontend TAURI types & utils (TS)
apps/desktop/src/utils/tauri.ts, apps/desktop/src/utils/queries.ts
Add Organization TS type; extend AuthStore, RecordingSettingsStore, and StartRecordingInputs types with organization fields; add createOrganizationsQuery() and propagate organizationId in options/state.
Frontend UI: Export & Target selection
apps/desktop/src/routes/editor/ExportDialog.tsx, apps/desktop/src/routes/target-select-overlay.tsx, apps/desktop/src/routes/editor/ShareButton.tsx, apps/desktop/src/routes/recordings-overlay.tsx
Introduce organization selector UI (Menu/CheckMenuItem), wire createOrganizationsQuery, thread organizationId into export/upload calls, and add null trailing arg at several upload call sites.
Frontend lifecycle
apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
Call commands.updateAuthPlan() on Page onMount to fetch orgs.
Web API endpoint (server)
apps/web/app/api/desktop/[...route]/root.ts
Add authenticated GET /organizations route returning organizations the user owns/belongs to via a left join query.
Build manifests
package.json, apps/web/package.json, packages/database/package.json, packages/local-docker/package.json, packages/ui/package.json, packages/utils/package.json
Relax engines.node constraints to ">=20" where present.
UI assets/types
packages/ui-solid/src/auto-imports.d.ts
Add global auto-import declaration for IconLucideBuilding2.
Misc small changes
apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx
Add extra null arg to Channel constructor call for UploadProgress.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Desktop as Desktop App (UI)
    participant Ta as Tauri Core
    participant API as Backend API
    participant Auth as AuthStore

    User->>Desktop: Open app / onMount
    Desktop->>Ta: commands.updateAuthPlan()
    Ta->>API: GET /api/desktop/organizations (authed)
    API-->>Ta: [Organization[]]
    Ta->>Auth: update AuthStore.organizations

    User->>Desktop: Select organization in UI
    Desktop->>Ta: write RecordingSettingsStore.organizationId

    User->>Desktop: Start recording
    Desktop->>Ta: start_recording(StartRecordingInputs{..., organization_id})
    Ta->>Ta: create_or_get_video(..., organization_id)
    Ta->>API: POST create_or_get_video?orgId=...
    API-->>Ta: S3UploadMeta
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~70 minutes

  • Extra attention:
    • Ensure organization list fetch and auth-plan update are correctly synchronized and retried/fallbacked when empty.
    • Verify all call sites forwarded the new organization_id/organizationId consistently (Rust ↔ TS boundary and upload/create paths).
    • Confirm server /organizations query correctness and authorization semantics.
    • UI state: verify selector fallback to first org and persistence in RecordingSettingsStore.

Possibly related PRs

Poem

🐰
I hopped through code with careful paws,
Added orgs, endpoints, and UI laws,
A menu here, a field there — hooray! 🏢
Record and upload now know the way,
I nibble bugs and hop away.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Implement org selection" accurately captures the primary objective of this changeset. The PR introduces comprehensive organization selection functionality across the codebase, including: adding an Organization struct and fetch_organizations API, implementing organization-selection UI components in ExportDialog and target-select-overlay, adding a new /organizations backend endpoint, and threading organization_id through the recording and upload flows. The title is concise, specific, and clearly communicates the main feature without vague terminology. While the changeset includes some secondary updates (Node engine version constraints, icon additions), the core feature and focus are accurately reflected in the title.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ce878b and 5f63f67.

📒 Files selected for processing (3)
  • apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx (1 hunks)
  • apps/desktop/src/routes/editor/ShareButton.tsx (1 hunks)
  • apps/desktop/src/routes/recordings-overlay.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Files:

  • apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx
  • apps/desktop/src/routes/recordings-overlay.tsx
  • apps/desktop/src/routes/editor/ShareButton.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx
  • apps/desktop/src/routes/recordings-overlay.tsx
  • apps/desktop/src/routes/editor/ShareButton.tsx
⏰ 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). (3)
  • GitHub Check: Clippy
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
🔇 Additional comments (2)
apps/desktop/src/routes/recordings-overlay.tsx (1)

773-778: Verify if organizationId should be retrieved from authStore.

Similar to ShareButton.tsx, this upload call passes null for organizationId. Since this PR implements organization selection and authStore is imported and used in this file (line 709), verify whether the selected organization should be propagated here instead of passing null.

The verification script from the previous file's review will also check this usage pattern.

apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx (1)

349-354: Verify the intent of the hardcoded null for organization context.

The function signature requires an organizationId parameter, and adding null is technically correct. However, this reveals a design question:

The recordings.tsx component (a settings page) has no organization state or selection UI, unlike ExportDialog.tsx which properly uses settings.organizationId ?? null. ShareButton.tsx has the same gap. This suggests either:

  1. Intentional: Reuploads from these components should not be organization-associated
  2. Incomplete: These components need organization context/UI added to match the PR's organization support rollout

Please clarify whether the null values in recordings.tsx and ShareButton.tsx are intentional, or whether these components should be enhanced to access and pass the selected organization ID (similar to ExportDialog.tsx).


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.

Refactors organization selection to improve efficiency and UX:
@p-delorme p-delorme marked this pull request as ready for review October 14, 2025 02:22
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (7)
apps/desktop/src/routes/(window-chrome)/new-main/index.tsx (2)

438-442: Remove inline comment, avoid swallow, and don’t block mount while refreshing orgs

  • Inline comment violates repo guideline.
  • Swallowing errors hides failures.
  • Awaiting the refresh can delay mount unnecessarily.

Refactor to fire-and-forget with a debug log:

-		// Refresh organizations when main window loads
-		try {
-			await commands.refreshOrganizations();
-		} catch {}
+		void commands
+			.refreshOrganizations()
+			.catch((error) => console.debug("refreshOrganizations failed", error));

As per coding guidelines


57-61: Manual icon imports in desktop app — rely on auto‑imported icons

Per desktop guidelines, don’t manually import icons; the codebase already auto-imports others (e.g., IconCapSettings). Remove these imports and rely on auto-import.

-import IconLucideAppWindowMac from "~icons/lucide/app-window-mac";
-import IconLucideArrowLeft from "~icons/lucide/arrow-left";
-import IconLucideSearch from "~icons/lucide/search";
-import IconMaterialSymbolsScreenshotFrame2Rounded from "~icons/material-symbols/screenshot-frame-2-rounded";
-import IconMdiMonitor from "~icons/mdi/monitor";

As per coding guidelines

apps/desktop/src-tauri/src/deeplink_actions.rs (1)

139-140: LGTM: initialize new optional organization_id

Setting organization_id: None keeps current deeplink behavior stable.

If a user-selected organization is stored in RecordingSettingsStore, consider defaulting to that here to preserve context during deeplink-initiated recordings.

apps/desktop/src/utils/queries.ts (1)

248-253: Remove inline comments per codebase guideline

Inline comments are disallowed in TS/TSX. Please remove the comment within createOrganizationsQuery.

Apply this diff:

-  // Refresh organizations if they're missing
   createEffect(() => {
     if (auth.data?.user_id && (!auth.data?.organizations || auth.data.organizations.length === 0)) {
       commands.refreshOrganizations().catch(console.error);
     }
   });

As per coding guidelines

apps/desktop/src-tauri/src/auth.rs (1)

110-134: Prefer structured logging over println

Consider using tracing (info!/error!) for consistent logging and filtering across the app.

apps/desktop/src/routes/editor/ExportDialog.tsx (1)

83-95: Remove inline comments in TSX per project guideline

Inline comments are disallowed in TS/TSX. Please remove JSX comments across the changed blocks.

As per coding guidelines

Also applies to: 433-446, 468-477, 495-499, 507-532, 533-616, 625-683, 745-825, 842-864, 973-1011

apps/desktop/src/routes/target-select-overlay.tsx (1)

764-816: Prefer an accessible Select from Kobalte or @cap/ui-solid over a custom dropdown.

Custom dropdowns often miss keyboard nav, focus management, ARIA, and type-ahead. Replace CustomSelect with a Kobalte <Select> (or your UI kit’s Select) for a11y and consistency.

If you want, I can draft the Kobalte Select snippet wired to rawOptions.organizationId.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55ff581 and f83f299.

📒 Files selected for processing (22)
  • apps/desktop/src-tauri/src/auth.rs (2 hunks)
  • apps/desktop/src-tauri/src/deeplink_actions.rs (1 hunks)
  • apps/desktop/src-tauri/src/lib.rs (10 hunks)
  • apps/desktop/src-tauri/src/recording.rs (2 hunks)
  • apps/desktop/src-tauri/src/recording_settings.rs (1 hunks)
  • apps/desktop/src-tauri/src/upload.rs (3 hunks)
  • apps/desktop/src-tauri/src/upload_legacy.rs (4 hunks)
  • apps/desktop/src/routes/(window-chrome)/new-main/index.tsx (1 hunks)
  • apps/desktop/src/routes/editor/ExportDialog.tsx (12 hunks)
  • apps/desktop/src/routes/target-select-overlay.tsx (9 hunks)
  • apps/desktop/src/utils/queries.ts (4 hunks)
  • apps/desktop/src/utils/tauri.ts (7 hunks)
  • apps/tasks/package.json (1 hunks)
  • apps/web/app/api/desktop/[...route]/root.ts (2 hunks)
  • apps/web/package.json (1 hunks)
  • package.json (1 hunks)
  • packages/database/package.json (2 hunks)
  • packages/local-docker/package.json (1 hunks)
  • packages/ui-solid/src/auto-imports.d.ts (1 hunks)
  • packages/ui/package.json (1 hunks)
  • packages/utils/package.json (1 hunks)
  • packages/web-api-contract/src/desktop.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{ts,tsx,js,jsx,rs}

📄 CodeRabbit inference engine (CLAUDE.md)

Do not add inline, block, or docstring comments in any language; code must be self-explanatory

Files:

  • apps/desktop/src-tauri/src/recording_settings.rs
  • apps/desktop/src-tauri/src/recording.rs
  • apps/desktop/src-tauri/src/deeplink_actions.rs
  • packages/ui-solid/src/auto-imports.d.ts
  • apps/desktop/src/utils/queries.ts
  • packages/web-api-contract/src/desktop.ts
  • apps/desktop/src-tauri/src/upload.rs
  • apps/web/app/api/desktop/[...route]/root.ts
  • apps/desktop/src-tauri/src/upload_legacy.rs
  • apps/desktop/src/routes/target-select-overlay.tsx
  • apps/desktop/src-tauri/src/auth.rs
  • apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
  • apps/desktop/src/routes/editor/ExportDialog.tsx
  • apps/desktop/src/utils/tauri.ts
  • apps/desktop/src-tauri/src/lib.rs
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Format Rust code using rustfmt and ensure all Rust code passes workspace-level clippy lints.
Rust modules should be named with snake_case, and crate directories should be in kebab-case.

Files:

  • apps/desktop/src-tauri/src/recording_settings.rs
  • apps/desktop/src-tauri/src/recording.rs
  • apps/desktop/src-tauri/src/deeplink_actions.rs
  • apps/desktop/src-tauri/src/upload.rs
  • apps/desktop/src-tauri/src/upload_legacy.rs
  • apps/desktop/src-tauri/src/auth.rs
  • apps/desktop/src-tauri/src/lib.rs
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use strict TypeScript and avoid any; leverage shared types from packages

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Files:

  • packages/ui-solid/src/auto-imports.d.ts
  • apps/desktop/src/utils/queries.ts
  • packages/web-api-contract/src/desktop.ts
  • apps/web/app/api/desktop/[...route]/root.ts
  • apps/desktop/src/routes/target-select-overlay.tsx
  • apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
  • apps/desktop/src/routes/editor/ExportDialog.tsx
  • apps/desktop/src/utils/tauri.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • packages/ui-solid/src/auto-imports.d.ts
  • apps/desktop/src/utils/queries.ts
  • packages/web-api-contract/src/desktop.ts
  • apps/web/app/api/desktop/[...route]/root.ts
  • apps/desktop/src/routes/target-select-overlay.tsx
  • apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
  • apps/desktop/src/routes/editor/ExportDialog.tsx
  • apps/desktop/src/utils/tauri.ts
**/queries.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Never edit auto-generated query bindings file queries.ts

Do not edit auto-generated files named queries.ts.

Files:

  • apps/desktop/src/utils/queries.ts
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/desktop/**/*.{ts,tsx}: Do not manually import icons in the desktop app; rely on auto-imported icons
In the desktop app, use @tanstack/solid-query for server state management

Files:

  • apps/desktop/src/utils/queries.ts
  • apps/desktop/src/routes/target-select-overlay.tsx
  • apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
  • apps/desktop/src/routes/editor/ExportDialog.tsx
  • apps/desktop/src/utils/tauri.ts
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/web/**/*.{ts,tsx}: Use TanStack Query v5 for all client-side server state and data fetching in the web app
Web mutations should call Server Actions directly and perform targeted cache updates with setQueryData/setQueriesData rather than broad invalidations
Client code should use useEffectQuery/useEffectMutation and useRpcClient from apps/web/lib/EffectRuntime.ts; do not create ManagedRuntime inside components

Files:

  • apps/web/app/api/desktop/[...route]/root.ts
apps/web/app/**/*.{tsx,ts}

📄 CodeRabbit inference engine (CLAUDE.md)

Prefer Server Components for initial data in the Next.js App Router and pass initialData to client components

Files:

  • apps/web/app/api/desktop/[...route]/root.ts
apps/web/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

On the client, always use useEffectQuery or useEffectMutation from @/lib/EffectRuntime; never call EffectRuntime.run* directly in components.

Files:

  • apps/web/app/api/desktop/[...route]/root.ts
**/tauri.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Never edit auto-generated IPC bindings file tauri.ts

Do not edit auto-generated files named tauri.ts.

Files:

  • apps/desktop/src/utils/tauri.ts
🧬 Code graph analysis (8)
apps/desktop/src/utils/queries.ts (1)
apps/desktop/src/store.ts (1)
  • authStore (59-59)
apps/desktop/src-tauri/src/upload.rs (1)
apps/desktop/src-tauri/src/upload_legacy.rs (1)
  • create_or_get_video (382-449)
apps/web/app/api/desktop/[...route]/root.ts (2)
packages/database/index.ts (1)
  • db (30-37)
packages/database/schema.ts (2)
  • organizations (163-195)
  • organizationMembers (198-220)
apps/desktop/src-tauri/src/upload_legacy.rs (1)
apps/desktop/src-tauri/src/upload.rs (1)
  • create_or_get_video (220-282)
apps/desktop/src/routes/target-select-overlay.tsx (3)
packages/database/schema.ts (1)
  • organizations (163-195)
apps/desktop/src/utils/queries.ts (1)
  • createOrganizationsQuery (245-256)
apps/desktop/src/utils/tauri.ts (2)
  • Organization (436-436)
  • commands (7-290)
apps/desktop/src-tauri/src/auth.rs (1)
apps/desktop/src/utils/tauri.ts (1)
  • Organization (436-436)
apps/desktop/src/routes/editor/ExportDialog.tsx (3)
apps/desktop/src/utils/queries.ts (1)
  • createOrganizationsQuery (245-256)
apps/desktop/src/routes/editor/ui.tsx (4)
  • MenuItem (264-279)
  • PopperContent (287-293)
  • topSlideAnimateClasses (432-433)
  • MenuItemList (295-309)
apps/desktop/src/routes/editor/Header.tsx (1)
  • RESOLUTION_OPTIONS (34-38)
apps/desktop/src-tauri/src/lib.rs (2)
apps/desktop/src/utils/tauri.ts (1)
  • AuthStore (358-358)
apps/desktop/src-tauri/src/auth.rs (1)
  • update_auth_plan (64-138)
⏰ 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). (2)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
🔇 Additional comments (22)
packages/ui-solid/src/auto-imports.d.ts (1)

68-68: LGTM! Auto-generated icon declaration is correctly formatted.

The new IconLucideBuilding2 declaration follows the established pattern and is appropriately placed alphabetically among other Lucide icons. This building icon aligns well with the PR's organization selection feature.

apps/tasks/package.json (1)

43-45: LGTM!

The Node.js engine constraint update from exact version "20" to minimum version ">=20" aligns with the repository-wide standardization and provides better flexibility for deployments.

packages/local-docker/package.json (1)

12-14: LGTM!

Consistent with the repository-wide Node.js engine constraint update.

packages/utils/package.json (1)

29-31: LGTM!

Node.js engine constraint properly updated to match repository standards.

packages/ui/package.json (1)

57-59: LGTM!

Engine constraint updated consistently with other packages.

package.json (1)

39-41: LGTM!

The Node.js engine constraint harmonizes the root package with the rest of the repository by standardizing on a minimum of Node 20. While this loosens the previous requirement of Node 24, it aligns with the repository-wide convention and provides deployment flexibility.

apps/web/package.json (1)

153-155: LGTM!

Node.js engine constraint updated consistently with the repository-wide standardization.

packages/database/package.json (1)

54-56: LGTM!

Engine constraint properly updated to match repository standards.

apps/desktop/src-tauri/src/recording.rs (2)

240-241: LGTM!

The organization_id field addition follows Rust best practices: marked as Option<String> for optional organization context, with #[serde(default)] for backward compatibility during deserialization.


318-318: LGTM!

The organization_id is properly propagated to create_or_get_video using .clone(), which is appropriate since the inputs struct may be used elsewhere.

apps/desktop/src-tauri/src/recording_settings.rs (1)

24-25: LGTM: organization_id added to settings store

Optional field is backward compatible; camelCase serde rename maintains TS interop as organizationId.

packages/web-api-contract/src/desktop.ts (1)

143-156: LGTM: add protected GET /desktop/organizations

Route shape and types look good.

Run to cross‑check backend route alignment and selected fields:

apps/desktop/src/utils/queries.ts (1)

124-133: Org ID threading into options looks good

Adding organizationId to persisted options and propagating it into recordingSettingsStore is correct and aligns with the new flows.

Also applies to: 139-147

apps/desktop/src-tauri/src/upload_legacy.rs (1)

218-220: Legacy uploader: orgId is correctly plumbed

  • Signature extended with organization_id and appended as &orgId=... when provided.
  • Call sites updated to pass None to preserve prior behavior.
    Looks good.

Also applies to: 333-335, 381-414

apps/desktop/src-tauri/src/auth.rs (1)

17-27: Organizations support in AuthStore is well integrated

  • Organization struct and serde rename match TS type (ownerId).
  • #[serde(default)] on organizations avoids deserialization breaks.
  • Fetching and storing organizations in update_auth_plan is sound and non-blocking.

Please confirm the web endpoint /api/desktop/organizations returns ownerId in camelCase to match the serde rename. Based on learnings

Also applies to: 110-134

apps/desktop/src-tauri/src/upload.rs (1)

198-199: Uploader: orgId threaded into create_or_get_video

The new organization_id parameter and query-string propagation are correct. Call sites preserved behavior by passing None where not applicable.

Also applies to: 226-252

apps/desktop/src/utils/tauri.ts (1)

128-130: Generated IPC bindings match intended API

  • uploadExportedVideo now accepts organizationId.
  • logMessage and refreshOrganizations commands exposed.
  • Types extended: Organization, AuthStore.organizations, RecordingSettingsStore.organizationId, StartRecordingInputs.organization_id.
    Looks consistent with backend changes.

Regenerate bindings to ensure this file remains purely generated:

  • cargo build (tauri-specta) + specta generate step
  • pnpm typegen (if applicable)

Do not manually edit this file. As per coding guidelines

Also applies to: 176-178, 197-199, 358-359, 436-437, 453-454, 473-474

apps/desktop/src/routes/editor/ExportDialog.tsx (1)

421-431: Button variant change is fine

Using the blue variant for the primary confirm action aligns with the new visual language.

apps/desktop/src/routes/target-select-overlay.tsx (1)

237-238: Avoid empty string fallbacks for DisplayId/Screen.

Passing "" as a DisplayId/Screen risks invalid IDs reaching Tauri. If the route always guarantees a displayId, prefer a non-null assertion or gate rendering until it exists. Otherwise, disable Start until valid.

  • Option A: id: params.displayId! and screen: params.displayId! (if guaranteed)
  • Option B: Show controls only when params.displayId is defined.

Please verify route guarantees and adjust.

Also applies to: 740-744

apps/desktop/src-tauri/src/lib.rs (3)

1892-1897: refresh_organizations command LGTM.

Thin wrapper around AuthStore::update_auth_plan is fine; emits tracing info.


2680-2689: log_message command LGTM and correctly exported.

Command maps level→tracing macros and is added to the registry.

Also applies to: 1975-1976


1066-1114: Confirmed TS wrapper and all commands.uploadExportedVideo calls include the new organizationId parameter.

@Brendonovich Brendonovich force-pushed the implement-org-selection branch from eeac93f to d1d6a4a Compare October 31, 2025 09:04
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
apps/desktop/src/routes/editor/ExportDialog.tsx (1)

150-169: Don’t silently force an organization selection

The new getter forces settings.organizationId to the first org whenever the persisted value is null, and the picker menu only lists orgs. That removes the ability to share to “Personal” (null org) and overrides an explicit choice to stay org-less—the exact regression we just fixed earlier in the review thread. Please keep the persisted null and offer a Personal entry in the menu so users can opt out.

 Object.defineProperty(ret, "organizationId", {
-  get() {
-    if (!_settings.organizationId && organisations().length > 0)
-      return organisations()[0].id;
-
-    return _settings.organizationId;
-  },
+  get() {
+    return _settings.organizationId ?? null;
+  },
 });
 …
 const menu = await Menu.new({
-  items: await Promise.all(
-    organisations().map((org) =>
-      CheckMenuItem.new({
-        text: org.name,
-        action: () => {
-          setSettings("organizationId", org.id);
-        },
-        checked: settings.organizationId === org.id,
-      }),
-    ),
-  ),
+  items: await Promise.all([
+    CheckMenuItem.new({
+      text: "Personal",
+      action: () => setSettings("organizationId", null),
+      checked: settings.organizationId == null,
+    }),
+    ...organisations().map((org) =>
+      CheckMenuItem.new({
+        text: org.name,
+        action: () => setSettings("organizationId", org.id),
+        checked: settings.organizationId === org.id,
+      }),
+    ),
+  ]),
 });
 …
-          (
-            organisations().find(
-              (o) => o.id === settings.organizationId,
-            ) ?? organisations()[0]
-          )?.name
+          (
+            organisations().find((o) => o.id === settings.organizationId)
+          )?.name ?? "Personal"

Also applies to: 539-566

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eeac93f and 0ce878b.

📒 Files selected for processing (20)
  • apps/desktop/src-tauri/src/api.rs (3 hunks)
  • apps/desktop/src-tauri/src/auth.rs (2 hunks)
  • apps/desktop/src-tauri/src/deeplink_actions.rs (1 hunks)
  • apps/desktop/src-tauri/src/lib.rs (5 hunks)
  • apps/desktop/src-tauri/src/recording.rs (2 hunks)
  • apps/desktop/src-tauri/src/recording_settings.rs (1 hunks)
  • apps/desktop/src-tauri/src/upload.rs (3 hunks)
  • apps/desktop/src/routes/(window-chrome)/new-main/index.tsx (1 hunks)
  • apps/desktop/src/routes/editor/ExportDialog.tsx (9 hunks)
  • apps/desktop/src/routes/target-select-overlay.tsx (14 hunks)
  • apps/desktop/src/utils/queries.ts (4 hunks)
  • apps/desktop/src/utils/tauri.ts (5 hunks)
  • apps/web/app/api/desktop/[...route]/root.ts (2 hunks)
  • apps/web/package.json (1 hunks)
  • package.json (1 hunks)
  • packages/database/package.json (1 hunks)
  • packages/local-docker/package.json (1 hunks)
  • packages/ui-solid/src/auto-imports.d.ts (1 hunks)
  • packages/ui/package.json (1 hunks)
  • packages/utils/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
  • apps/web/package.json
  • apps/desktop/src-tauri/src/recording.rs
  • apps/desktop/src-tauri/src/auth.rs
  • apps/web/app/api/desktop/[...route]/root.ts
  • apps/desktop/src-tauri/src/deeplink_actions.rs
  • package.json
  • packages/ui/package.json
  • apps/desktop/src-tauri/src/upload.rs
  • packages/ui-solid/src/auto-imports.d.ts
  • apps/desktop/src-tauri/src/lib.rs
  • apps/desktop/src/routes/target-select-overlay.tsx
  • packages/utils/package.json
  • apps/desktop/src-tauri/src/recording_settings.rs
🧰 Additional context used
📓 Path-based instructions (5)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Format Rust code using rustfmt and ensure all Rust code passes workspace-level clippy lints.
Rust modules should be named with snake_case, and crate directories should be in kebab-case.

Files:

  • apps/desktop/src-tauri/src/api.rs
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Files:

  • apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
  • apps/desktop/src/utils/tauri.ts
  • apps/desktop/src/routes/editor/ExportDialog.tsx
  • apps/desktop/src/utils/queries.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
  • apps/desktop/src/utils/tauri.ts
  • apps/desktop/src/routes/editor/ExportDialog.tsx
  • apps/desktop/src/utils/queries.ts
**/tauri.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not edit auto-generated files named tauri.ts.

Files:

  • apps/desktop/src/utils/tauri.ts
**/queries.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not edit auto-generated files named queries.ts.

Files:

  • apps/desktop/src/utils/queries.ts
🧠 Learnings (4)
📚 Learning: 2025-10-10T02:06:05.438Z
Learnt from: Brendonovich
Repo: CapSoftware/Cap PR: 1165
File: apps/web-cluster/Dockerfile:15-15
Timestamp: 2025-10-10T02:06:05.438Z
Learning: Node.js version 24 and later includes built-in TypeScript support (type-stripping) and can run .ts files directly without requiring a separate TypeScript runtime or transpilation step for basic type annotations. The command `node script.ts` works natively in Node.js v24+.

Applied to files:

  • packages/database/package.json
📚 Learning: 2025-09-22T14:19:56.010Z
Learnt from: CR
Repo: CapSoftware/Cap PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-22T14:19:56.010Z
Learning: Applies to **/tauri.ts : Do not edit auto-generated files named `tauri.ts`.

Applied to files:

  • apps/desktop/src/utils/tauri.ts
📚 Learning: 2025-09-22T14:19:56.010Z
Learnt from: CR
Repo: CapSoftware/Cap PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-22T14:19:56.010Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use PascalCase for React/Solid components.

Applied to files:

  • apps/desktop/src/routes/editor/ExportDialog.tsx
📚 Learning: 2025-09-22T14:19:56.010Z
Learnt from: CR
Repo: CapSoftware/Cap PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-22T14:19:56.010Z
Learning: Applies to **/queries.ts : Do not edit auto-generated files named `queries.ts`.

Applied to files:

  • apps/desktop/src/utils/queries.ts
🧬 Code graph analysis (3)
apps/desktop/src-tauri/src/api.rs (1)
apps/desktop/src/utils/tauri.ts (1)
  • Organization (433-433)
apps/desktop/src/routes/editor/ExportDialog.tsx (2)
apps/desktop/src/utils/queries.ts (1)
  • createOrganizationsQuery (245-256)
apps/desktop/src/utils/tauri.ts (1)
  • commands (7-287)
apps/desktop/src/utils/queries.ts (1)
apps/desktop/src/store.ts (1)
  • authStore (59-59)
⏰ 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). (3)
  • GitHub Check: Clippy
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
🔇 Additional comments (2)
packages/local-docker/package.json (1)

13-13: Node engine constraint relaxation approved.

The change from exact to minimum version is consistent with the PR objectives and mirrors updates across other packages. This allows Node 20 LTS and above, providing flexibility for developers.

packages/database/package.json (1)

56-56: Node engine constraint relaxation approved.

The change from exact to minimum version is consistent with the PR objectives and aligns with modern Node.js LTS schedules (20 and 22 are current LTS versions). All declared dependencies (React 19.1.1, Next 15.5.4, TypeScript 5.8.3, etc.) explicitly support Node 20+.

Please confirm that CI/CD pipelines have been updated to validate compatibility across Node 20, 22, and ideally Node 24+ to ensure the relaxed constraint (>=20) does not introduce unexpected breaking changes with future Node releases. Based on learnings, this change may enable future TypeScript support improvements in Node 24+.

@Brendonovich Brendonovich merged commit 6be1d52 into CapSoftware:main Oct 31, 2025
11 of 12 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 2, 2025
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.

Allow setting the organization to upload into via the new recording flow

3 participants