feat(app): revised deploy path#24
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughThis PR adds branch- and framework-aware deploy resolution, new CLI flags ( ChangesApp deploy with local pin binding and context resolution
🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/product/command-spec.md (1)
74-82:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDocument env override precedence in context resolution.
PRISMA_PROJECT_ID/PRISMA_APP_IDoverride behavior is missing from the Project/App resolution orders, so the public contract is incomplete for CI/headless usage.📝 Suggested doc update
Commands resolve project context in this order: 1. explicit `--project <id-or-name>` when present -2. durable platform mapping when available -3. remembered local project context, revalidated against platform data -4. `package.json` name matched exactly against accessible project id, name, or slug -5. unambiguous project creation for commands that are allowed to create projects -6. prompt in interactive mode, or structured failure in `--json` / `--no-interactive` mode +2. `PRISMA_PROJECT_ID` when set +3. durable platform mapping when available +4. remembered local project context, revalidated against platform data +5. `package.json` name matched exactly against accessible project id, name, or slug +6. unambiguous project creation for commands that are allowed to create projects +7. prompt in interactive mode, or structured failure in `--json` / `--no-interactive` mode Preview app commands that need an app resolve it in this order: 1. `--app <name>` -2. locally selected app for the resolved project when it still exists -3. inferred app name from `package.json#name` -4. current directory name -5. create the inferred app when no existing app matches -6. interactive picker only when multiple matching apps make the target ambiguous -7. `APP_AMBIGUOUS` in non-interactive or `--json` mode when unresolved +2. `PRISMA_APP_ID` when set +3. locally selected app for the resolved project when it still exists +4. inferred app name from `package.json#name` +5. current directory name +6. create the inferred app when no existing app matches +7. interactive picker only when multiple matching apps make the target ambiguous +8. `APP_AMBIGUOUS` in non-interactive or `--json` mode when unresolvedAlso applies to: 89-97
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/product/command-spec.md` around lines 74 - 82, The docs omit environment-variable overrides: add PRISMA_PROJECT_ID and PRISMA_APP_ID into the context-resolution precedence so they are considered (immediately after an explicit --project <id-or-name> flag), shift subsequent steps down accordingly, and mirror the same change in the equivalent section later in the file; ensure the text explicitly names PRISMA_PROJECT_ID / PRISMA_APP_ID and how they interact with --project, durable platform mapping, remembered local context, package.json name matching, creation, and interactive/JSON fallback.packages/cli/src/presenters/project.ts (1)
119-138:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMissing case for "directory-name" projectSource.
The
formatProjectSourceswitch handles "package-name" but not "directory-name", which is a validInferredTargetNameSourcethat can be assigned toprojectSourcevia the resolution flow (e.g., when a project is created from the directory name).If
projectSourceis "directory-name", the function will reach the end without matching any case. In TypeScript strict mode withnoImplicitReturns, this would be a compile error, but if not enforced, it returnsundefined.Proposed fix
case "package-name": return "package name"; + case "directory-name": + return "directory name"; case "created": return "created";🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli/src/presenters/project.ts` around lines 119 - 138, The switch in formatProjectSource is missing the "directory-name" case causing undefined returns; update formatProjectSource (which takes ProjectShowResult["resolution"]["projectSource"]) to include case "directory-name" and return a human-readable label (e.g., "directory name") and ensure the switch is exhaustive so the function always returns a string.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/product/command-spec.md`:
- Line 480: The docs for the `prisma-cli app deploy` command were updated to
remove the `--entry <path>` flag but the CLI still exposes `--entry`, causing
spec/CLI drift; update the command signature in docs/product/command-spec.md to
include `--entry <path>` (or, if the flag was intentionally removed, update the
CLI implementation to remove the `--entry` flag from the `prisma-cli app deploy`
command) so the documentation and the actual CLI flags for `prisma-cli app
deploy --project --app --branch --framework --http-port --env` match; reference
the `--entry` flag and the `prisma-cli app deploy` command when making the
change.
In `@packages/cli/src/controllers/app.ts`:
- Around line 2012-2039: The detection regex in detectNextConfig currently only
matches output: "standalone" and can miss template literals; update the regex
used in detectNextConfig (the /\boutput\s*:\s*["']standalone["']/ test) to also
accept backtick-quoted values and tolerate surrounding whitespace (e.g., match
output: `standalone` as well as "standalone" and 'standalone'); keep behavior
unchanged for non-literal values (variables) and leave the rest of the function
logic intact.
- Line 219: The second call to assertSupportedEntrypoint after
maybeCustomizeDeploySettings is redundant because maybeCustomizeDeploySettings
only switches frameworks within DEPLOY_FRAMEWORKS (nextjs, hono, tanstack-start)
which already have valid buildType values; remove the duplicate
assertSupportedEntrypoint(framework.buildType, options?.entrypoint, "deploy")
that appears after maybeCustomizeDeploySettings and instead add a short
clarifying comment next to maybeCustomizeDeploySettings (and/or above
DEPLOY_FRAMEWORKS) stating that customization is limited to those frameworks and
thus the second assertion is unnecessary; reference the functions/assertion
names assertSupportedEntrypoint, maybeCustomizeDeploySettings and the
DEPLOY_FRAMEWORKS constant when making the change.
- Around line 1899-1903: The empty catch block that checks (error as
NodeJS.ErrnoException).code !== "EISDIR" && !== "EACCES" currently swallows all
other errors; update that catch to log unexpected errors instead of ignoring
them: inside the catch (error) block keep the existing check for EISDIR/EACCES
but for any other error call the CLI logger (e.g., processLogger.trace or
processLogger.debug) with the error and a short context message so unexpected
I/O or permission errors are visible while still allowing the code to "try the
normal directory shape below" as before.
---
Outside diff comments:
In `@docs/product/command-spec.md`:
- Around line 74-82: The docs omit environment-variable overrides: add
PRISMA_PROJECT_ID and PRISMA_APP_ID into the context-resolution precedence so
they are considered (immediately after an explicit --project <id-or-name> flag),
shift subsequent steps down accordingly, and mirror the same change in the
equivalent section later in the file; ensure the text explicitly names
PRISMA_PROJECT_ID / PRISMA_APP_ID and how they interact with --project, durable
platform mapping, remembered local context, package.json name matching,
creation, and interactive/JSON fallback.
In `@packages/cli/src/presenters/project.ts`:
- Around line 119-138: The switch in formatProjectSource is missing the
"directory-name" case causing undefined returns; update formatProjectSource
(which takes ProjectShowResult["resolution"]["projectSource"]) to include case
"directory-name" and return a human-readable label (e.g., "directory name") and
ensure the switch is exhaustive so the function always returns a string.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: fab7b1be-624c-4281-9359-ec97a1644201
📒 Files selected for processing (18)
docs/product/command-spec.mddocs/product/error-conventions.mddocs/product/output-conventions.mdpackages/cli/src/commands/app/index.tspackages/cli/src/controllers/app.tspackages/cli/src/lib/app/preview-interaction.tspackages/cli/src/lib/project/local-pin.tspackages/cli/src/lib/project/resolution.tspackages/cli/src/presenters/app.tspackages/cli/src/presenters/project.tspackages/cli/src/shell/command-meta.tspackages/cli/src/shell/prompt.tspackages/cli/src/types/app.tspackages/cli/src/types/project.tspackages/cli/tests/app-controller.test.tspackages/cli/tests/app-env-vars.test.tspackages/cli/tests/app.test.tspackages/cli/tests/project.test.ts
💤 Files with no reviewable changes (1)
- packages/cli/src/lib/app/preview-interaction.ts
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/product/resource-model.md`:
- Around line 217-220: Update the paragraph about `.prisma/local.json` and
branch resolution to explicitly state that if neither explicit targeting nor
Git-derived branch information is available, deploy resolution falls back to the
`main` branch; mention that the local pin still binds the directory to a
Workspace and Project and that apps are then resolved within that (fallback)
branch to avoid accidental deployment of feature-branch code into services owned
by `main`.
In `@packages/cli/src/lib/app/preview-provider.ts`:
- Around line 550-560: The POST to create compute-service in createBranchApp can
race and return a conflict; update the logic around
client.POST("/v1/compute-services", ...) in createBranchApp to handle 409
Conflict by catching the error (result.error || !result.data), and on 409 call
the existing GET/list endpoint for compute services (or re-fetch by
branchId/displayName) to return the already-created service instead of throwing
apiCallError; only throw apiCallError for non-409 errors or if the subsequent
lookup still fails.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 135f6c8e-bbed-4bcd-b660-0a24f245c06d
📒 Files selected for processing (8)
docs/product/command-spec.mddocs/product/resource-model.mdpackages/cli/src/controllers/app.tspackages/cli/src/lib/app/preview-provider.tspackages/cli/src/lib/project/local-pin.tspackages/cli/src/presenters/project.tspackages/cli/tests/app-controller.test.tspackages/cli/tests/app-provider.test.ts
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
--framework/--branch, keep--build-typeas legacy passthrough, and default runtime HTTP port to3000.Adds the J1 local resolution pin model for app deploy.
.prisma/local.jsonafter the first successful deploy.PRISMA_PROJECT_ID/PRISMA_APP_IDenv overrides.LOCAL_STATE_STALEwhen the local pin points at deleted/inaccessible platform state..prisma/for the per-user local pin.Linear
Verification
pnpm --filter @prisma/cli buildpnpm --filter @prisma/cli test