Skip to content

refactor(prisma-cloud): deploy identity has one reader in the extension#137

Closed
wmadden-electric wants to merge 3 commits into
mainfrom
tml-3057-deploy-identity-one-reader
Closed

refactor(prisma-cloud): deploy identity has one reader in the extension#137
wmadden-electric wants to merge 3 commits into
mainfrom
tml-3057-deploy-identity-one-reader

Conversation

@wmadden-electric

Copy link
Copy Markdown
Contributor

Part 1 of Decouple CLI from Prisma Cloud (TML-3057). Behavior-invariant refactor inside packages/1-prisma-cloud/1-extensions/target/ — prep for part 2, which moves container resolution behind the extension descriptor and deletes the cli → lowering cross-domain exception.

What changes

  • CloudApplication (the application hook's product) now carries branchId beside projectId; isCloudApplication checks the new field.
  • New cloudApplicationOf(application) narrow-or-throw; projectIdOf delegates to it.
  • The node descriptors (postgres, compute, prisma-next) read branchId from the narrowed application product instead of from ResolvedCloudOptions.

Why

After this PR, control.ts's application.provision is the only consumer of the env-fed projectId/branchId in the extension. Part 2 swaps that single site to the opaque container context the CLI will hand through the extension hooks — one edit instead of six.

Verification

  • grep -rn "o\.projectId\|o\.branchId" packages/1-prisma-cloud/1-extensions/target/src/descriptors/ → empty.
  • pnpm typecheck && pnpm test && pnpm lint && pnpm lint:casts && pnpm lint:deps all green; cast-ratchet delta 0.
  • No user-facing change; no behavior change (the descriptors read the same value via a different path — application.provision copies o.branchId into the product).

🤖 Generated with Claude Code

…pplicationOf guard

projectIdOf now delegates to cloudApplicationOf, and application.provision
returns branchId alongside projectId — the first step toward every
descriptor reading deploy identity through the application product instead
of ResolvedCloudOptions directly.

Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…onOf, not ResolvedCloudOptions

postgres.ts, compute.ts, and prisma-next.ts stop reading o.branchId
directly; they read the narrowed application product instead, so
exports/control.ts becomes the only remaining consumer of the env-fed id.

Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
Every manually-constructed ctx.application stub now carries branchId
alongside projectId, matching the real application product shape; the
provision-hook assertions and isCloudApplication negative cases cover the
new field.

Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@prisma/composer@137
npm i https://pkg.pr.new/@prisma/composer-prisma-cloud@137

commit: 4637892

@wmadden-electric

Copy link
Copy Markdown
Contributor Author

Folded into #138 — the split was needless ceremony for a 60-line prep refactor; #138 now carries the whole change against main.

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.

2 participants