Skip to content

fix(desktop): add missing PostHog env vars to main process vite config#522

Merged
saddlepaddle merged 2 commits intomainfrom
fix/desktop-posthog-env
Dec 28, 2025
Merged

fix(desktop): add missing PostHog env vars to main process vite config#522
saddlepaddle merged 2 commits intomainfrom
fix/desktop-posthog-env

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Dec 28, 2025

Summary

  • Add missing NEXT_PUBLIC_POSTHOG_KEY and NEXT_PUBLIC_POSTHOG_HOST to main process vite config define block
  • These env vars were referenced in env.main.ts but not baked in at build time, causing runtime validation failures

Test plan

  • Typecheck passes
  • Lint passes
  • Local dev test - app starts without env validation errors

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Added environment variable configuration support for analytics service integration in the desktop application, enabling secure and flexible deployment settings across different environments.
    • Reorganized task management validation by consolidating external schema definitions into local module implementations, improving code organization and reducing cross-module dependencies.

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

The main process env.main.ts references NEXT_PUBLIC_POSTHOG_KEY and
NEXT_PUBLIC_POSTHOG_HOST but they weren't defined in the main section
of electron.vite.config.ts, causing env validation to fail at runtime.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 28, 2025

📝 Walkthrough

Walkthrough

This change centralizes task schema validation to the desktop application and injects PostHog analytics environment variables into the Electron main process build configuration. The task schemas previously exported from the TRPC package are now locally defined in the desktop app and removed from public exports.

Changes

Cohort / File(s) Summary
PostHog Analytics Environment Injection
apps/desktop/electron.vite.config.ts
Added two environment variable injections (NEXT_PUBLIC_POSTHOG_KEY, NEXT_PUBLIC_POSTHOG_HOST) to the main process build define, JSON-stringified from process.env values.
Task Schema Localization
apps/desktop/src/lib/trpc/routers/tasks/index.ts
Replaced external updateTaskSchema import from @superset/trpc with a local zod-based schema definition. Added taskPriorityValues constant and comprehensive field validation (id, title, description, status, priority, repositoryId, assigneeId, branch, prUrl, estimate, dueDate, labels).
TRPC Public API Cleanup
packages/trpc/src/index.ts
Removed exports of createTaskSchema and updateTaskSchema from the public API.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hop hop, schemas moved to their home,
PostHog keys now in the electron zone,
Cleaned exports, validation's tight,
Desktop app shines with focused light!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. It lacks required sections including Related Issues, Type of Change, and Additional Notes; only Summary and Test plan are provided. Add missing required sections: Related Issues (link issue if applicable), Type of Change (mark the bug fix checkbox), and Additional Notes (or mark as N/A if none).
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the primary change: adding PostHog environment variables to the Vite config for the desktop app's main process.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/desktop-posthog-env

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.

Copy link
Copy Markdown
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: 2

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8b0cde and baadedf.

📒 Files selected for processing (2)
  • packages/db/src/env.ts
  • packages/trpc/src/env.ts
🧰 Additional context used
📓 Path-based instructions (2)
packages/db/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use Drizzle ORM for all database operations in the packages/db package

Files:

  • packages/db/src/env.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use type safety and avoid any types unless absolutely necessary in TypeScript files

Files:

  • packages/db/src/env.ts
  • packages/trpc/src/env.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T01:56:39.021Z
Learning: Applies to apps/desktop/src/main/index.ts : Load environment variables in `src/main/index.ts` with `override: true` before any other imports in the desktop app
📚 Learning: 2025-12-28T01:56:39.021Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T01:56:39.021Z
Learning: Applies to apps/desktop/src/main/index.ts : Load environment variables in `src/main/index.ts` with `override: true` before any other imports in the desktop app

Applied to files:

  • packages/db/src/env.ts
  • packages/trpc/src/env.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Deploy API
  • GitHub Check: Deploy Marketing
  • GitHub Check: Deploy Admin
  • GitHub Check: Deploy Web
  • GitHub Check: Deploy Docs
  • GitHub Check: Build

Comment thread packages/db/src/env.ts Outdated
*/
emptyStringAsUndefined: true,
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
skipValidation: true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, find and examine the env.ts file to understand the full context
fd -e ts env.ts -path "*/packages/db/*" --exec head -60 {}

Repository: superset-sh/superset

Length of output: 232


🏁 Script executed:

# Check which packages depend on @superset/db
fd -e json package.json --exec sh -c 'if grep -q "@superset/db" "$1" 2>/dev/null; then echo "$1"; fi' _ {}

Repository: superset-sh/superset

Length of output: 221


🏁 Script executed:

# Also check the packages/db package.json to understand its scope
fd -e json package.json -path "*/packages/db*" --exec cat {}

Repository: superset-sh/superset

Length of output: 232


🏁 Script executed:

# Find and read the env.ts file
find ./packages/db -name env.ts -type f -exec cat -n {} \;

Repository: superset-sh/superset

Length of output: 1713


🏁 Script executed:

# Check the packages/db directory structure
find ./packages/db -type f -name "*.ts" | head -20

Repository: superset-sh/superset

Length of output: 449


🏁 Script executed:

# Look for any configuration or documentation about skipValidation
rg "skipValidation" packages/db -B 5 -A 5

Repository: superset-sh/superset

Length of output: 406


🏁 Script executed:

# Check git log for when skipValidation was added and why
git log --oneline -p packages/db/src/env.ts | grep -A 10 -B 5 "skipValidation" | head -50

Repository: superset-sh/superset

Length of output: 252


🏁 Script executed:

# Look for any .env files or documentation about database setup
find . -type f \( -name ".env*" -o -name "*README*" -o -name "*SETUP*" \) | grep -E "(^\.\.?/|db|env)" | head -20

Repository: superset-sh/superset

Length of output: 204


🏁 Script executed:

# Check if there are conditional environment setups in the desktop app
find ./apps/desktop -type f -name "*.ts" -o -name "*.tsx" | xargs rg "DATABASE_URL|skipValidation" 2>/dev/null | head -20

Repository: superset-sh/superset

Length of output: 151


🏁 Script executed:

# Check the desktop app's env configuration
cat -n ./apps/desktop/src/main/env.main.ts

Repository: superset-sh/superset

Length of output: 2032


🏁 Script executed:

# Check if other apps have their own env configuration
find ./apps -name "env*.ts" -type f -exec echo "=== {} ===" \; -exec cat -n {} \;

Repository: superset-sh/superset

Length of output: 35745


🏁 Script executed:

# Check how packages/db/env is imported/used across the codebase
rg "from ['\"]@.*packages/db" -A 2 -B 2 | head -60

Repository: superset-sh/superset

Length of output: 46


🏁 Script executed:

# More specifically, check if the db env is actually imported anywhere
rg "from.*packages/db.*env|import.*env.*from.*packages/db" -l

Repository: superset-sh/superset

Length of output: 46


🏁 Script executed:

# Check if packages/db/env is exported from the package
find ./packages/db -name "index.ts" -type f -exec grep -l "env" {} \;

Repository: superset-sh/superset

Length of output: 46


🏁 Script executed:

# Search for imports of @superset/db/env or similar
rg "from.*@superset/db.*env|import.*from.*@superset/db|packages/db.*env" --type ts --type tsx

Repository: superset-sh/superset

Length of output: 91


🏁 Script executed:

# Check the packages/db index.ts to see what's exported
cat -n ./packages/db/src/index.ts

Repository: superset-sh/superset

Length of output: 182


🏁 Script executed:

# Check what packages/db/src/client.ts does with env
cat -n ./packages/db/src/client.ts | head -50

Repository: superset-sh/superset

Length of output: 766


🏁 Script executed:

# Verify env is not imported elsewhere in packages/db
rg "from.*./env|import.*env" ./packages/db --type ts

Repository: superset-sh/superset

Length of output: 440


🏁 Script executed:

# Double-check by searching for any imports of the db package that access env
rg "@superset/db" -A 5 -B 5 --type ts | grep -i "env" | head -20

Repository: superset-sh/superset

Length of output: 1086


skipValidation: true bypasses validation only for the packages/db package initialization, not for consumer apps.

The packages/db/env.ts is used internally by packages/db/src/client.ts (lines 11, 20) to initialize the database client, not exported as a shared env for other packages. Consumer apps (web, admin, api, desktop) all have their own env.ts with conditional validation.

However, unconditionally disabling validation here still removes early error detection: if DATABASE_URL is missing or malformed, the error will only surface when the database client is instantiated in client.ts, not when the module loads. Consider making the schema conditional or marking fields as .optional() if they're truly not always required.

🤖 Prompt for AI Agents
In packages/db/src/env.ts around line 43, the env schema currently sets
skipValidation: true which suppresses early validation for this package;
instead, restore validation by removing skipValidation and adjust the schema so
DB-specific vars are optional when appropriate (e.g., mark DATABASE_URL as
.optional() or provide separate required vs optional variants), or add a clear
conditional around validation (only skip in test/dev by checking NODE_ENV).
Update the schema export so the module validates at load time unless explicitly
skipping for allowed runtimes.

Comment thread packages/trpc/src/env.ts Outdated
runtimeEnv: process.env,
emptyStringAsUndefined: true,
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
skipValidation: true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if the desktop app's Vite config defines these vars
if [ -f "apps/desktop/electron.vite.config.ts" ]; then
  echo "=== Checking desktop Vite config for env var definitions ==="
  cat -n apps/desktop/electron.vite.config.ts
fi

Repository: superset-sh/superset

Length of output: 8456


🏁 Script executed:

#!/bin/bash
# Check if env.main.ts exists and what it contains
if [ -f "apps/desktop/src/main/env.main.ts" ]; then
  echo "=== Checking env.main.ts ==="
  cat -n apps/desktop/src/main/env.main.ts
fi

# Also check the main index.ts file mentioned in learning
if [ -f "apps/desktop/src/main/index.ts" ]; then
  echo -e "\n=== Checking src/main/index.ts (first 50 lines) ==="
  head -50 -n apps/desktop/src/main/index.ts
fi

Repository: superset-sh/superset

Length of output: 2195


🏁 Script executed:

#!/bin/bash
# Check the actual packages/trpc/src/env.ts file to understand the full context
echo "=== Checking packages/trpc/src/env.ts (full file) ==="
cat -n packages/trpc/src/env.ts

Repository: superset-sh/superset

Length of output: 1004


🏁 Script executed:

#!/bin/bash
# Check if there are other places where env validation is managed
echo "=== Searching for skipValidation in codebase ==="
rg "skipValidation" -B 3 -A 3 --type ts --type tsx

echo -e "\n=== Searching for env.ts in packages ==="
fd "env.ts" packages/

Repository: superset-sh/superset

Length of output: 247


🏁 Script executed:

#!/bin/bash
# Check what imports packages/trpc/src/env.ts
echo "=== Searching for imports of packages/trpc/src/env.ts ==="
rg "from.*packages/trpc.*env" -A 2 -B 2
rg "from.*@repo/trpc.*env" -A 2 -B 2

echo -e "\n=== Checking apps/desktop imports of trpc env ==="
rg "from.*trpc" apps/desktop/src/main/ --type ts 2>/dev/null | head -20

echo -e "\n=== Checking if trpc package exports the env ==="
rg "export.*env" packages/trpc/src/ --type ts

Repository: superset-sh/superset

Length of output: 654


🏁 Script executed:

#!/bin/bash
# Check the packages/db/src/env.ts to see if it has similar issues
echo "=== Checking packages/db/src/env.ts ==="
cat -n packages/db/src/env.ts

Repository: superset-sh/superset

Length of output: 1753


🏁 Script executed:

#!/bin/bash
# Check desktop app's main/index.ts to see env loading
echo "=== Checking apps/desktop/src/main/index.ts (first 30 lines) ==="
head -30 apps/desktop/src/main/index.ts

Repository: superset-sh/superset

Length of output: 1343


🏁 Script executed:

#!/bin/bash
# Check if there are any backend/server files that import from trpc/src/env
echo "=== Searching for uses of @superset/trpc env in backend/server context ==="
rg "from.*@superset/trpc" --type ts --type tsx | grep -v "apps/desktop" | head -30

# Also check if the env is used directly anywhere
echo -e "\n=== Checking if trpc env is actually used/imported anywhere ==="
rg "trpc.*env\|@superset/trpc.*env" --type ts --type tsx

Repository: superset-sh/superset

Length of output: 276


🏁 Script executed:

#!/bin/bash
# Check git history or comments around this line to understand why skipValidation was added
echo "=== Checking context around packages/trpc/src/env.ts ==="
cat -n packages/trpc/src/env.ts | head -30

# Check if there's a server/backend entry point that uses this
echo -e "\n=== Looking for backend/server context using trpc ==="
find . -name "*.ts" -path "*/server/*" -o -name "*.ts" -path "*/backend/*" | head -10
rg "createEnv\|trpc" packages/trpc/ --type ts -B 2 -A 2

Repository: superset-sh/superset

Length of output: 1062


🏁 Script executed:

#!/bin/bash
# Check the trpc package's main export file
echo "=== Checking packages/trpc package.json ==="
cat packages/trpc/package.json | head -30

echo -e "\n=== Checking packages/trpc src structure ==="
ls -la packages/trpc/src/

echo -e "\n=== Checking if env.ts is exported from main trpc file ==="
find packages/trpc/src -name "index.ts" -o -name "main.ts" | xargs cat -n 2>/dev/null

Repository: superset-sh/superset

Length of output: 2546


🏁 Script executed:

#!/bin/bash
# Do a broader search for where trpc env might be imported
echo "=== Searching for trpc package imports (without type restrictions) ==="
grep -r "packages/trpc\|@superset/trpc" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" | grep -i env | head -20

echo -e "\n=== Searching all imports from @superset/trpc ==="
grep -r "@superset/trpc" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" | head -20

Repository: superset-sh/superset

Length of output: 1777


🏁 Script executed:

#!/bin/bash
# Check what the comment/PR context might be about
echo "=== Check git log for recent changes to trpc/src/env.ts ==="
git log --oneline -20 -- packages/trpc/src/env.ts 2>/dev/null || echo "No git history available"

echo -e "\n=== Check if SKIP_ENV_VALIDATION is used anywhere ==="
grep -r "SKIP_ENV_VALIDATION" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx"

Repository: superset-sh/superset

Length of output: 1612


Unconditionally disabling validation for security-sensitive environment variables in a shared package creates consistency and security risks.

The trpc package unconditionally sets skipValidation: true (line 23), which bypasses runtime validation for critical variables:

  • CLERK_SECRET_KEY (authentication secret)
  • BLOB_READ_WRITE_TOKEN (storage credentials)
  • POSTHOG_API_KEY, POSTHOG_PROJECT_ID (analytics configuration)
  • QSTASH_TOKEN (queue credentials)

This conflicts with the pattern used by all consuming applications (admin, api, desktop, web, docs, marketing), which conditionally enable validation based on SKIP_ENV_VALIDATION. The shared package's unconditional disabling means these secrets are never validated, even when the environment expects validation to be enforced.

Consider aligning the shared package with the app-level pattern:

skipValidation: !!process.env.SKIP_ENV_VALIDATION,

This allows skipping validation only when explicitly needed (e.g., during desktop development) while maintaining security checks in production and standard deployments.

🤖 Prompt for AI Agents
In packages/trpc/src/env.ts around line 23, the file unconditionally sets
skipValidation: true which bypasses runtime validation for security-sensitive
env vars; change this to respect the existing app-level pattern by using
skipValidation: !!process.env.SKIP_ENV_VALIDATION (or equivalent boolean check)
so validation runs by default and only skips when SKIP_ENV_VALIDATION is
explicitly set; update any comments and tests as needed to reflect the new
behavior.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 28, 2025

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ✅ Electric Fly.io app

Thank you for your contribution! 🎉

…ency

- Remove createTaskSchema and updateTaskSchema exports from @superset/trpc
- Define updateTaskSchema locally in desktop app
Copy link
Copy Markdown
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

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between baadedf and 1eb3bb9.

📒 Files selected for processing (2)
  • apps/desktop/src/lib/trpc/routers/tasks/index.ts
  • packages/trpc/src/index.ts
💤 Files with no reviewable changes (1)
  • packages/trpc/src/index.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/desktop/**/*.{ts,tsx}

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

apps/desktop/**/*.{ts,tsx}: For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc
Use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary.
For tRPC subscriptions with trpc-electron, ALWAYS use the observable pattern from @trpc/server/observable instead of async generators, as the library explicitly checks isObservable(result) and throws an error otherwise

Files:

  • apps/desktop/src/lib/trpc/routers/tasks/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use type safety and avoid any types unless absolutely necessary in TypeScript files

Files:

  • apps/desktop/src/lib/trpc/routers/tasks/index.ts
apps/desktop/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Move Node.js functionality needed in Electron renderer to src/main/lib/ and communicate via IPC

Files:

  • apps/desktop/src/lib/trpc/routers/tasks/index.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T01:56:39.021Z
Learning: Applies to apps/desktop/src/main/index.ts : Load environment variables in `src/main/index.ts` with `override: true` before any other imports in the desktop app
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-28T01:56:39.021Z
Learning: Applies to apps/desktop/src/**/*.{ts,tsx} : Move Node.js functionality needed in Electron renderer to `src/main/lib/` and communicate via IPC
🧬 Code graph analysis (1)
apps/desktop/src/lib/trpc/routers/tasks/index.ts (2)
packages/db/src/schema/enums.ts (1)
  • taskPriorityValues (16-22)
packages/trpc/src/router/task/schema.ts (1)
  • updateTaskSchema (19-32)
⏰ 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). (7)
  • GitHub Check: Deploy API
  • GitHub Check: Deploy Docs
  • GitHub Check: Deploy Web
  • GitHub Check: Deploy Marketing
  • GitHub Check: Deploy Admin
  • GitHub Check: Build - macOS (arm64)
  • GitHub Check: Build
🔇 Additional comments (2)
apps/desktop/src/lib/trpc/routers/tasks/index.ts (2)

2-2: LGTM - Import added for local schema definition.

The zod import is necessary for the local schema definition that follows.


24-29: LGTM - Schema usage is correct.

The update procedure correctly uses the local updateTaskSchema for input validation. The implementation properly passes the validated input to the API client.

Note: This comment assumes the code duplication concern raised earlier will be addressed.

Comment on lines +5 to +20
const taskPriorityValues = ["urgent", "high", "medium", "low", "none"] as const;

const updateTaskSchema = z.object({
id: z.string().uuid(),
title: z.string().min(1).optional(),
description: z.string().nullable().optional(),
status: z.string().optional(),
priority: z.enum(taskPriorityValues).optional(),
repositoryId: z.string().uuid().optional(),
assigneeId: z.string().uuid().nullable().optional(),
branch: z.string().nullable().optional(),
prUrl: z.string().url().nullable().optional(),
estimate: z.number().int().positive().nullable().optional(),
dueDate: z.coerce.date().nullable().optional(),
labels: z.array(z.string()).optional(),
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check repository structure and locate the file under review
git ls-files | head -20

Repository: superset-sh/superset

Length of output: 656


🏁 Script executed:

# Explore the apps/desktop directory
fd -t f "index.ts" apps/desktop/src/lib/trpc/routers/tasks/ 2>/dev/null | head -5

Repository: superset-sh/superset

Length of output: 112


🏁 Script executed:

# Check if shared packages exist
fd -t d "packages" --maxdepth 1 2>/dev/null

Repository: superset-sh/superset

Length of output: 73


🏁 Script executed:

# Check package.json for Zod version
fd -t f "package.json" --maxdepth 2 | xargs -I {} grep -l "zod" {} 2>/dev/null | head -5

Repository: superset-sh/superset

Length of output: 46


🏁 Script executed:

# Read the file under review to see actual content
cat -n apps/desktop/src/lib/trpc/routers/tasks/index.ts | head -40

Repository: superset-sh/superset

Length of output: 1305


🏁 Script executed:

# List packages directory to find relevant shared packages
ls -la packages/ 2>/dev/null

Repository: superset-sh/superset

Length of output: 503


🏁 Script executed:

# Search for taskPriorityValues in the codebase
rg "taskPriorityValues" --type ts --type tsx

Repository: superset-sh/superset

Length of output: 91


🏁 Script executed:

# Search for updateTaskSchema in the codebase
rg "updateTaskSchema" --type ts --type tsx

Repository: superset-sh/superset

Length of output: 91


🏁 Script executed:

# Find Zod version in any package.json
rg '"zod"' --type json

Repository: superset-sh/superset

Length of output: 555


🏁 Script executed:

# Search for taskPriorityValues in packages
rg "taskPriorityValues" packages/ -A 5

Repository: superset-sh/superset

Length of output: 3095


🏁 Script executed:

# Search for updateTaskSchema in packages
rg "updateTaskSchema" packages/ -A 5

Repository: superset-sh/superset

Length of output: 1373


🏁 Script executed:

# Look for task-related enums in db package
fd -t f "enums" packages/db/src/

Repository: superset-sh/superset

Length of output: 95


🏁 Script executed:

# Look for task-related schemas in trpc package
fd -t f "schema" packages/trpc/src/

Repository: superset-sh/superset

Length of output: 103


🏁 Script executed:

# Check the structure of packages/db
ls -la packages/db/src/schema/ 2>/dev/null

Repository: superset-sh/superset

Length of output: 529


🏁 Script executed:

# Check the structure of packages/trpc
ls -la packages/trpc/src/

Repository: superset-sh/superset

Length of output: 512


🏁 Script executed:

# Read the exact updateTaskSchema from packages/trpc to compare
cat -n packages/trpc/src/router/task/schema.ts

Repository: superset-sh/superset

Length of output: 1477


🏁 Script executed:

# Check if there are imports from shared packages in the desktop app
rg "import.*from.*packages" apps/desktop/src/lib/trpc/ -A 2

Repository: superset-sh/superset

Length of output: 46


🏁 Script executed:

# Check tsconfig for alias paths to understand import patterns
cat apps/desktop/tsconfig.json | grep -A 20 "paths"

Repository: superset-sh/superset

Length of output: 285


🏁 Script executed:

# Verify Zod 4.1.13 supports both z.string().url() and z.url()
web_search
Zod 4.1.13 z.string().url() vs z.url() schema methods

Repository: superset-sh/superset

Length of output: 253


🌐 Web query:

Zod 4.1.13 z.string().url() method support

💡 Result:

Yes — in Zod v4 (including 4.1.13) z.string().url() still exists and works, but it is deprecated in favor of the new top-level z.url() API. The method-form remains for backward compatibility but is slated for removal in the next major release. The URL check uses the native URL constructor (so platform differences like React Native’s URL behavior can affect validation). [1][2][3]

Sources:

  • Zod v4 release notes / changelog (top-level z.url(), method forms deprecated). [1]
  • Zod migration/changelog details (z.string() format methods deprecated; keep working but deprecated). [2]
  • React Native / StackOverflow note: URL constructor differences can make z.string().url() accept values you might expect to fail. [3]

Remove code duplication by importing from shared packages.

Both taskPriorityValues (line 5) and updateTaskSchema (lines 7-20) are duplicated from shared packages:

  • taskPriorityValues is defined in packages/db/src/schema/enums.ts
  • updateTaskSchema is defined in packages/trpc/src/router/task/schema.ts

This creates a maintenance burden where schema changes in shared packages won't propagate here, risking inconsistencies. Import these instead:

import { taskPriorityValues } from "@superset/db/enums";
import { updateTaskSchema } from "@superset/trpc/router/task/schema";

Alternatively, if the goal is to avoid validation in shared packages per commit context, consider re-exporting from the desktop layer without duplication.


Line 16: Use deprecated z.url() instead of z.string().url().

The z.string().url() method is deprecated in Zod 4.1.13 in favor of the standalone z.url() schema. While it still works, it's marked for removal in the next major version. Update to:

-	prUrl: z.string().url().nullable().optional(),
+	prUrl: z.url().nullable().optional(),
🤖 Prompt for AI Agents
In apps/desktop/src/lib/trpc/routers/tasks/index.ts around lines 5 to 20, remove
the duplicated local definitions and import the shared constant and schema
instead: replace the local taskPriorityValues and updateTaskSchema with imports
from packages (import taskPriorityValues from "@superset/db/enums" and import
updateTaskSchema from "@superset/trpc/router/task/schema"), and update the prUrl
field to use Zod's standalone url schema (z.url()) rather than z.string().url();
ensure imports are added at the top and remove the duplicated const and schema
definitions so the file relies on the shared, single source of truth.

@saddlepaddle saddlepaddle merged commit 4c6f71c into main Dec 28, 2025
22 of 23 checks passed
@Kitenite Kitenite deleted the fix/desktop-posthog-env branch December 28, 2025 20:10
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