Skip to content

Better error message and admin config#1040

Merged
elie222 merged 6 commits intomainfrom
feat/better-error-message
Dec 1, 2025
Merged

Better error message and admin config#1040
elie222 merged 6 commits intomainfrom
feat/better-error-message

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Dec 1, 2025

Add admin-only config page and improve login error messaging while automating Homebrew formula updates and introducing standalone CLI lifecycle commands

Introduce an admin config page that reads env and version.txt, add tailored login error handling via useSearchParams, automate Homebrew formula version/SHA updates in the release workflow, and add standalone CLI commands for setup/start/stop/logs/status/update with local Docker orchestration.

📍Where to Start

Start with the admin config server component in page.tsx, then review the login error handling in page.tsx and the CLI entry in main.ts.


📊 Macroscope summarized 7c96e24. 5 files reviewed, 17 issues evaluated, 10 issues filtered, 2 comments posted

🗂️ Filtered Issues

Formula/inbox-zero.rb — 0 comments posted, 3 evaluated, 3 filtered
  • line 12: sha256 fields are placeholder strings ("REPLACE_WITH_DARWIN_ARM64_SHA256"). Homebrew validates the archive checksum at install time; using placeholders will cause a runtime install failure with a SHA256 mismatch for the on_macos on_arm artifact. [ Out of scope ]
  • line 21: sha256 field is a placeholder ("REPLACE_WITH_DARWIN_X64_SHA256"). Homebrew will fail installation on macOS Intel due to checksum mismatch when fetching inbox-zero-darwin-x64.tar.gz. [ Out of scope ]
  • line 32: sha256 field is a placeholder ("REPLACE_WITH_LINUX_X64_SHA256"). Homebrew will fail installation on Linux Intel due to checksum mismatch when fetching inbox-zero-linux-x64.tar.gz. [ Out of scope ]
packages/cli/src/main.ts — 2 comments posted, 14 evaluated, 7 filtered
  • line 43: ensureConfigDir() does not handle errors from mkdirSync(CONFIG_DIR, { recursive: true }). In standalone mode on systems where the home directory is not writable or the path cannot be created, this throws and terminates the process without a clear user-facing error or cleanup. A graceful error message and exit would be more robust. [ Low confidence ]
  • line 115: Default behavior changed: previously, when no command was provided, the code appended "setup" to process.argv to run setup; now it calls program.help() which prints help and exits. This is an externally visible contract change that may break scenarios relying on implicit setup. If intended, ensure documentation and dependent automation reflect this change. [ Low confidence ]
  • line 504: In repository mode, the code no longer verifies that the apps/web directory exists before attempting to write the .env file. ENV_FILE is set to resolve(REPO_ROOT, "apps/web/.env"), but there is no guard ensuring resolve(REPO_ROOT, "apps/web") exists in the current repository. If apps/web is missing (e.g., running this in a different repo layout), writeFileSync(ENV_FILE, ...) will throw ENOENT at runtime and crash the process. Previously, the implementation guarded this by checking existsSync(resolve(PROJECT_ROOT, "apps/web")) and exiting with a helpful error; that check was removed. Add an explicit existence check for apps/web (or create it) before writing to ENV_FILE, or restore the prior guard. [ Low confidence ]
  • line 597: In runStart, when options.detach is false, the result of spawnSync('docker', args, { stdio: 'inherit' }) is never checked. If docker compose up fails (e.g., Docker not installed or compose error), the function returns without reporting a failure or setting a non-zero exit code, leading to silent success despite an error. [ Low confidence ]
  • line 688: In child.on("close", (code) => { ... }), the promise resolves when options.follow is true regardless of the exit code. This suppresses errors from docker compose logs in follow mode (e.g., invalid --tail value, missing compose file, daemon issues), leading to a silent success even when the subprocess fails. The logic should only resolve on successful termination or explicit user-initiated cancellation, and reject on non-zero exit codes even when following. [ Low confidence ]
  • line 713: In runStatus, the code does not check the result of spawnSync('docker', ['compose', '-f', COMPOSE_FILE, 'ps'], { stdio: 'inherit' }). If the command fails, the function still exits with success and provides no error reporting, violating the expectation of a defined terminal state with correct error propagation. [ Low confidence ]
  • line 786: No timeout or abort mechanism is provided for the network call to fetch(COMPOSE_URL). Under network stalls or very slow responses, the CLI may hang indefinitely, providing no defined terminal state or fallback. [ Low confidence ]

Summary by CodeRabbit

Release Notes

  • New Features

    • Added CLI commands for container management: start, stop, logs, status, and update.
    • Added admin configuration dashboard displaying application, feature, and provider settings.
    • Enhanced login error handling with specific error messages for failed authentication attempts.
  • Documentation

    • Expanded CLI documentation with comprehensive command reference and quick-start guide.
    • Updated Microsoft OAuth setup guidance with single-tenant configuration options.
    • Updated base URLs to www.getinboxzero.com.
  • Chores

    • Version bump to v2.21.17.
    • Updated Homebrew formula with new version and corrected URLs.

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

@vercel
Copy link

vercel bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
inbox-zero Ready Ready Preview Dec 1, 2025 1:07am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Walkthrough

Version bumped to 2.21.17 with updated URLs to include www prefix. New admin configuration dashboard page added. CLI significantly refactored to support standalone and repository modes with Docker lifecycle management (start, stop, logs, status, update commands). Documentation expanded for CLI features and Microsoft OAuth tenant configuration.

Changes

Cohort / File(s) Summary
Version & Release Management
version.txt, Formula/inbox-zero.rb, .github/workflows/cli-release.yml
Version updated from 2.21.15 to 2.21.17. Homebrew formula homepage URL updated to www.getinboxzero.com. Release workflow refactored from echo-based values to Python script that programmatically updates formula SHA256 and version fields.
Public URL Updates
README.md, apps/web/app/api/v1/openapi/route.ts, copilot/inbox-zero-ecs/manifest.yml
Production URLs standardized to include www prefix (getinboxzero.com → www.getinboxzero.com) across documentation, OpenAPI definitions, and configuration examples.
Microsoft OAuth Documentation & Configuration
README.md
Expanded OAuth setup guidance with multitenant vs. single-tenant options. Added MICROSOFT_TENANT_ID environment variable section with instructions for copying tenant ID from Azure portal.
Admin Configuration Dashboard
apps/web/app/(app)/admin/config/page.tsx
New server-side admin page component displaying application configuration, features, auth providers, LLM settings, and integrations sourced from environment variables and version.txt. Includes admin access enforcement and internal Section/Row UI components.
Login Error Handling
apps/web/app/(landing)/login/error/page.tsx
Refactored error page with new LoginErrorContent component. Added error code mapping via query parameter with public-facing error messages (email_not_found). Wrapped content in Suspense with loading fallback.
CLI Feature Expansion & Mode Support
packages/cli/src/main.ts, packages/cli/README.md
Major CLI refactoring introducing standalone vs. repository modes with Docker availability checks. New commands: start, stop, logs, status, update (alongside existing setup). Standalone mode fetches docker-compose.yml, manages config at ~/.inbox-zero/, and supports interactive port/secrets configuration. Docker lifecycle operations (pull, compose up/down, logs forwarding) integrated. Comprehensive documentation rewrite with Quick Start, Commands, Requirements, and Configuration sections.
Submodule Update
apps/web/app/(marketing)
Submodule pointer updated; no functional code changes.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CLI
    participant FS as Filesystem
    participant Docker
    participant Network

    User->>CLI: inbox-zero setup (standalone mode)
    CLI->>FS: Check if ~/.inbox-zero/ exists
    alt Config dir missing
        CLI->>FS: Create ~/.inbox-zero/
    end
    CLI->>Docker: Check Docker availability
    alt Docker not available
        CLI-->>User: Error: Docker required
    else
        CLI->>Docker: Check Docker Compose availability
        alt Docker Compose unavailable
            CLI-->>User: Error: Docker Compose required
        else
            CLI->>Network: Fetch docker-compose.yml
            CLI->>FS: Save docker-compose.yml to ~/.inbox-zero/
            User->>CLI: Input OAuth credentials, ports, LLM provider
            CLI->>FS: Generate secrets & config
            CLI->>FS: Write .env to ~/.inbox-zero/
            CLI-->>User: Setup complete with next steps
        end
    end
Loading
sequenceDiagram
    actor User
    participant CLI
    participant FS as Filesystem
    participant Docker
    participant Containers

    User->>CLI: inbox-zero start [--detach]
    CLI->>FS: Read config from ~/.inbox-zero/
    CLI->>Docker: Pull latest image
    alt Detached mode
        CLI->>Docker: docker compose up -d
        Docker->>Containers: Start services in background
    else Foreground mode
        CLI->>Docker: docker compose up
        Docker->>Containers: Start services (attached output)
    end
    CLI->>FS: Extract URLs from .env
    CLI-->>User: Display running services & access URLs
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Key areas requiring extra attention:
    • packages/cli/src/main.ts: Major refactoring introducing dual-mode architecture (repository vs. standalone), Docker integration, new command implementations (start, stop, logs, status, update), environment variable handling, and dynamic configuration paths. Dense logic with multiple branches and state management.
    • apps/web/app/(app)/admin/config/page.tsx: New component with comprehensive environment variable collection, version reading at build time, and multi-section rendering logic.
    • apps/web/app/(landing)/login/error/page.tsx: Refactoring with new error mapping structure and Suspense integration; verify existing authentication flows remain unaffected.
    • Workflow script changes (.github/workflows/cli-release.yml): Python script for formula updates requires validation of SHA256 substitution logic and file write operations.

Possibly related PRs

  • Add homebrew formula #1038: Introduced the Homebrew formula and CLI release workflow that are now being updated with Python script-based automation and version bumping.
  • Add tennant support for microsoft #1031: Adds MICROSOFT_TENANT_ID support to environment configuration; this PR documents the new tenant ID in README and admin config page, completing the integration foundation.

Poem

🐰 Hops through versions with glee,
CLI now runs wild and free,
Docker dances at command,
Config paths across the land,
From repo root to home so deep,
Admin dashboards secrets keep!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Better error message and admin config' is vague and does not accurately reflect the primary changes in the pull request, which include version bumps, URL updates across multiple files, CLI refactoring, and Homebrew formula updates. Consider a more specific title like 'Release v2.21.17: CLI standalone mode, admin config page, and error handling' to better reflect the scope of changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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 feat/better-error-message

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.

@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​types/​node@​22.18.12 ⏵ 22.15.181001008195100

View full report


// Detect if we're in an inbox-zero project
function findProjectRoot(): string {
// Detect if we're running from within the repo
Copy link
Contributor

Choose a reason for hiding this comment

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

findRepoRoot() misdetects when cwd is a subfolder of apps/web. resolve(cwd, "../../apps/web") can normalize to .../apps/apps/web, so the repo root is missed and null is returned. Consider walking up from cwd until you find a directory containing apps/web, then return that directory.

🚀 Reply to ask Macroscope to explain or update this suggestion.

👍 Helpful? React to give us feedback.

if (restart) {
spinner.start("Restarting...");

spawnSync("docker", ["compose", "-f", COMPOSE_FILE, "down"], {
Copy link
Contributor

Choose a reason for hiding this comment

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

spawnSync handling misses pre‑spawn (status === null) and non‑zero exit failures, causing false success and weak errors. Suggest a shared helper for Docker commands that checks status/error, prefers error.message over stderr, stops the spinner, logs, and exits on failure.

🚀 Reply to ask Macroscope to explain or update this suggestion.

👍 Helpful? React to give us feedback.

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

🧹 Nitpick comments (3)
packages/cli/src/main.ts (3)

33-38: Potential type issue with nullable REPO_ROOT.

When IS_REPO_MODE is true, REPO_ROOT is guaranteed to be non-null at runtime. However, TypeScript doesn't narrow the type through the boolean variable, so resolve(REPO_ROOT, ...) passes a string | null where string is expected. This works at runtime but could cause type errors if strict null checks are enabled.

Consider using a non-null assertion or restructuring for type safety:

-const ENV_FILE = IS_REPO_MODE
-  ? resolve(REPO_ROOT, "apps/web/.env")
-  : resolve(CONFIG_DIR, ".env");
-const COMPOSE_FILE = IS_REPO_MODE
-  ? resolve(REPO_ROOT, "docker-compose.yml")
-  : resolve(CONFIG_DIR, "docker-compose.yml");
+const ENV_FILE = IS_REPO_MODE
+  ? resolve(REPO_ROOT!, "apps/web/.env")
+  : resolve(CONFIG_DIR, ".env");
+const COMPOSE_FILE = IS_REPO_MODE
+  ? resolve(REPO_ROOT!, "docker-compose.yml")
+  : resolve(CONFIG_DIR, "docker-compose.yml");

191-208: Port validation could be more robust.

The current validation only checks for numeric digits but doesn't validate the port range. Values like 0, 70000, or 999999 would pass validation but fail at Docker runtime.

-            validate: (v) =>
-              /^\d+$/.test(v) ? undefined : "Must be a valid port number",
+            validate: (v) => {
+              const port = Number.parseInt(v, 10);
+              if (Number.isNaN(port) || port < 1 || port > 65535) {
+                return "Must be a valid port number (1-65535)";
+              }
+              return undefined;
+            },

482-494: Original error details are lost in catch block.

When the docker-compose fetch fails, the original error message is discarded and only a generic message is shown. This makes debugging connection issues harder.

-    } catch {
+    } catch (error) {
       spinner.stop("Failed to fetch docker-compose.yml");
       p.log.error(
         "Could not fetch docker-compose.yml from GitHub.\n" +
-          "Please check your internet connection and try again.",
+          "Please check your internet connection and try again.\n" +
+          `Error: ${error instanceof Error ? error.message : String(error)}`,
       );
       process.exit(1);
     }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b925297 and 7c96e24.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • .github/workflows/cli-release.yml (1 hunks)
  • Formula/inbox-zero.rb (1 hunks)
  • README.md (4 hunks)
  • apps/web/app/(app)/admin/config/page.tsx (1 hunks)
  • apps/web/app/(landing)/login/error/page.tsx (3 hunks)
  • apps/web/app/(marketing) (1 hunks)
  • apps/web/app/api/v1/openapi/route.ts (1 hunks)
  • copilot/inbox-zero-ecs/manifest.yml (1 hunks)
  • packages/cli/README.md (2 hunks)
  • packages/cli/src/main.ts (7 hunks)
  • version.txt (1 hunks)
🧰 Additional context used
📓 Path-based instructions (22)
!(pages/_document).{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

Don't use the next/head module in pages/_document.js on Next.js projects

Files:

  • apps/web/app/(marketing)
  • apps/web/app/api/v1/openapi/route.ts
  • apps/web/app/(app)/admin/config/page.tsx
  • .github/workflows/cli-release.yml
  • version.txt
  • packages/cli/README.md
  • packages/cli/src/main.ts
  • Formula/inbox-zero.rb
  • README.md
  • copilot/inbox-zero-ecs/manifest.yml
  • apps/web/app/(landing)/login/error/page.tsx
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.{ts,tsx}: Use TypeScript with strict null checks
Use @/ path aliases for imports from project root
Use proper error handling with try/catch blocks
Format code with Prettier
Follow consistent naming conventions using PascalCase for components
Centralize shared types in dedicated type files

Import specific lodash functions rather than entire lodash library to minimize bundle size (e.g., import groupBy from 'lodash/groupBy')

Files:

  • apps/web/app/api/v1/openapi/route.ts
  • apps/web/app/(app)/admin/config/page.tsx
  • apps/web/app/(landing)/login/error/page.tsx
apps/web/app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

Follow NextJS app router structure with (app) directory

Files:

  • apps/web/app/api/v1/openapi/route.ts
  • apps/web/app/(app)/admin/config/page.tsx
  • apps/web/app/(landing)/login/error/page.tsx
apps/web/app/api/**/*.ts

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/app/api/**/*.ts: Wrap GET API routes with withAuth or withEmailAccount middleware for authentication
Export response types from GET API routes using Awaited<ReturnType<>> pattern for type-safe client usage

Files:

  • apps/web/app/api/v1/openapi/route.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/data-fetching.mdc)

**/*.{ts,tsx}: For API GET requests to server, use the swr package
Use result?.serverError with toastError from @/components/Toast for error handling in async operations

**/*.{ts,tsx}: Use wrapper functions for Gmail message operations (get, list, batch, etc.) from @/utils/gmail/message.ts instead of direct API calls
Use wrapper functions for Gmail thread operations from @/utils/gmail/thread.ts instead of direct API calls
Use wrapper functions for Gmail label operations from @/utils/gmail/label.ts instead of direct API calls

**/*.{ts,tsx}: For early access feature flags, create hooks using the naming convention use[FeatureName]Enabled that return a boolean from useFeatureFlagEnabled("flag-key")
For A/B test variant flags, create hooks using the naming convention use[FeatureName]Variant that define variant types, use useFeatureFlagVariantKey() with type casting, and provide a default "control" fallback
Use kebab-case for PostHog feature flag keys (e.g., inbox-cleaner, pricing-options-2)
Always define types for A/B test variant flags (e.g., type PricingVariant = "control" | "variant-a" | "variant-b") and provide type safety through type casting

**/*.{ts,tsx}: Don't use primitive type aliases or misleading types
Don't use empty type parameters in type aliases and interfaces
Don't use this and super in static contexts
Don't use any or unknown as type constraints
Don't use the TypeScript directive @ts-ignore
Don't use TypeScript enums
Don't export imported variables
Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions
Don't use TypeScript namespaces
Don't use non-null assertions with the ! postfix operator
Don't use parameter properties in class constructors
Don't use user-defined types
Use as const instead of literal types and type annotations
Use either T[] or Array<T> consistently
Initialize each enum member value explicitly
Use export type for types
Use `impo...

Files:

  • apps/web/app/api/v1/openapi/route.ts
  • apps/web/app/(app)/admin/config/page.tsx
  • packages/cli/src/main.ts
  • apps/web/app/(landing)/login/error/page.tsx
apps/web/app/api/**/route.ts

📄 CodeRabbit inference engine (.cursor/rules/fullstack-workflow.mdc)

apps/web/app/api/**/route.ts: Create GET API routes using withAuth or withEmailAccount middleware in apps/web/app/api/*/route.ts, export response types as GetExampleResponse type alias for client-side type safety
Always export response types from GET routes as Get[Feature]Response using type inference from the data fetching function for type-safe client consumption
Do NOT use POST API routes for mutations - always use server actions with next-safe-action instead

Files:

  • apps/web/app/api/v1/openapi/route.ts
**/app/**/route.ts

📄 CodeRabbit inference engine (.cursor/rules/get-api-route.mdc)

**/app/**/route.ts: Always wrap GET API route handlers with withAuth or withEmailAccount middleware for consistent error handling and authentication in Next.js App Router
Infer and export response type for GET API routes using Awaited<ReturnType<typeof functionName>> pattern in Next.js
Use Prisma for database queries in GET API routes
Return responses using NextResponse.json() in GET API routes
Do not use try/catch blocks in GET API route handlers when using withAuth or withEmailAccount middleware, as the middleware handles error handling

Files:

  • apps/web/app/api/v1/openapi/route.ts
**/{server,api,actions,utils}/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)

**/{server,api,actions,utils}/**/*.ts: Use createScopedLogger from "@/utils/logger" for logging in backend code
Add the createScopedLogger instantiation at the top of the file with an appropriate scope name
Use .with() method to attach context variables only within specific functions, not on global loggers
For large functions with reused variables, use createScopedLogger().with() to attach context once and reuse the logger without passing variables repeatedly

Files:

  • apps/web/app/api/v1/openapi/route.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/prisma-enum-imports.mdc)

Always import Prisma enums from @/generated/prisma/enums instead of @/generated/prisma/client to avoid Next.js bundling errors in client components

Import Prisma using the project's centralized utility: import prisma from '@/utils/prisma'

Files:

  • apps/web/app/api/v1/openapi/route.ts
  • apps/web/app/(app)/admin/config/page.tsx
  • packages/cli/src/main.ts
  • apps/web/app/(landing)/login/error/page.tsx
apps/web/app/**/[!.]*/route.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

Use kebab-case for route directories in Next.js App Router (e.g., api/hello-world/route)

Files:

  • apps/web/app/api/v1/openapi/route.ts
apps/web/app/api/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/security-audit.mdc)

apps/web/app/api/**/*.{ts,tsx}: API routes must use withAuth, withEmailAccount, or withError middleware for authentication
All database queries must include user scoping with emailAccountId or userId filtering in WHERE clauses
Request parameters must be validated before use; avoid direct parameter usage without type checking
Use generic error messages instead of revealing internal details; throw SafeError instead of exposing user IDs, resource IDs, or system information
API routes should only return necessary fields using select in database queries to prevent unintended information disclosure
Cron endpoints must use hasCronSecret or hasPostCronSecret to validate cron requests and prevent unauthorized access
Request bodies should use Zod schemas for validation to ensure type safety and prevent injection attacks

Files:

  • apps/web/app/api/v1/openapi/route.ts
**/app/api/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/security.mdc)

**/app/api/**/*.ts: ALL API routes that handle user data MUST use appropriate middleware: use withEmailAccount for email-scoped operations, use withAuth for user-scoped operations, or use withError with proper validation for public/custom auth endpoints
Use withEmailAccount middleware for operations scoped to a specific email account, including reading/writing emails, rules, schedules, or any operation using emailAccountId
Use withAuth middleware for user-level operations such as user settings, API keys, and referrals that use only userId
Use withError middleware only for public endpoints, custom authentication logic, or cron endpoints. For cron endpoints, MUST use hasCronSecret() or hasPostCronSecret() validation
Cron endpoints without proper authentication can be triggered by anyone. CRITICAL: All cron endpoints MUST validate cron secret using hasCronSecret(request) or hasPostCronSecret(request) and capture unauthorized attempts with captureException()
Always validate request bodies using Zod schemas to ensure type safety and prevent invalid data from reaching database operations
Maintain consistent error response format across all API routes to avoid information disclosure while providing meaningful error feedback

Files:

  • apps/web/app/api/v1/openapi/route.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/security.mdc)

**/*.ts: ALL database queries MUST be scoped to the authenticated user/account by including user/account filtering in WHERE clauses to prevent unauthorized data access
Always validate that resources belong to the authenticated user before performing operations, using ownership checks in WHERE clauses or relationships
Always validate all input parameters for type, format, and length before using them in database queries
Use SafeError for error responses to prevent information disclosure. Generic error messages should not reveal internal IDs, logic, or resource ownership details
Only return necessary fields in API responses using Prisma's select option. Never expose sensitive data such as password hashes, private keys, or system flags
Prevent Insecure Direct Object References (IDOR) by validating resource ownership before operations. All findUnique/findFirst calls MUST include ownership filters
Prevent mass assignment vulnerabilities by explicitly whitelisting allowed fields in update operations instead of accepting all user-provided data
Prevent privilege escalation by never allowing users to modify system fields, ownership fields, or admin-only attributes through user input
All findMany queries MUST be scoped to the user's data by including appropriate WHERE filters to prevent returning data from other users
Use Prisma relationships for access control by leveraging nested where clauses (e.g., emailAccount: { id: emailAccountId }) to validate ownership

Files:

  • apps/web/app/api/v1/openapi/route.ts
  • packages/cli/src/main.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)

**/*.{tsx,ts}: Use Shadcn UI and Tailwind for components and styling
Use next/image package for images
For API GET requests to server, use the swr package with hooks like useSWR to fetch data
For text inputs, use the Input component with registerProps for form integration and error handling

Files:

  • apps/web/app/api/v1/openapi/route.ts
  • apps/web/app/(app)/admin/config/page.tsx
  • packages/cli/src/main.ts
  • apps/web/app/(landing)/login/error/page.tsx
**/*.{tsx,ts,css}

📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)

Implement responsive design with Tailwind CSS using a mobile-first approach

Files:

  • apps/web/app/api/v1/openapi/route.ts
  • apps/web/app/(app)/admin/config/page.tsx
  • packages/cli/src/main.ts
  • apps/web/app/(landing)/login/error/page.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{js,jsx,ts,tsx}: Don't use accessKey attribute on any HTML element
Don't set aria-hidden="true" on focusable elements
Don't add ARIA roles, states, and properties to elements that don't support them
Don't use distracting elements like <marquee> or <blink>
Only use the scope prop on <th> elements
Don't assign non-interactive ARIA roles to interactive HTML elements
Make sure label elements have text content and are associated with an input
Don't assign interactive ARIA roles to non-interactive HTML elements
Don't assign tabIndex to non-interactive HTML elements
Don't use positive integers for tabIndex property
Don't include "image", "picture", or "photo" in img alt prop
Don't use explicit role property that's the same as the implicit/default role
Make static elements with click handlers use a valid role attribute
Always include a title element for SVG elements
Give all elements requiring alt text meaningful information for screen readers
Make sure anchors have content that's accessible to screen readers
Assign tabIndex to non-interactive HTML elements with aria-activedescendant
Include all required ARIA attributes for elements with ARIA roles
Make sure ARIA properties are valid for the element's supported roles
Always include a type attribute for button elements
Make elements with interactive roles and handlers focusable
Give heading elements content that's accessible to screen readers (not hidden with aria-hidden)
Always include a lang attribute on the html element
Always include a title attribute for iframe elements
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress
Accompany onMouseOver/onMouseOut with onFocus/onBlur
Include caption tracks for audio and video elements
Use semantic elements instead of role attributes in JSX
Make sure all anchors are valid and navigable
Ensure all ARIA properties (aria-*) are valid
Use valid, non-abstract ARIA roles for elements with ARIA roles
Use valid AR...

Files:

  • apps/web/app/api/v1/openapi/route.ts
  • apps/web/app/(app)/admin/config/page.tsx
  • packages/cli/src/main.ts
  • apps/web/app/(landing)/login/error/page.tsx
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)

**/*.{js,ts,jsx,tsx}: Use lodash utilities for common operations (arrays, objects, strings)
Import specific lodash functions to minimize bundle size (e.g., import groupBy from 'lodash/groupBy')

Files:

  • apps/web/app/api/v1/openapi/route.ts
  • apps/web/app/(app)/admin/config/page.tsx
  • packages/cli/src/main.ts
  • apps/web/app/(landing)/login/error/page.tsx
apps/web/**/*.tsx

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.tsx: Follow tailwindcss patterns with prettier-plugin-tailwindcss for class sorting
Prefer functional components with hooks over class components
Use shadcn/ui components when available
Ensure responsive design with mobile-first approach
Use LoadingContent component for async data with loading and error states

Files:

  • apps/web/app/(app)/admin/config/page.tsx
  • apps/web/app/(landing)/login/error/page.tsx
apps/web/app/(app)/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)

apps/web/app/(app)/**/*.{ts,tsx}: Components for the page are either put in page.tsx, or in the apps/web/app/(app)/PAGE_NAME folder
If we're in a deeply nested component we will use swr to fetch via API
If you need to use onClick in a component, that component is a client component and file must start with use client

Files:

  • apps/web/app/(app)/admin/config/page.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)

**/*.tsx: Use the LoadingContent component to handle loading states instead of manual loading state management
For text areas, use the Input component with type='text', autosizeTextarea prop set to true, and registerProps for form integration

Files:

  • apps/web/app/(app)/admin/config/page.tsx
  • apps/web/app/(landing)/login/error/page.tsx
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{jsx,tsx}: Don't use unnecessary fragments
Don't pass children as props
Don't use the return value of React.render
Make sure all dependencies are correctly specified in React hooks
Make sure all React hooks are called from the top level of component functions
Don't forget key props in iterators and collection literals
Don't define React components inside other components
Don't use event handlers on non-interactive elements
Don't assign to React component props
Don't use both children and dangerouslySetInnerHTML props on the same element
Don't use dangerous JSX props
Don't use Array index in keys
Don't insert comments as text nodes
Don't assign JSX properties multiple times
Don't add extra closing tags for components without children
Use <>...</> instead of <Fragment>...</Fragment>
Watch out for possible "wrong" semicolons inside JSX elements
Make sure void (self-closing) elements don't have children
Don't use target="_blank" without rel="noopener"
Don't use <img> elements in Next.js projects
Don't use <head> elements in Next.js projects

Files:

  • apps/web/app/(app)/admin/config/page.tsx
  • apps/web/app/(landing)/login/error/page.tsx
*.md

📄 CodeRabbit inference engine (.cursor/rules/task-list.mdc)

*.md: Create task lists in markdown files named TASKS.md or with a descriptive feature-specific name (e.g., ASSISTANT_CHAT.md) in the project root to track project progress
Structure task list markdown files with sections: Feature Name Implementation (title), description, Completed Tasks, In Progress Tasks, Future Tasks, Implementation Plan, and Relevant Files subsections
Update task list markdown files by marking tasks as completed with [x], adding new identified tasks, and moving tasks between Completed/In Progress/Future sections as appropriate
Keep the 'Relevant Files' section in task list markdown files updated with file paths that have been created or modified, brief descriptions of each file's purpose, and status indicators (e.g., ✅) for completed components

Files:

  • README.md
🧠 Learnings (33)
📚 Learning: 2025-11-25T14:38:18.874Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:18.874Z
Learning: Applies to apps/web/app/(app)/**/page.tsx : Create new pages at `apps/web/app/(app)/PAGE_NAME/page.tsx`

Applied to files:

  • apps/web/app/(app)/admin/config/page.tsx
📚 Learning: 2025-11-25T14:38:23.265Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:23.265Z
Learning: Applies to apps/web/app/(app)/*/page.tsx : Create new pages at `apps/web/app/(app)/PAGE_NAME/page.tsx`

Applied to files:

  • apps/web/app/(app)/admin/config/page.tsx
📚 Learning: 2025-11-25T14:38:56.992Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:56.992Z
Learning: Applies to apps/web/app/(app)/*/page.tsx : Create new pages at `apps/web/app/(app)/PAGE_NAME/page.tsx` with components either colocated in the same folder or in `page.tsx`

Applied to files:

  • apps/web/app/(app)/admin/config/page.tsx
📚 Learning: 2025-11-25T14:38:23.265Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:23.265Z
Learning: Applies to apps/web/app/(app)/**/*.{ts,tsx} : Components for the page are either put in `page.tsx`, or in the `apps/web/app/(app)/PAGE_NAME` folder

Applied to files:

  • apps/web/app/(app)/admin/config/page.tsx
📚 Learning: 2025-11-25T14:38:18.874Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:18.874Z
Learning: Applies to apps/web/app/(app)/**/*.tsx : Components for pages are either put in `page.tsx`, or in the `apps/web/app/(app)/PAGE_NAME` folder

Applied to files:

  • apps/web/app/(app)/admin/config/page.tsx
📚 Learning: 2025-11-25T14:38:56.992Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:56.992Z
Learning: Applies to apps/web/app/*/page.tsx : Pages must be Server components that load data directly

Applied to files:

  • apps/web/app/(app)/admin/config/page.tsx
📚 Learning: 2025-11-25T14:38:23.265Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:23.265Z
Learning: Applies to apps/web/app/(app)/*/page.tsx : Pages are Server components so you can load data into them directly

Applied to files:

  • apps/web/app/(app)/admin/config/page.tsx
📚 Learning: 2025-11-25T14:36:45.807Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to apps/web/env.ts : Add client-side environment variables to `apps/web/env.ts` under the `client` object with `NEXT_PUBLIC_` prefix and Zod schema validation

Applied to files:

  • apps/web/app/(app)/admin/config/page.tsx
  • packages/cli/src/main.ts
  • copilot/inbox-zero-ecs/manifest.yml
📚 Learning: 2025-11-25T14:38:56.992Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:56.992Z
Learning: Main Next.js application is located in `apps/web`

Applied to files:

  • apps/web/app/(app)/admin/config/page.tsx
📚 Learning: 2025-11-25T14:36:43.454Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:43.454Z
Learning: Applies to apps/web/env.ts : Define environment variables in `apps/web/env.ts` using Zod schema validation, organizing them into `server` and `client` sections

Applied to files:

  • apps/web/app/(app)/admin/config/page.tsx
📚 Learning: 2025-11-25T14:36:43.454Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:43.454Z
Learning: Applies to apps/web/env.ts : For client-side environment variables in `apps/web/env.ts`, prefix them with `NEXT_PUBLIC_` and add them to both the `client` and `experimental__runtimeEnv` sections

Applied to files:

  • packages/cli/src/main.ts
  • copilot/inbox-zero-ecs/manifest.yml
📚 Learning: 2025-11-25T14:36:45.807Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to {.env.example,apps/web/env.ts} : Client-side environment variables must be prefixed with `NEXT_PUBLIC_`

Applied to files:

  • packages/cli/src/main.ts
  • copilot/inbox-zero-ecs/manifest.yml
📚 Learning: 2025-11-25T14:42:08.869Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ultracite.mdc:0-0
Timestamp: 2025-11-25T14:42:08.869Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Don't hardcode sensitive data like API keys and tokens

Applied to files:

  • packages/cli/src/main.ts
📚 Learning: 2025-11-25T14:36:18.416Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-11-25T14:36:18.416Z
Learning: Applies to apps/web/**/{.env.example,env.ts,turbo.json} : Add environment variables to `.env.example`, `env.ts`, and `turbo.json`

Applied to files:

  • packages/cli/src/main.ts
📚 Learning: 2025-11-25T14:36:18.416Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-11-25T14:36:18.416Z
Learning: Applies to apps/web/**/*NEXT_PUBLIC_* : Prefix client-side environment variables with `NEXT_PUBLIC_`

Applied to files:

  • copilot/inbox-zero-ecs/manifest.yml
📚 Learning: 2025-11-25T14:39:04.892Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/security-audit.mdc:0-0
Timestamp: 2025-11-25T14:39:04.892Z
Learning: No hardcoded secrets in code; all secrets must be stored in environment variables (e.g., CRON_SECRET)

Applied to files:

  • copilot/inbox-zero-ecs/manifest.yml
📚 Learning: 2025-11-25T14:36:45.807Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to .env.example : Add new environment variables to `.env.example` with example values

Applied to files:

  • copilot/inbox-zero-ecs/manifest.yml
📚 Learning: 2025-07-08T13:14:07.449Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 537
File: apps/web/app/(app)/[emailAccountId]/clean/onboarding/page.tsx:30-34
Timestamp: 2025-07-08T13:14:07.449Z
Learning: The clean onboarding page in apps/web/app/(app)/[emailAccountId]/clean/onboarding/page.tsx is intentionally Gmail-specific and should show an error for non-Google email accounts rather than attempting to support multiple providers.

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:37:09.306Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2025-11-25T14:37:09.306Z
Learning: Applies to apps/web/components/**/*.tsx : Use `LoadingContent` component to consistently handle loading and error states, passing `loading`, `error`, and `children` props

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:39:08.150Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/security-audit.mdc:0-0
Timestamp: 2025-11-25T14:39:08.150Z
Learning: Applies to apps/web/app/api/**/*.{ts,tsx} : Use generic error messages instead of revealing internal details; throw `SafeError` instead of exposing user IDs, resource IDs, or system information

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:36:18.416Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-11-25T14:36:18.416Z
Learning: Applies to apps/web/**/*.tsx : Use LoadingContent component for async data with loading and error states

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-06-05T09:49:12.168Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 485
File: apps/web/app/(landing)/login/page.tsx:41-43
Timestamp: 2025-06-05T09:49:12.168Z
Learning: In Next.js App Router, components that use the `useSearchParams` hook require a Suspense boundary to handle the asynchronous nature of search parameter access. The Suspense wrapper is necessary and should not be removed when a component uses useSearchParams.

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:37:22.822Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/get-api-route.mdc:0-0
Timestamp: 2025-11-25T14:37:22.822Z
Learning: Applies to **/app/**/route.ts : Always wrap GET API route handlers with `withAuth` or `withEmailAccount` middleware for consistent error handling and authentication in Next.js App Router

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:36:18.416Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-11-25T14:36:18.416Z
Learning: Applies to apps/web/components/**/*.tsx : Use `result?.serverError` with `toastError` and `toastSuccess` for error handling in form submissions

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:39:27.909Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/security.mdc:0-0
Timestamp: 2025-11-25T14:39:27.909Z
Learning: Applies to **/app/api/**/*.ts : Maintain consistent error response format across all API routes to avoid information disclosure while providing meaningful error feedback

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:39:23.326Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/security.mdc:0-0
Timestamp: 2025-11-25T14:39:23.326Z
Learning: Applies to app/api/**/*.ts : Use `SafeError` for error responses to prevent information disclosure - provide generic messages (e.g., 'Rule not found' not 'Rule {id} does not exist for user {userId}') without revealing internal IDs or ownership details

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-08-10T22:03:30.507Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 667
File: apps/web/app/(app)/[emailAccountId]/onboarding/page.tsx:18-25
Timestamp: 2025-08-10T22:03:30.507Z
Learning: In Next.js 15, both `params` and `searchParams` passed to page components in the App Router are Promises that need to be awaited. They should be typed as `Promise<{...}>` and accessed using `await` in server components or React's `use()` hook in client components. This is different from Next.js 14 where they were plain objects.

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:38:56.992Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:56.992Z
Learning: Components with `onClick` handlers must be client components marked with the `use client` directive

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:38:18.874Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:18.874Z
Learning: Applies to apps/web/app/(app)/**/*.tsx : If you need to use `onClick` in a component, that component must be a client component and file must start with `use client` directive

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:37:09.306Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2025-11-25T14:37:09.306Z
Learning: Applies to apps/web/hooks/use*.ts : Use SWR hooks for client-side data fetching, with hooks stored in `apps/web/hooks/use*.ts` that return typed responses from GET API routes

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:40:13.649Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-11-25T14:40:13.649Z
Learning: Applies to **/*.{tsx,ts,jsx,js} : For API get requests to server, use the `swr` package with `useSWR` hook

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:38:23.265Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:23.265Z
Learning: Applies to apps/web/app/(app)/**/*.{ts,tsx} : If you need to use `onClick` in a component, that component is a client component and file must start with `use client`

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
📚 Learning: 2025-11-25T14:40:13.649Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-11-25T14:40:13.649Z
Learning: Applies to **/*.{tsx,ts,jsx,js} : Use the `LoadingContent` component to handle loading states

Applied to files:

  • apps/web/app/(landing)/login/error/page.tsx
🧬 Code graph analysis (1)
apps/web/app/(landing)/login/error/page.tsx (1)
apps/web/env.ts (1)
  • env (17-246)
⏰ 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). (4)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Review for correctness
  • GitHub Check: test
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (19)
version.txt (1)

1-1: Version bump is appropriate.

The patch version bump from v2.21.15 to v2.21.17 aligns with the scope of improvements (better error messages and admin configuration). The version follows consistent semantic versioning conventions.

apps/web/app/(marketing) (1)

1-1: Clarify the scope and purpose of the submodule update.

This is a Git submodule pointer update. The actual code changes exist in the external submodule repository and are not visible in this review.

Per the AI summary, there are no observed functional changes to control flow or error handling. However, to ensure this update aligns with the PR's objectives (better error message and admin config), please confirm:

  1. Is this submodule update intentional and necessary for this PR?
  2. What specific changes in the submodule are being incorporated?
apps/web/app/api/v1/openapi/route.ts (1)

67-67: LGTM - URL update is consistent with project-wide changes.

The production server URL has been correctly updated to include the www prefix, aligning with the broader URL standardization across the repository.

apps/web/app/(app)/admin/config/page.tsx (2)

24-54: Good security practice - exposing configuration status without sensitive values.

The admin dashboard correctly exposes only the presence/absence of configuration (using !!env.VALUE) rather than the actual secret values. This is a good security practice that allows admins to verify configuration without exposing sensitive data.


175-178: Incorrect path resolution in getVersion() function.

The path path.join(process.cwd(), "../../version.txt") is incorrect. Since process.cwd() resolves to the repository root in Next.js, going up two more levels (../../) attempts to access a parent directory of the repository, which will fail. The file version.txt is located at the repository root. Use path.join(process.cwd(), "version.txt") instead.

⛔ Skipped due to learnings
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to apps/web/env.ts : Add client-side environment variables to `apps/web/env.ts` under the `client` object with `NEXT_PUBLIC_` prefix and Zod schema validation
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to {.env.example,apps/web/env.ts} : Client-side environment variables must be prefixed with `NEXT_PUBLIC_`
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:43.454Z
Learning: Applies to apps/web/env.ts : Define environment variables in `apps/web/env.ts` using Zod schema validation, organizing them into `server` and `client` sections
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ultracite.mdc:0-0
Timestamp: 2025-11-25T14:42:08.869Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Don't hardcode sensitive data like API keys and tokens
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:43.454Z
Learning: Applies to apps/web/env.ts : For client-side environment variables in `apps/web/env.ts`, prefix them with `NEXT_PUBLIC_` and add them to both the `client` and `experimental__runtimeEnv` sections
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to apps/web/env.ts : Add server-only environment variables to `apps/web/env.ts` under the `server` object with Zod schema validation
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to apps/web/env.ts : Add client-side environment variables to `apps/web/env.ts` under the `experimental__runtimeEnv` object to enable runtime access
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:18.874Z
Learning: Applies to apps/web/app/(app)/**/*.tsx : Components for pages are either put in `page.tsx`, or in the `apps/web/app/(app)/PAGE_NAME` folder
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-11-25T14:36:18.416Z
Learning: Applies to apps/web/**/*NEXT_PUBLIC_* : Prefix client-side environment variables with `NEXT_PUBLIC_`
apps/web/app/(landing)/login/error/page.tsx (2)

17-23: Well-structured error message mapping.

The errorMessages object provides a clean way to map error codes to user-friendly messages. The email_not_found error case is particularly helpful for guiding users when their account is not authorized.


25-70: Good refactoring with proper Suspense usage.

The extraction of LoginErrorContent as a separate component improves code organization. The use of useSearchParams with a Suspense boundary in the parent component follows Next.js best practices.

Based on learnings, this approach correctly handles the requirement that components using useSearchParams need a Suspense boundary.

packages/cli/README.md (1)

18-97: Excellent documentation improvements.

The expanded CLI documentation is comprehensive and well-structured. The addition of Quick Start, detailed Commands section, and Configuration guidance significantly improves the user experience. The examples are practical and the flow is logical.

copilot/inbox-zero-ecs/manifest.yml (1)

39-39: LGTM - Consistent URL update.

The base URL example has been correctly updated to include the www prefix, maintaining consistency with the project-wide URL standardization.

Formula/inbox-zero.rb (1)

5-6: Homepage URL updated correctly.

The homepage has been properly updated to include the www prefix. The version will be automatically updated by the CLI release workflow when it runs.

.github/workflows/cli-release.yml (1)

126-162: Improved formula update mechanism.

The Python-based approach is more robust than echo-based replacement. The regex patterns correctly target the version and platform-specific SHA256 values while preserving the file structure.

README.md (2)

224-227: Excellent Microsoft OAuth documentation improvements.

The expanded guidance on "Supported account types" with clear descriptions of both multitenant and single tenant options significantly improves the setup experience. This clarification helps users make an informed choice based on their deployment needs.


239-240: Good addition of tenant ID configuration.

The instructions for copying the Directory (tenant) ID and the corresponding environment variable documentation are clear and helpful. The comment explaining it's "Only needed for single tenant" prevents confusion.

Also applies to: 272-272

packages/cli/src/main.ts (6)

52-71: LGTM!

The Docker availability checks correctly handle both the modern Docker CLI plugin (docker compose) and the legacy standalone binary (docker-compose), with appropriate fallback logic.


76-121: LGTM!

The CLI structure is well-organized with clear command definitions and sensible defaults. The --no-detach option correctly inverts to a detach boolean flag.


255-340: LGTM!

The OAuth configuration flow is well-structured with clear setup instructions, dynamic port interpolation in redirect URIs, and sensible placeholder values for skipped credentials. The MICROSOFT_TENANT_ID = "common" is the correct default for supporting both personal and organizational accounts.


548-628: LGTM!

The start command implementation is solid with proper image pulling before startup, handling of foreground/background modes, and graceful fallback to default port when the env file is unreadable.


634-716: LGTM!

The stop, logs, and status commands are well-implemented. The logs command correctly handles the follow mode where Ctrl+C termination is expected behavior.


785-793: LGTM!

The fetch implementation is clean and straightforward. The function properly checks response status and throws a descriptive error on failure.

Comment on lines +762 to +773
if (restart) {
spinner.start("Restarting...");

spawnSync("docker", ["compose", "-f", COMPOSE_FILE, "down"], {
stdio: "pipe",
});
spawnSync("docker", ["compose", "-f", COMPOSE_FILE, "up", "-d"], {
stdio: "pipe",
});

spinner.stop("Restarted");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Missing error handling during restart.

The restart logic doesn't check the exit status of docker compose down or docker compose up. If either fails, the spinner still shows "Restarted" and the user won't know something went wrong.

   if (restart) {
     spinner.start("Restarting...");

-    spawnSync("docker", ["compose", "-f", COMPOSE_FILE, "down"], {
+    const downResult = spawnSync("docker", ["compose", "-f", COMPOSE_FILE, "down"], {
       stdio: "pipe",
     });
-    spawnSync("docker", ["compose", "-f", COMPOSE_FILE, "up", "-d"], {
+    if (downResult.status !== 0) {
+      spinner.stop("Failed to stop containers");
+      p.log.error(downResult.stderr?.toString() || "Unknown error");
+      process.exit(1);
+    }
+
+    const upResult = spawnSync("docker", ["compose", "-f", COMPOSE_FILE, "up", "-d"], {
       stdio: "pipe",
     });
+    if (upResult.status !== 0) {
+      spinner.stop("Failed to start containers");
+      p.log.error(upResult.stderr?.toString() || "Unknown error");
+      process.exit(1);
+    }

     spinner.stop("Restarted");
   }
🤖 Prompt for AI Agents
In packages/cli/src/main.ts around lines 762 to 773, the restart flow calls
spawnSync for "docker compose down" and "docker compose up" but ignores their
exit status and output so the spinner always reports "Restarted" even on
failure; update the code to capture each spawnSync result, check result.status
(and result.error), stop the spinner if a command fails, log or display the
captured stderr/stdout and the error, and abort (throw or call process.exit with
a non-zero code) instead of continuing to the success message so the user sees
the actual failure details.

@elie222 elie222 merged commit c37d96e into main Dec 1, 2025
22 checks passed
@elie222 elie222 deleted the feat/better-error-message branch December 1, 2025 01:10
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 12 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/cli/src/main.ts">

<violation number="1" location="packages/cli/src/main.ts:568">
P1: Lifecycle commands always call `docker compose`, so setups that only have the legacy `docker-compose` binary (explicitly accepted by `checkDockerCompose`) immediately fail with ENOENT when running `start/stop/logs/status/update`. Use whichever compose binary is available instead of hard‑coding the plugin.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

const spinner = p.spinner();
spinner.start("Pulling latest image...");

const pullResult = spawnSync(
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 1, 2025

Choose a reason for hiding this comment

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

P1: Lifecycle commands always call docker compose, so setups that only have the legacy docker-compose binary (explicitly accepted by checkDockerCompose) immediately fail with ENOENT when running start/stop/logs/status/update. Use whichever compose binary is available instead of hard‑coding the plugin.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/cli/src/main.ts, line 568:

<comment>Lifecycle commands always call `docker compose`, so setups that only have the legacy `docker-compose` binary (explicitly accepted by `checkDockerCompose`) immediately fail with ENOENT when running `start/stop/logs/status/update`. Use whichever compose binary is available instead of hard‑coding the plugin.</comment>

<file context>
@@ -550,185 +512,284 @@ Full guide: https://github.com/elie222/inbox-zero#microsoft-oauth-setup`,
+  const spinner = p.spinner();
+  spinner.start(&quot;Pulling latest image...&quot;);
+
+  const pullResult = spawnSync(
+    &quot;docker&quot;,
+    [&quot;compose&quot;, &quot;-f&quot;, COMPOSE_FILE, &quot;pull&quot;],
</file context>
Fix with Cubic

@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.

1 participant