Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/desktop/electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ export default defineConfig({
"process.env.SENTRY_DSN_DESKTOP": JSON.stringify(
process.env.SENTRY_DSN_DESKTOP,
),
// PostHog - must match renderer for analytics in main process
"process.env.NEXT_PUBLIC_POSTHOG_KEY": JSON.stringify(
process.env.NEXT_PUBLIC_POSTHOG_KEY,
),
"process.env.NEXT_PUBLIC_POSTHOG_HOST": JSON.stringify(
process.env.NEXT_PUBLIC_POSTHOG_HOST,
),
},

build: {
Expand Down
19 changes: 18 additions & 1 deletion apps/desktop/src/lib/trpc/routers/tasks/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
import { updateTaskSchema } from "@superset/trpc";
import { apiClient } from "main/lib/api-client";
import { z } from "zod";
import { publicProcedure, router } from "../..";

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(),
});
Comment on lines +5 to +20
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.


export const createTasksRouter = () => {
return router({
update: publicProcedure
Expand Down
3 changes: 0 additions & 3 deletions packages/trpc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
export type { AppRouter, RouterInputs, RouterOutputs } from "./root";
export { appRouter, createCaller } from "./root";

// Schemas
export { createTaskSchema, updateTaskSchema } from "./router/task/schema";

// tRPC utilities
export {
adminProcedure,
Expand Down
Loading