refactor(deploy): extract deploy target resolution and auto-update rules#1254
refactor(deploy): extract deploy target resolution and auto-update rules#1254gu-stav wants to merge 1 commit into
Conversation
📦 Bundle Stats —
|
| Metric | Value | vs main (def5e11) |
|---|---|---|
| Internal (raw) | 2.7 KB | - |
| Internal (gzip) | 1.0 KB | - |
| Bundled (raw) | 11.16 MB | - |
| Bundled (gzip) | 2.10 MB | - |
| Import time | 861ms | -1ms, -0.1% |
bin:sanity
| Metric | Value | vs main (def5e11) |
|---|---|---|
| Internal (raw) | 782 B | - |
| Internal (gzip) | 423 B | - |
| Bundled (raw) | 9.87 MB | - |
| Bundled (gzip) | 1.78 MB | - |
| Import time | 2.22s | -18ms, -0.8% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @sanity/cli-core
Compared against main (def5e11e)
| Metric | Value | vs main (def5e11) |
|---|---|---|
| Internal (raw) | 106.7 KB | - |
| Internal (gzip) | 26.7 KB | - |
| Bundled (raw) | 21.72 MB | - |
| Bundled (gzip) | 3.46 MB | - |
| Import time | 764ms | -11ms, -1.5% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — create-sanity
Compared against main (def5e11e)
| Metric | Value | vs main (def5e11) |
|---|---|---|
| Internal (raw) | 908 B | - |
| Internal (gzip) | 483 B | - |
| Bundled (raw) | 931 B | - |
| Bundled (gzip) | 491 B | - |
| Import time | ❌ ChildProcess denied: node | - |
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit faad45d. Configure here.
| reason: 'app-not-found', | ||
| type: 'invalid', | ||
| } | ||
| } |
There was a problem hiding this comment.
appId beaten by host validation
Medium Severity
For external studio deploys, resolveStudioDeployTarget normalizes and validates studioHost before it looks up deployment.appId. A stale or invalid studioHost can trigger invalid-host even when appId would resolve an existing application, which breaks the intended appId-over-host precedence.
Reviewed by Cursor Bugbot for commit faad45d. Configure here.
Coverage Delta
Comparing 6 changed files against main @ Overall Coverage
|
074e2b7 to
17d7b54
Compare
The studio and app deploy commands had grown into long, interleaved functions. Each deploy now runs through a single createStudioDeployment / createAppDeployment that validates, prepares and ships the deployment, reporting through a checks seam, so the commands read as one clear call. Consolidate the deploy modules into logical homes: - deployChecks owns the checks seam, the shared step helpers and the verdict→target mapping (checkStudioTarget/checkAppTarget). resolveDeployTarget owns the verdicts — it already held the --url/studioHost/appId precedence and external-URL validation, so it supersedes the inline resolveAppHost. - findUserApplication merges the two interactive adapters; createUserApplication merges the two interactive creators. - Auto-update rules get one home in resolveAutoUpdates/getAutoUpdateIssueMessage. Move workbench-specific validation out of the CLI: viewDeployment goes into @sanity/workbench-cli, exposed through the workbench object. No behavior change for real deploys — the integration deploy tests pass unchanged.
17d7b54 to
2a4579f
Compare


Description
The studio and app deploy commands had grown into long, interleaved functions — validation, prompting, building, schema upload, packaging and reporting all in one body. Hard to follow, and impossible to reuse for a read-only check.
Each deploy now runs through a single
createStudioDeployment/createAppDeploymentthat validates, prepares and ships the deployment, reporting through a checks seam — so the commands read as one clear call, and the same sequence can back a read-only--dry-run(follow-up #1255).Consolidate the deploy modules into logical homes:
deployChecksowns the checks seam, the shared step helpers, and the verdict→target mapping (checkStudioTarget/checkAppTarget).resolveDeployTargetowns the verdicts — it already held the--url/studioHost/appId precedence and external-URL validation, so it supersedes the inlineresolveAppHost.findUserApplicationmerges the two interactive adapters;createUserApplicationmerges the two interactive creators.resolveAutoUpdates/getAutoUpdateIssueMessage.Move workbench-specific validation out of the CLI:
viewDeploymentgoes into@sanity/workbench-cli, exposed through the workbench object.No behavior change for real deploys.
What to review
createStudioDeployment/createAppDeploymentagainst the previous flow — prompts, spinners, error messages and exit codes should be unchanged.findUserApplication/createUserApplicationmodules and the verdict→target mapping indeployChecks.viewDeploymentnow living in@sanity/workbench-cli.Testing
The integration deploy tests pass unchanged. New unit tests cover the checks seam and the verdict→target mapping.