Repository navigation
Rename stage to environment: prisma deploy --environment, destroy({ environment }) - #390
Conversation
prisma deploy and prisma deploy list take --environment <name>, defaulting to production. --stage is retired through the CLI engine's redirect on deploy, so it fails with CLI.COMMAND_MOVED naming --environment. The destroy operation takes a required environment name instead of a stage/production target and refuses a call without one (DEPLOY.ENVIRONMENT_REQUIRED). Core carries environment names only. The Prisma Cloud extension maps production to the Project's default Branch by isDefault, exactly where a deploy without --stage landed before, and any other name to the Branch with that gitName. A name whose Branch is the default Branch is refused, since it would be production under a second name. prisma dev runs as the environment dev; per-environment local copies are later work. The --report JSON's stage field becomes environment (format version 2). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The deploying guide explains once that on Prisma Cloud an environment is a Branch. The examples' destroy scripts and the deploy-verify-destroy CI action pass --environment explicitly. The deploy and local-dev domain docs describe environments; older decision records keep their history. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The prisma CLI pins its Composer version while the app installs its own Prisma Cloud extension, so the two can differ. An extension older than the CLI reads every environment as production. Core now checks that each resolved container carries the environment it asked for and fails with DEPLOY.CONTAINER_MISMATCH before anything is deployed or destroyed; the extension refuses a request with no environment, from a CLI older than it. A plain name such as production, staging or pr-42 is a valid git ref by construction, so it validates without running git and a deploy still needs no git on PATH. Also from review: the default-Branch refusal reads right for destroy, the report version is pinned at 2, internal names say what they mean, the error registry in ADR-0044 lists the new codes, older records whose examples show the old interface point to ADR-0059, and the guide and skill carry an upgrade note. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
|
✅ Gizmo reviewed cbb8682 — posted 0 inline comment(s) this pass. Open findings: 🟡 1 minor Change walkthroughChange walkthroughThis PR renames "stage" to "environment" everywhere users can see it — Core operations. execute-deploy-destroy.ts and the operation inputs carry Version-skew guard (the latest delta). The final fix commit reworks Prisma Cloud mapping. The lowering's CLI surface. Docs and records. The ADR-0044 registry, deploying guide, skill, both slice specs and the two added round-2 review records are consistent with the implemented codes and behavior; the review records are point-in-time documents whose findings the fix commit addresses. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
commit: |
The released 0.35.0 extension keeps the input object core hands it, so
comparing instance.input.environment always passed while that extension
resolved production from input.stage. Core now checks the container as
the Alchemy child will rebuild it, through deserialize(serialize()); the
0.35.0 deserialize rebuilds { appName, stage } and the check fires. The
failure is DEPS.EXTENSION_INCOMPATIBLE, since it is an installed-version
problem. Verified against an app installed with 0.35.0 from npm.
Also: the default-Branch refusal now applies after a Branch create race,
and the deploy list --stage test asserts the engine's error code.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
There was a problem hiding this comment.
New findings: none · trace
Still open from previous reviews: 🟡 1 minor
Brings in ADR-0059 (environment, not stage), the stage-to-environment rename (#390), the node-addressing close-out (#391), v0.35.0 (#389) and prisma dev --environment (#392). The secrets behaviour follows each environment: the dev preflight keeps its fingerprint key in the environment folder, and deletes a leftover secrets.json both there and in the pre-environment folder. Moving pre-environment state into dev no longer moves secrets.json; it deletes it. Tests pass the environment, and our docs say environment where main renamed stage and environment variables where they mean variables. Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The decision
ADR-0059 (merged in #385) decided that a place the app runs is an environment, not a stage. This PR makes every public surface say so, as one breaking release, so users change
--stageto--environmentonce.Every environment now has a name, and none is special. Before, production was the deploy without a stage, and code everywhere carried
stage: string | undefined, withundefinedmeaning production. Now core carriesenvironment: stringeverywhere.prisma deployandprisma deploy listdefault the flag toproduction.prisma devruns as the environmentdev.destroyhas no default: a call without a name fails withDEPLOY.ENVIRONMENT_REQUIRED, so a missing value can still never tear down production.Where production lives on Prisma Cloud
Core never compares a name with
production. That mapping lives in the Prisma Cloud extension:productionresolves exactly as a deploy without--stagedid: the Project's default Branch, found by itsisDefaultflag. Resources carry nobranchId, the Build has no branch reference, and the deploy state is the same, so existing apps don't move.gitName, created on deploy if absent.main, is refused. It would be production under a second name, and destroying it would tear production down.Verified against Prisma Cloud with a throwaway app:
--environment stagingcreated and used astagingBranch; a deploy with no flag landed on theisDefaultBranch;--environment mainwas refused; destroyingstagingdeleted its Branch; destroyingproductionremoved the then-empty Project.Mismatched versions are refused, not misread
The
prismaCLI pins its Composer version, and the app installs its own@prisma/composer-prisma-cloud, so the two can differ. The released 0.35.0 extension reads the oldstagefield, so under this release it would read every environment as production and deploystaginginto production. Core therefore checks each resolved container as the Alchemy child will rebuild it, through the extension's owndeserialize(serialize()). An older extension rebuilds{ appName, stage }, the environment is missing, and the deploy or destroy fails withDEPS.EXTENSION_INCOMPATIBLEbefore anything is deployed or destroyed. The extension, in turn, refuses a request with no environment, which is what an older Composer sends.Verified with an app installed from npm on 0.35.0:
prisma deploy --environment stagingstopped withDEPS.EXTENSION_INCOMPATIBLEat the connect step.Smaller consequences
--stageondeployfails withCLI.COMMAND_MOVEDnaming--environment, through the CLI engine's redirect table.deploy listgets no redirect yet. The engine refuses to start when a redirect names a command the host hasn't mounted, and this repository's examples and CI run the releasedprisma8.0.0-rc.26, which doesn't mountdeploy list. The redirect can be added once that devDependency is a release that mounts it.DEPLOY.ENVIRONMENT_INVALID,ENVIRONMENT_UNVALIDATABLE, andENVIRONMENT_REQUIREDare new, andDEPS.EXTENSION_INCOMPATIBLEis new.STAGE_INVALID,STAGE_UNVALIDATABLEandSCOPE_MISSINGare retired. The registry in ADR-0044 is updated.productionorpr-42validates without runninggit, so a deploy still needs nogiton PATH.--reportJSON'sstagefield is nowenvironment, at report version 2.scripts/composer-destroy.tsand thedeploy-verify-destroyCI action use--environment. The deploying guide and the skill have an upgrade note.--stage, whose value on Prisma Cloud is the Branch id.For the
prismaCLI repositoryWhen it takes this release, any test that mounts Composer's family without
deploywill fail at startup, because the family's--stageredirect namesdeploy.composer-mount.test.tsmounts only the dev commands andemulator list, so it needsdeployadded.Not in this PR
prisma dev --environment. Giving each environment its own complete local copy is new behaviour, not a rename, so it is the next slice (spec in.drive/projects/public-urls/slices/c3-local-environments/spec.md). That slice also stopsdev urlanddev stopacting on whichever app ran last in the folder.--stagewith no pointer.@storefront-auth/storefrontpage integration test fails identically on a cleanmainon the author's machine.Alternatives considered
--stageas an alias. Rejected by ADR-0059: two words for one concept drift apart in guides, errors and agent output.stagefield too, for one release, for older extensions. Rejected: core would have to know thatproductionmeans "no stage", which is Prisma Cloud's mapping, not core's. Refusing the mismatch is target-neutral and safe.prisma dev, but it adds a field every extension must carry. The round trip uses the contract that already exists; slice C3 adds the check toprisma dev.--stageondeploy listtoo. Rejected for now: it would crash today's releasedprismaCLI at startup.Agent: achilles-41
🤖 Generated with Claude Code