feat(cli): send the project name as logicalId on project create - #289
Closed
kristof-siket wants to merge 1 commit into
Closed
kristof-siket wants to merge 1 commit into
kristof-siket wants to merge 1 commit into
Conversation
`project create <name>` is a user naming a project, which is a declaration, so the CLI now sends the name as the project's logicalId when it fits the format the Management API validates (^[a-z0-9][-_a-z0-9]*$). A name outside that format creates the project as before, with no logicalId. The provider now posts to /v1/projects itself, because ComputeClient.createProject does not forward logicalId. `project link` still sends no logicalId. A duplicate logicalId in the workspace returns 409, which the existing PROJECT.CREATE_FAILED mapping already shows with the API's reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
commit: |
Contributor
Author
|
Closing without merging. A project's logical id is assigned only by a declaration, such as a Composer module or the Console connect flow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Prisma Data Platform records a declared identity,
logicalId, on projects. The rule is that only a declaration assigns a logical id.prisma project create <name>is a user explicitly naming a project, so it counts as a declaration. This is the CLI half of the platform change in prisma/pdp-control-plane#5480. The Management API already acceptslogicalIdonPOST /v1/projectsin production.What changed
project createsends the name aslogicalIdwhen the name fits the format the API validates for a project logical id:^[a-z0-9][-_a-z0-9]*$(fromProjectCreateInputSchemainservices/management-api/models/v1/projects.ts; there is no length limit). A name outside that format creates the project as before, with nologicalId, no error, and no warning./v1/projectsitself.ComputeClient.createProjectin@prisma/compute-sdk0.43.0 (the latest release) does not forwardlogicalId. The request body is otherwise the same (name,createDatabase: false,region). A failed request still surfaces the API's message, and it now keeps the HTTP status on the error, so the existing 401/403 permission fix keeps working.project linkis unchanged. It sends nologicalIdwhen it creates a project from the picker.project createwith the same logical id in a workspace returns 409 (A project with logicalId "<name>" already exists in this workspace). The existingPROJECT.CREATE_FAILEDmapping already shows that reason and points atproject listandproject link, so no new error handling was added.Tests
packages/cli/tests/project.test.ts:logicalIdMy App,My-App,_app,app.v2) send nonePROJECT.CREATE_FAILEDwith the API's reasonproject linkpicker test now checks the exact request body, so it fails iflinkever sends alogicalId.pnpm lint,pnpm typecheck, andpnpm --filter @prisma/cli test(64 files, 1027 passed, 2 skipped) all pass.PRISMA_E2E_SERVICE_TOKEN, which was not available locally, so it runs in CI only. Its scratch project names are lowercase and unique, so they now also send alogicalIdagainst the real API.🤖 Generated with Claude Code