Skip to content

Clarify project workspace mismatch in CLI resolver#67

Merged
luanvdw merged 1 commit into
mainfrom
feat/explicit-project-context-resolution
Jun 4, 2026
Merged

Clarify project workspace mismatch in CLI resolver#67
luanvdw merged 1 commit into
mainfrom
feat/explicit-project-context-resolution

Conversation

@luanvdw
Copy link
Copy Markdown
Member

@luanvdw luanvdw commented Jun 4, 2026

Overview

This improves the CLI project-resolution failure mode when a local .prisma/local.json pin belongs to a different workspace than the current auth session. It also makes project list expose project IDs in human output so users can match errors and recovery commands to listed projects.

Changes

  • Adds LOCAL_PROJECT_WORKSPACE_MISMATCH to the project error contract and emits it before listProjects() when the local pin workspace differs from the active workspace.
  • Preserves explicit --project and PRISMA_PROJECT_ID precedence so those overrides still bypass the local pin.
  • Updates project list human output to render name and id columns while keeping the JSON shape unchanged.
  • Documents that the branches column is deferred until /v1/projects can return branch counts in the same response, avoiding per-project branch-list calls.
  • Adds resolver-level and CLI-level coverage for the mismatch path, override precedence, and list output behavior.

Why

The previous LOCAL_STATE_STALE/not-found style failure hid the real problem: the checkout was linked to one workspace while the CLI session was scoped to another. This keeps the fix local and cheap by using only the existing local pin and auth workspace state, with no extra project-list network hop on the mismatch path.

Validation

  • pnpm --filter @prisma/cli exec vitest run tests/project.test.ts tests/project-resolution.test.ts
  • pnpm --filter @prisma/cli exec vitest run tests/app-controller.test.ts
  • pnpm --filter @prisma/cli test

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Warning

Review limit reached

@luanvdw, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 2 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a7840b5f-d372-4c41-8766-c47180973f6f

📥 Commits

Reviewing files that changed from the base of the PR and between 3e444d8 and a4d3e39.

📒 Files selected for processing (7)
  • docs/product/command-spec.md
  • docs/product/error-conventions.md
  • docs/product/output-conventions.md
  • packages/cli/src/lib/project/resolution.ts
  • packages/cli/src/presenters/project.ts
  • packages/cli/tests/project-resolution.test.ts
  • packages/cli/tests/project.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/explicit-project-context-resolution
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/explicit-project-context-resolution

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.

@luanvdw luanvdw self-assigned this Jun 4, 2026
@luanvdw luanvdw marked this pull request as ready for review June 4, 2026 07:56
@luanvdw luanvdw force-pushed the feat/explicit-project-context-resolution branch from 7a944ca to a4d3e39 Compare June 4, 2026 09:43
@luanvdw luanvdw merged commit c7e7b86 into main Jun 4, 2026
5 checks passed
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