Skip to content

feat(prisma-cloud)!: a service's input document travels in its artifact, so it is no longer limited to a variable's 8 KB - #432

Merged
wmadden-electric merged 3 commits into
mainfrom
claude/config-in-artifact
Nov 17, 2026
Merged

wmadden-electric merged 3 commits into
mainfrom
claude/config-in-artifact

Conversation

@wmadden-electric

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

Copy link
Copy Markdown
Contributor

feat(prisma-cloud)!: a service's input document travels in its artifact, so it is no longer limited to a variable's 8 KB


At a glance

Take a service shop.web whose input is { siteName: 'Shop', stripeKey }, where stripeKey is the platform secret STRIPE_SECRET_KEY. At deploy, Composer serializes that input as one JSON text, the service's input document.

Before this PR, prisma deploy writes these environment variables for the service on the Prisma Cloud branch. The first one is the input document:

COMPOSER_SHOP_WEB_INPUT      {"siteName":"Shop","stripeKey":{"$platform":{"name":"STRIPE_SECRET_KEY","secret":true}}}
COMPOSER_SHOP_WEB_PORT       3000
COMPOSER_SHOP_WEB_ORIGIN     …
COMPOSER_SHOP_WEB_DB_URL     …

After this PR, that variable is gone from the branch:

COMPOSER_SHOP_WEB_PORT       3000
COMPOSER_SHOP_WEB_ORIGIN     …
COMPOSER_SHOP_WEB_DB_URL     …

and the document is in the service's artifact, the tar the deploy uploads, as nested JSON in compute.bootstrap.json:

{
  "moduleEntrypoint": "./main.mjs",
  "appEntrypoint": "./server.mjs",
  "address": "shop.web",
  "inputDocument": {
    "siteName": "Shop",
    "stripeKey": { "$platform": { "name": "STRIPE_SECRET_KEY", "secret": true } }
  }
}

Nothing an app's author writes changes. service.input(), service.load() and service.port() return what they returned before.

What this PR changes

  1. On Prisma Cloud, a deploy writes a Compute service's input document into the service's artifact and creates no variable for it.
  2. A service reads its input document from its artifact. A COMPOSER_<ADDRESS>_INPUT variable left on the branch is ignored.
  3. An input document is no longer limited to 8 KB, the limit on a Prisma Cloud variable's value.
  4. Changing a service's input redeploys that service because its artifact changed, not because a variable changed.
  5. Every other value a service reads at boot is still a variable.
  6. A deployment made before this change cannot be put back into service after the first deploy with it.

The input document, and why it can be in the artifact

A service declares its input with a schema, and the app binds values to it. At deploy, Composer checks the binding against the schema and serializes the result as the input document. It holds the literals the author wrote, and a marker for each value that is only known when the service starts. A marker holds a variable's name, never its value. In the example above, stripeKey is the marker {"$platform":{"name":"STRIPE_SECRET_KEY","secret":true}}, and the service reads the secret itself from its environment at boot.

So the input document is not a secret, and the deploy knows all of it before it creates anything on the platform. Those are the two conditions for writing a value into an artifact: the artifact is packed on the deploying machine before the deploy calls the platform, and it is uploaded and stored with the code. serializeInput, which builds the document, refuses a secret's value in a binding.

Until now the document was one environment variable per service. A variable's value is limited to 8 KB, and the document grows with every field a service declares.

What stays a variable

Value Why it cannot move
Connection parameters of each dependency, such as a database's connection string The platform issues them during the deploy, after the artifact is packed, and most are secrets.
The RPC keys the service accepts, a streams key, the service's own URL Issued or generated during the deploy; the keys are secrets.
Generated secrets Secrets.
port, the only parameter a Compute service declares itself It is not part of the input document. The app binds it to a literal or a deploy-time value, or it takes its default, and the deploy writes it as its own variable. Under prisma dev the local Compute emulator assigns each service its port and the local target writes that variable from it, so the artifact must not fix it.

How the document reaches the service

Composer deploys a service through four hooks of its target: provision, serialize, package and deploy.

  • serialize builds the input document as before and no longer creates a Prisma.EnvironmentVariable for it (packages/1-prisma-cloud/1-extensions/target/src/descriptors/compute.ts).
  • Core now passes serialize's result to package (packages/0-framework/1-core/core/src/control/deploy.ts). Core does not look inside it. The contract of package says it must not write a secret, or a value the deploy has not resolved, into the artifact.
  • package hands the document, as a JSON value, to the artifact packer, which writes it into compute.bootstrap.json as the nested value inputDocument (packages/1-prisma-cloud/0-lowering/lowering/src/compute/artifact.ts). The field can hold the input document and nothing else, and a service that declares no input has no such field. The artifact stays byte-for-byte deterministic.
  • The artifact's bootstrap.js is constant code. It reads compute.bootstrap.json and passes the document to the service's run(), which uses it in place of the COMPOSER_<ADDRESS>_INPUT variable. From there nothing changed.

A deployment has triggers: values whose change makes the deploy replace it. Each variable a service reads is one, and the input document was one while it was a variable. It is not one now, and does not need to be. The artifact's file path contains a hash of its content. A changed input document changes the artifact, so the path changes, and a new path makes the deploy replace the deployment. An unchanged service produces the same bytes and is left alone.

The artifact is the document's only source

The first deploy with this change runs while the previous deploy's COMPOSER_<ADDRESS>_INPUT variable is still on the branch. The deploy deletes that variable only after it has created the new deployment, and Prisma Cloud copies the branch's variables into a deployment when the deployment is created. So the new deployment starts with the old document in its environment.

It must not read it. When the artifact holds a document, run() ignores that variable. The rule stays after the upgrade: a variable left behind for any reason must not win over the artifact.

Under prisma dev

prisma dev runs the same hooks against the local target, the code that plays Prisma Cloud's part on the developer's machine.

  • A service that runs its built artifact reads the document from the artifact, as on Prisma Cloud. The local target reads the same field to decide which platform variables to give the service's process, through a reader that sits next to the packer (readComputeInputDocument).
  • A service that runs a dev server, such as next dev, has no artifact. For it, the input document is still written as a variable in the local target's own store, so its environment is what it was before.
  • If that local store holds an input document for a service that runs its artifact, it is stale and is ignored. Without this, a service switched from a dev server to its artifact restarted once for no reason.

Upgrading

  • The first deploy with this change gives every Compute service a new artifact and a new deployment, then deletes the COMPOSER_<ADDRESS>_INPUT variables. Nothing is migrated and no value is written in two places.
  • A deployment made before the upgrade keeps running until it is replaced.
  • Breaking: putting a deployment made before the upgrade back into service afterwards is not supported. Its artifact holds no input document and its variable is gone.

docs/guides/deploying.md has a section on this.

Design records

One new decision record, docs/design/90-decisions/ADR-0065-a-compute-services-input-document-travels-in-its-artifact.md, states the decision and its alternatives. The records, domain docs, glossary entry, guides and agent skill that said the input document is an environment variable on Prisma Cloud are rewritten in place to say what is true now.

Tests

  • Deploy: deploying a service with an input creates no variable and no trigger for the document, and leaves every other variable and trigger as it was. A platform variable the document names is still a trigger, so changing it on the platform still redeploys its readers. The packed artifact holds the document; the same input gives the same bytes; a changed input gives a different path.
  • Boot: a service reads its input from the artifact with no input variable in its environment; with a different document in the environment, it reads the artifact's; run(address, boot) with no document still reads the environment, which is what a test harness uses.
  • prisma dev: on the real local emulator, a service that runs its artifact receives exactly the platform variables its document names, and a stale document in the local store changes nothing. A dev server receives its document and restarts when it changes.
  • The reader of compute.bootstrap.json: returns the document as a JSON value, returns nothing when the field is absent, and fails for a file that is missing, is not JSON or is not an object.

Checked by hand

Run on 2026-11-17 against Prisma Cloud and under prisma dev, with a two-service app in which each service answers a request with a value from input():

  • Deploy. The branch's variables are ORIGIN, PORT and RPC_ACCEPTED_KEYS for each service, with no _INPUT. Both services answer with their input. The uploaded artifact's compute.bootstrap.json holds inputDocument.
  • One input changed. Only that service's deployment is replaced. Prisma Cloud lists no new version for the other service.
  • Upgrade from released Composer 0.39.0. Deployed with 0.39.0, then with this branch, to the same environment. Both new deployments answer with the document from the artifact while the old variable is still in their environment. The old variables are gone when the deploy finishes.
  • Input removed after the upgrade. With a stale COMPOSER_<ADDRESS>_INPUT variable left on the branch on purpose, the service starts and does not read it.
  • A 12,000-character input. Deploys and boots; this ran while the file still held the document as text; the Deploy, verify and destroy job in CI covers the nested form.
  • prisma dev, with one service running its artifact and one running a dev server. Both read their input, and editing an input restarts only the service that reads it.
  • prisma dev with a stale document in the local store. For a service that runs its artifact, a stale input document written into the local store by hand is not read and is not in the service's environment, both when the artifact holds a document and when the service declares no input. A platform variable that only the stale document names is not given to the service. Nothing restarts when nothing changed.

Alternatives considered

  • Keep every value a variable. A variable's value is limited to 8 KB, and the input document grows with every field.
  • A general map of COMPOSER_ keys in compute.bootstrap.json, laid over the environment at boot. It accepts keys that nothing may put there: every other value is a secret or is issued during the deploy, except port, which the local emulator has to be able to set. A later entry would silently shadow a variable with the same key. And the guarantee that no secret reaches the artifact would rest on which keys happen to be put in an open map, not on a field that can hold only the input document.
  • Write the document into compute.bootstrap.json as a string that contains JSON. That form was left over from the document having lived in a variable. A nested value is readable in the file and needs no second parse.
  • Let a variable win over the artifact. The first deploy after the upgrade would read the previous deploy's document.
  • Write the document to both places for one release. One value would have two sources that can disagree, in support of a rollback that is not supported anyway.
  • Move the service's own parameters too. A Compute service declares one parameter of its own, port, and it has to stay where the local emulator can set it.

Agent: mercury-79
🤖 Generated with Claude Code

…ct, not in a variable

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: aa3106d4-a17c-44b3-b8a9-8ec0648f18c8
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@prisma-gizmo

prisma-gizmo Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

✅ Gizmo reviewed c08e3b5 — posted 0 inline comment(s) this pass.

Open findings: none

Change walkthrough

This delta (on top of the already-reviewed artifact-as-source work) changes the inputDocument field of compute.bootstrap.json from a string holding JSON to a nested JSON value, and rewires every producer, consumer, test, and design record to that shape.

Artifact packer and reader (artifact.ts): packageComputeArtifact accepts the document as an unknown JSON value and writes it inline; readComputeInputDocument now returns the field as a JSON value (one parse of the file instead of two), keeping its missing-file / not-JSON / not-object errors. Byte-determinism still holds because the value is JSON.parse of the text serializeInput produces, preserving its key order.

Target extension: serialize still produces the document as text; the package hook now JSON.parses it (descriptors/compute.ts:348), and ComputeService.run turns it back into text in one place when seeding COMPOSER_<ADDRESS>_INPUT (compute.ts:86) — the round trip input() reads is unchanged for app authors.

Local target (prisma dev): materializeEnv now takes the artifact's document as a value. When an artifact exists, platform variables come only from the artifact's document and the stale env.json row is deleted from the process environment; a service that declares no input resolves to no named variables (collectPlatformMarkers(undefined) walks nothing). Dev servers still get their document as a variable from the local store, parsed through the shared platformVariables helper.

Tests: all fixture/expectation shapes updated (packing, determinism, path-change, hostile keys, descriptor records, emulator env materialization), the obsolete "inputDocument is not a string" reader test was removed to match the inverted contract, and a new test pins that a value passed to run() reads the same through input() as its text in the environment.

Docs: the boot-file example, decision, and alternatives in ADR-0065; ADR-0019's medium description; ADR-0056's env table and run() contract; and core-model.md's artifact layout, run pseudo-code, and package pseudo-code all describe the nested form consistently with the code.

@pkg-pr-new

pkg-pr-new Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: c08e3b5

@prisma-gizmo prisma-gizmo Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New findings: 🟡 1 minor · trace

… calling every failure a missing file

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>

@prisma-gizmo prisma-gizmo Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New findings: none · trace

@prisma-gizmo prisma-gizmo Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No Gizmo finding is open and the head commit has been reviewed. Approving.

…s nested JSON

A Compute artifact's compute.bootstrap.json now holds the service's input
document as a nested JSON value in `inputDocument`, not as a string that
contains JSON. The string form was left over from the time the document
lived in a variable. The nested value is readable in the file and needs no
second parse.

The packer and readComputeInputDocument take and return the value. run()
receives the value and turns it into text in one place, for the environment
input() reads, so input() and dev servers behave as before. The local
target collects the document's platform variables from the value directly.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>

@prisma-gizmo prisma-gizmo Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New findings: none · trace

@prisma-gizmo prisma-gizmo Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No Gizmo finding is open and the head commit has been reviewed. Approving.

@wmadden-electric
wmadden-electric merged commit d6d9ff9 into main Nov 17, 2026
23 of 25 checks passed
@wmadden-electric
wmadden-electric deleted the claude/config-in-artifact branch November 17, 2026 22:14
wmadden-electric added a commit that referenced this pull request Nov 17, 2026
main took ADR-0065 for the input document decision (#432), so the in-process deploy decision is renumbered ADR-0066 and every reference follows it.

A test string the secret scanner flags is built from parts.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added a commit that referenced this pull request Nov 18, 2026
main now holds the deploy work as merged (#405), platform variables declared with variable() (#431) and the input document in the artifact (#432). Files the early deploy draft on this branch shared with #405 take main's version.

prisma dev keeps converging in the prisma process: plain platform variable text and named secrets reach the local target as values, the secret refusal runs before each converge, and no app configuration file is written for dev.

The documents are main's. The dev changes to them are re-applied once the reload design is final.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
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