fix(desktop): packaged server ships zod for @cursor/sdk 1.0.38#25841

merged1
main
GitHub fork: fix/server-zod-peer
opened25d agobyJjason5545
View on GitHubTwo-way sync enabledPR last imported 25d ago

Problem

Since #21074 bumped @cursor/sdk to 1.0.38, the packaged desktop backend exits at startup with Cannot find module 'zod/v4' (required from app.asar/node_modules/@cursor/sdk). 1.0.38 moved zod to a peer dependency; zod is a runtime external of the server bundle, but the desktop stage only receives externals that apps/server lists, so app.asar ships @cursor/sdk without zod. Details and the stack trace are in #25840.

Change

  • apps/server depends on zod directly (^4.6.5, the version already in the lockfile; the lockfile gains only the importer entry).
  • A test in scripts/lib/cli-external-packages.test.ts walks the staged externals from apps/server's dependencies through their dependencies and optionalDependencies, and fails when a non-optional peer of a staged package is not itself staged. The next SDK bump that turns a dependency into a peer fails here instead of in a packaged app.

Scope and approval

Fixes #25840 (not triaged yet). This is a one-line dependency fix for a startup crash that the next nightly from main would ship, plus the regression test for it, so I believe it fits the small, focused fix exception.

Verification

  • The new test on upstream/main (d033768ec7) without the fix fails with exactly one finding: ["@cursor/sdk -> zod"]. With the fix, vp test run scripts/lib/cli-external-packages.test.ts: 12 passed.
  • vp run check:changed: lint, knip, typecheck (36 packages), graphql and tests (20 files, 737 tests) pass; format passed after vp fmt.
  • Packaged app: the same apps/server change on a fork that merged main at 6bbb2d8508. Before it, the macOS (Apple Silicon) desktop nightly's backend failed 12 times in a row with the error above. After it, app.asar contains node_modules/zod beside @cursor/sdk and the backend starts and serves HTTP 200. The fork's changes to the desktop packaging script are limited to dev signing and a locale.
  • Not checked: Linux and Windows packages, and the npx t3 CLI archive (same external selection, no electron-builder).

Claude Opus 5.5 (claude-opus-5-5) via Claude Code in T3 Code

Checks

25 successful · 10 skipped
All checks passed
f9f42fd

Added 1 commit

  • fix(desktop): packaged server ships zod for @cursor/sdk 1.0.38f9f42fd
Synced from GitHub

Approvability

Verdict: Approved at f9f42fd

Macroscope's review found this PR approvable — This is a narrowly scoped dependency and lockfile update with test-only validation, confined to the repository’s ignored paths. It does not change product defaults or suppress static-analysis diagnostics; the runtime effect is limited to ensuring the packaged server includes its required dependency.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review.

External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between e5f2e5dbbc5c7864aefdeccaca18284d023edc37 and f9f42fdb2b41f81f8c5a4cd8b4271ad2f3b09da6.

External image Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
External image Files selected for processing: 2
  • apps/server/package.json
  • scripts/lib/cli-external-packages.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The server package adds zod as a dependency. A new test checks that staged runtime dependencies include required peer dependencies and ignores peers marked optional.

Changes: Server peer dependency staging

Layer / File(s)Summary
Declare and validate staged peer dependencies
apps/server/package.json, scripts/lib/cli-external-packages.test.ts
The server adds zod. The test follows staged packages’ dependencies and optional dependencies, and flags required peers that are not staged. Optional peers are excluded from missing-peer failures.

Priority: External image Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • pingdotgg/t3code#25840 reports a packaged desktop backend failure caused by missing zod; this change adds the stated workaround and tests required peer staging.

Possibly related PRs

  • pingdotgg/t3code#25103: It changes the dependency-closure test that this PR extends to check required peer dependencies.

Suggested reviewers: juliusmarminge, t3dotgg

Merge Risk: External image Minimal · up to f9f42

No actionable merge-blocking issue was established for the dependency or its staging test. The change is ready for normal merge checks.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title "fix(desktop): packaged server ships zod for @cursor/sdk 1.0.38" is a conventional commit title that names the main change: the packaged desktop server now ships the zod dependency that @cur…
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Description checkPassedThe pull request description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the startup failure, the dependency and test changes, the small-fix exce…
Full details: Title check

Explanation

The title "fix(desktop): packaged server ships zod for @cursor/sdk 1.0.38" is a conventional commit title that names the main change: the packaged desktop server now ships the zod dependency that @cursor/sdk 1.0.38 needs. The changeset adds zod (^4.6.5) to apps/server/package.json and adds a regression test in scripts/lib/cli-external-packages.test.ts. The title matches both parts. It is specific and under 70 characters.

Full details: Description check

Explanation

The pull request description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the startup failure, the dependency and test changes, the small-fix exception, detailed verification results, untested platforms, and the agent used.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.