Skip to content

fix(prisma-cloud): the deploy checks platform variables against the variable group the branch receives - #450

Draft
wmadden-electric wants to merge 6 commits into
mainfrom
feat/preflight-reads-resolved-variables
Draft

wmadden-electric wants to merge 6 commits into
mainfrom
feat/preflight-reads-resolved-variables

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

An app names two platform variables. Its staging environment is on a branch that receives a custom variable group named staging, and neither variable is set there:

$ prisma deploy --environment staging
Deploy failed. 1 platform variable a service needs has no value:
  - EMAIL_API_KEY  (read by service "shop.email", field "apiKey")

Set it on the platform, then deploy again:
  - Set EMAIL_API_KEY in the variable group "staging" in the Prisma Console.

Today's Composer looks for EMAIL_API_KEY in the preview class instead. If it is there, the deploy succeeds and the service starts without it. If it is only in staging, the deploy fails although the value is set.

This is a draft until the platform's resolved-variables read is live in production. See "Before this can merge".

What changes

Preflight asks the platform what the environment's branch receives, in one call, and stops looking up each variable by class.

  1. One read. GET /v1/projects/{projectId}/resolved-variables?branchId=…, when the app names at least one platform variable. For production, the branch is the project's default branch. An app that names none makes no call.

  2. Present, unset, refused. A name in the answer is present, whatever its source. A name not in it is unset, and the existing rule decides whether a service requires it. A name the platform manages itself is refused, as before.

  3. Redeploy triggers use the updatedAt of the entry the branch actually receives, so a value changed in a custom group replaces the services that read it.

  4. Hints follow the group the branch receives.

    Group class Hint
    production prisma project env add 'NAME=<value>' --project <id> --role production
    preview prisma project env add 'NAME=<value>' --project <id> --role preview
    custom Set NAME in the variable group "<name>" in the Prisma Console.

    The --branch <environment> command is no longer suggested: it creates a branch override, which the platform is removing.

  5. A failed read fails the deploy, with no fallback to the old lookup. The message names the call, the project and the branch. A 404 adds that the platform may not offer this read yet.

  6. An answer that says there is more to fetch fails the deploy, telling the user to upgrade Composer. A release that read only the first page would report set variables as missing.

Why

Prisma Cloud is replacing its two variable classes with variable groups. A branch receives exactly one group, and a custom group does not combine with preview. The old lookup cannot name the branch, so on a custom group it is wrong in both directions. The decision record for platform variables is rewritten in place for the new model, with the glossary, the platform data model, the deploy guide and the skill.

Before this can merge

  1. The read must be live in production. Every merge to main publishes a dev build, and this preflight calls the read on every deploy that names a platform variable. Until then the Deploy, verify, destroy check on this pull request fails: it deploys to the real platform, which answers the read with 404.
  2. A defect on the platform's branch must be fixed first. A variable written without a groupId, which is what prisma project env add --role preview does, is stored with no group. A deployment receives it, but resolved-variables does not list it (resolved-variables.ts filters on groupId only; setConfigVariable.ts stores input.groupId ?? null). This preflight would report such a variable missing, and the hint would write another row the read cannot see.
  3. One more QA run against the real read, and a check whether prisma variable add … --group has shipped. If it has, the custom-group hint becomes that command.

Known gap

A value set on one service in Console is not seen: preflight asks about the branch, not about each service. A variable a service requires that is set only on that service fails the deploy as missing. The guide says so. Recorded as later work.

How it was checked

  • Tests: the preflight tests are rewritten against a fake of the new read. Each new test was seen to fail with its behaviour removed.
  • Design review, and two rounds of system-design and code review.
  • Manual QA: real deploys of a test app with two platform variables against the real platform, through a proxy that answered only the new read. Checked: one read to the right branch and no per-variable lookups; a missing required variable stops the deploy before anything changes; production, preview and custom-group hints; a changed updatedAt replaces the service and an unchanged redeploy does not; 404, 500, 401, a body that is not JSON and a paged answer each give a message that names the call and contains no value. The test project was deleted afterwards.

Alternatives considered

  • Fall back to the old lookup when the read fails. Rejected: the old lookup is what gives the wrong answers, and it would bring them back silently.
  • Send no branchId for production. Rejected: the deploy already holds the default branch's id, and sending it removes a platform default Composer would depend on.
  • Suggest prisma variable add … --group for a custom group. Not possible yet: the command does not exist.
  • Fail on any pagination field. Rejected in review: a complete answer in the platform's standard list envelope would then fail every deploy.

This is the second of three pull requests that make Composer work with variable groups. The design is in .drive/projects/variable-groups-compat/design.md.

Agent: democritus-22

🤖 Generated with Claude Code

wmadden-electric and others added 6 commits November 20, 2026 22:39
…ariable group the branch receives

Preflight now makes one read, GET /v1/projects/{projectId}/resolved-variables, for the environment's branch (the default branch for production), in place of one list call per name filtered by class. A name is present when the read lists it, whatever group or override it comes from, so a value set in a custom variable group is seen.

A failed read, or an answer that is paged, fails the deploy; there is no fallback to the old lookup, which gave wrong answers on a custom group. The commands for a missing variable follow the group's class, and the command that writes a branch override is no longer suggested.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…t's branch receives

The guides, the skill and the decision on platform variables now describe variable groups: each branch receives one group, the deploy reads once what the branch receives, and the hint for a missing variable follows the group's class. The command that writes a branch override is no longer suggested, and the guide says the deploy does not see a value set on one service in Console. The glossary gains variable group and service variable.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…call, and a complete list answer is accepted

Every failure of the resolved-variables read now names the call, the project and the branch: an error status with or without a body, a network failure, and a body that is not JSON or not the expected shape. Only a 404 says the platform may not offer the read yet. The deploy fails on a paged answer only when it says there is more, so a complete answer in the platform's list envelope passes. The custom-group hint names the group in double quotes, and core documents each hint line as a shell command where one exists, otherwise an instruction. The container carries the branch a deploy targets as deployBranchId.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…as the platform's model

The glossary, the platform data model and the platform-variable decision now agree, in the present tense. A service variable belongs to one Composer service in one environment and is set only when a deployment is created. Lines that said a deployment receives every variable of its class now say its branch's group, and the failure and paging rules match the code.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…status and one short line of the body

The read now asks for its body as text and parses it itself, so a 200 whose body is not JSON names HTTP 200. An error body is shown as at most one short line, never a whole HTML page. A thrown error that carries a status names it, and the sentence ends with one full stop whatever the error's own punctuation. The container defines the branch a deploy targets once, as deployBranchId, and alchemyStage refers to it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…nd the design records the review corrections

The data model's entity graph, edges and version-create row now describe groups, overrides and service variables as one model. The glossary entry for a variable on the platform says plainly which writes the platform will reject. The error table and ADR-0064 match the failure messages. The design records that only an answer saying it has more fails, that only a 404 says the read may be missing, and that the custom-group hint is a sentence; deferred.md and plan.md record what is left.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
@prisma-gizmo

prisma-gizmo Bot commented Nov 20, 2026

Copy link
Copy Markdown

⏸️ Gizmo skipped the automatic review of 131d933 because this pull request is a draft. It will review automatically once the PR is marked ready for review.

  • Check this box to request a one-time review of the current commit.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 131d933

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