Repository navigation
prisma dev and prisma deploy no longer fail in pnpm projects with DEPLOY.ALCHEMY_BIN_MISSING - #332
Conversation
|
✅ Gizmo reviewed 7b54744 — posted 0 inline comment(s) this pass. Open findings: 🟡 3 minor Change walkthroughChange walkthroughThis PR fixes The reviewed delta (this pass). The incremental change is a docs amendment to the effect-version-conflict guidance, split per package manager now that the per-manager spellings matter more:
Updating both surfaces together follows the repo's Rest of the PR (earlier pass, context). Core's |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
commit: |
be95770 to
07e3465
Compare
eb0e77b to
061b536
Compare
07e3465 to
840bb0a
Compare
061b536 to
4dff2f8
Compare
There was a problem hiding this comment.
New findings: none · trace
Still open from previous reviews: 🟡 1 minor
Both findings addressed in the follow-up commits; the bot's re-review reports no new findings.
There was a problem hiding this comment.
New findings: 🟠 1 major · trace
Still open from previous reviews: 🟡 1 minor
Findings outside the diff
- 🟠 Major · tests packages/0-framework/3-tooling/cli/src/tests/run-alchemy.test.ts — pnpmStoreLayout places alchemy in a store node_modules pnpm would never put it in, so the pnpm scenario the tests claim to cover is synthetic
ThepnpmStoreLayoutfixture installs the fakealchemydirectly in the same storenode_modulesas the package whose file is passed asfromFile(@prisma/composer/dist/control.mjs), and the first test's name claims this is "an alchemy that is only a dependency of Composer". In a real pnpm project that layout cannot occur: a storenode_modules(.pnpm/<pkg>@v/node_modules) contains only that package's direct dependencies, and the package that ships this module does not depend onalchemy— packages/0-framework/3-tooling/cli/package.json lists noalchemy;alchemyis a dependency of@internal/core(packages/0-framework/1-core/core/package.json:22), which lives in its own store dir thatfindAlchemyPackageDir's upward walk never enters. SinceresolveAlchemyEntry()defaults toimport.meta.urlof this module (compiled into the CLI package'sdist), the production walk under default pnpm actually succeeds via pnpm's hidden hoisted store (node_modules/.pnpm/node_modules, fromhoist-pattern: ['*']) — a mechanism no test models — and under pnpm's strict isolation (hoist-pattern=false) it fails withDEPLOY.ALCHEMY_BIN_MISSINGwhose fix text names only Yarn Plug'n'Play as the unsupported layout. So the tests greenlight the PR's headline pnpm fix while validating a layout that never exists, and the config in which it still breaks is untested and undocumented.
Recommended fix: Make the fixture model the real chain: put the module that callsresolveAlchemyEntry()in its own package's store dir without alchemy beside it, and install the fake alchemy at<root>/node_modules/.pnpm/node_modules/alchemy(pnpm's hidden hoisted store). Add a case with the hidden hoist absent (pnpmhoist-pattern=false) asserting theDEPLOY.ALCHEMY_BIN_MISSINGmessage, and mention that pnpm configuration in the error's fix text alongside Yarn Plug'n'Play.
There was a problem hiding this comment.
New findings: none · trace
Still open from previous reviews: 🟡 1 minor
…n link In a plain pnpm project that depends on @prisma/composer, `prisma dev` failed with DEPLOY.ALCHEMY_BIN_MISSING once the emulators were up: Composer looked for node_modules/.bin/alchemy, and pnpm links bins only for an app's direct dependencies. alchemy is Composer's dependency. This workspace hid the bug because its hoisted linker puts every bin at the root. resolveAlchemyEntry finds the alchemy package by walking node_modules up from Composer's own real location (alchemy does not export its package.json, so require.resolve cannot reach it), reads its bin, and the command line runs that entry with process.execPath. No shell shim is involved, so Windows needs no .cmd lookup. DEPLOY.ALCHEMY_BIN_MISSING remains for an alchemy that cannot be resolved, and its message now names the package lookup. Tests cover a pnpm store layout with alchemy only beside Composer and no .bin link, a hoisted alchemy, an absent one, and the alchemy this package is installed with. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The deploying guide and the skill described the old .bin lookup, including the Windows shim order. They now say Composer runs the alchemy it is installed with, so an app needs no direct alchemy dependency. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
With the alchemy executable found, `prisma dev` in a plain pnpm project failed next inside the converge: the generated dev stack file imported alchemy/State/LocalState, and the app cannot resolve alchemy, which is Composer's dependency. @prisma/composer/local-target now re-exports localState, and the stack file imports it from there with the rest of its local-target imports, so it reaches the same alchemy copy the converge runs. The deploy stack file already imports only @prisma/composer entries. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The skill and the deploying guide said one fix covers CONFIG.SECTION_MISSING, CONFIG.FIELD_RETIRED and CONFIG.FILE_RETIRED. SECTION_MISSING is fixed by adding the composer section; the two RETIRED codes by moving the old file's extensions and state into the section and removing configPath or the old file. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Running alchemy's entry with process.execPath moved it onto Bun whenever the prisma host ran under Bun, as the examples and the e2e action run it. The old bin's node shebang kept alchemy on Node, on purpose. nodeExecutable now picks this process's runtime only under Node; under Bun it takes the first node on PATH, and raises the new DEPLOY.NODE_MISSING (added to ADR-0044's code list) when there is none. Tests cover both runtimes and the missing case with an injected runtime. The guide and the skill say alchemy runs under Node. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
… under pnpm `bun node_modules/.bin/prisma` fails in a default pnpm project, where that entry is a shell script. `bunx prisma` follows the node shebang and runs prisma under Node, and `bunx --bun prisma` also starts alchemy under Bun through its node shim on PATH. `bun node_modules/prisma/dist/prisma.js` runs the host under Bun with alchemy on Node, verified in a plain pnpm project. The guide and the skill document that form, keep the package-manager form for Node, and say why the shorter forms fail. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
- A Composer file that is not on disk (realpath fails) now raises DEPLOY.ALCHEMY_BIN_MISSING instead of a raw ENOENT. - The fix text says to check that alchemy is installed beside @prisma/composer, which depends on it, and that layouts without node_modules are unsupported, instead of sending users to reinstall. - The PATH lookup for node follows the injected platform: on Windows it splits on ";", unquotes entries and tries PATHEXT. - nodeExecutable's doc says Composer chooses the Node that starts Alchemy's launcher, which may move itself to Bun under bunx or bun run. - localState on @prisma/composer/local-target is marked @internal, for the generated dev stack only. - Tests: Composer reached through a symlink, a string bin, an object bin without an alchemy key, a bin naming a missing file, an unreadable path, the Windows PATH rules, a deploy stack file with no alchemy import, and a `spaces & symbols` stage round-tripping through the child on every platform. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The guide and the skill claimed Alchemy always runs under Node and that the shorter Bun forms do not work. Alchemy's own launcher moves to Bun under bunx or bun run, and every form runs. Runtime now recommends the package manager's form (pnpm prisma, npx prisma), explains that Composer starts Alchemy with Node and the launcher may switch, and tabulates the four forms from the QA runs: package manager (Node, Node), bunx (Node, Bun), bunx --bun (Bun, Bun), and bun on the JS entry from a shell (Bun, Node). Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…LCHEMY_BIN_MISSING binEntryOf read and parsed the manifest unguarded, so EISDIR or a JSON syntax error escaped as a raw error instead of the structured diagnostic. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…ecks The Bun-on-PATH case used the host platform and the real file system, so on Windows PATHEXT produced node.EXE where the test expected node.exe. Every case now injects its runtime, and Windows gets the default-PATHEXT and no-node cases too. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
This module is bundled into @prisma/composer and @prisma/composer-cli, and both declare alchemy, so pnpm puts alchemy in each package's own store directory. The fixture now models that with no hidden hoist and no root alchemy, for both packages. A package that does not declare alchemy gets DEPLOY.ALCHEMY_BIN_MISSING, and a test fails if the two published manifests stop declaring the same alchemy. The fix text names the package that runs alchemy under prisma and from a script. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…aw localState re-export @prisma/composer/local-target exported Alchemy's localState directly, so an Alchemy upgrade changed Composer's public types. devState() is Composer's own name for the store prisma dev converges against. The dev stack header now describes the command Composer starts. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…print the command that ran resolveAlchemyBin resolves @prisma/composer from the app directory, as the generated stack file's imports do, and takes the alchemy installed beside it. The CLI and the stack code then come from one install, wherever this module was bundled. Adapters report the command line they started, and failures print it as the reproduce command instead of an alchemy command that pnpm apps do not have. NodeRuntime is renamed HostRuntime, since the host may be Bun. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
… prints deploy-cli.md states the runtime rule: Composer starts the bin of the alchemy @prisma/composer depends on with Node, and Alchemy's launcher picks the final runtime. ADR-0007 gets an addendum for the printed reproduce command, and ADR-0044 notes that prisma dev raises the shared DEPLOY codes. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
3496822 to
2ac4bea
Compare
There was a problem hiding this comment.
New findings: none · trace
Still open from previous reviews: 🟡 1 minor
Double quotes let a shell expand $, backticks and ! in a stage name when the command is pasted. Single quotes, with embedded single quotes escaped, keep every argument literal. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…r-cli declares it The guide and the skill still said Composer finds alchemy from its own location. The composer-cli build config now says why alchemy stays a dependency: the inlined core code imports it, and the hoisted workspace would hide its removal. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
The lookup now anchors on the app's @prisma/composer (which declares alchemy) and the tests model pnpm's real strict layout; strict-isolation QA reaches ready. The bot's re-review reports no new findings.
There was a problem hiding this comment.
New findings: 🟡 1 minor · trace
Still open from previous reviews: 🟡 1 minor
cmd.exe reads single quotes literally, so the POSIX-quoted command broke when pasted on Windows. On win32 arguments are double-quoted with embedded quotes doubled; elsewhere they stay single-quoted. The family deploy test checked the bin path and arguments as one string, which failed on Windows because the temp path (RUNNER~1) needs quoting there; it now checks them apart. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
There was a problem hiding this comment.
New findings: 🟡 2 minor · trace
Still open from previous reviews: 🟡 2 minor
…hy a path gets quoted Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
There was a problem hiding this comment.
New findings: 🟡 1 minor · trace
Still open from previous reviews: 🟡 4 minor
…tput on cmd.exe Co-Authored-By: Claude Fable 5.1 <[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: 🟡 5 minor
Addressed in later commits; the bot's re-review on 11b085c reports no new findings.
pnpm 11 ignores the pnpm field of package.json, so the guide and the skill now give the pnpm-workspace.yaml overrides block for pnpm 11 and later, keep the package.json form for pnpm 10 and earlier, and list the other package managers' forms separately. Co-Authored-By: Claude Fable 5.1 <[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: 🟡 5 minor
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
In a new app installed with pnpm, the way our getting-started guide sets one up,
prisma devfails before anything starts:prisma deployuses the same lookup and fails the same way. After this PR, both commands run in that app with no extra dependency.The decision
Composer runs the copy of Alchemy that the app's own
@prisma/composerdepends on. It finds@prisma/composerfrom the app directory, then finds thealchemypackage installed beside it, and starts Alchemy's command-line entry file directly with Node. It no longer looks in the app'snode_modules/.bin.Background: why Composer runs Alchemy at all
Composer provisions an app through Alchemy, an infrastructure library. For each
prisma deployorprisma dev, Composer writes a small TypeScript file, the stack file, into.prisma-composer/. It then starts Alchemy's own command-line tool as a child process and points it at that file. Alchemy is a dependency of@prisma/composer. The app never installs it directly.Why the old lookup failed under pnpm
Composer used to find Alchemy's executable by walking up from the app directory looking for
node_modules/.bin/alchemy. npm and Yarn put every installed package's executable there. pnpm only links the executables of the app's own direct dependencies, soalchemyhas no link and the walk finds nothing.Our own repository never saw this, because its
.npmrcsetsnode-linker=hoisted, which makes pnpm link everything like npm does. The old error's advice, "Add alchemy as a dependency of your app", was the only workaround, and no guide mentioned it.How the new lookup works
alchemy-bin.tsdoes three steps:@prisma/composer/package.jsonfrom the app directory with Node's resolver, and follow symlinks to the real directory.node_modules/alchemyin that directory and each parent, nearest first. This is how Node itself would findalchemyfrom inside@prisma/composer. We write the walk out because Alchemy does not export itspackage.json, so Node's resolver cannot be asked directly.binentry of Alchemy'spackage.jsonand return the JavaScript file it names.run-alchemy.tsthen starts that file asnode <alchemy entry> deploy <stack file> --yes --stage <stage>. Starting the JavaScript file directly means no shell script and no Windows.cmdwrapper is involved.Because the lookup starts from the app's
@prisma/composer, the Alchemy that runs is the same copy the stack file's@prisma/composerimports load. Before, the version of@prisma/composer-clirunning the command could decide which copy ran.When the lookup fails,
DEPLOY.ALCHEMY_BIN_MISSINGnow says which step failed, and its fix says to check that the app depends on@prisma/composer. It also says layouts without anode_modulesdirectory, such as Yarn Plug'n'Play, are not supported.Three things that had to change with it
The dev stack file imported Alchemy itself. With the executable found,
prisma devstill failed: the generated dev stack file containedimport { localState } from 'alchemy/State/LocalState', and the app cannot resolvealchemy.@prisma/composer/local-targetnow exportsdevState(), which returns that same file-based state store, and the stack file imports it from there. Tests check that neither generated stack file imports fromalchemy.The "run it yourself" command was wrong. When a deploy fails, Composer prints the command so you can rerun it by hand, as ADR-0007 promises. It printed
alchemy deploy …, which fails in exactly the project this PR fixes. It now prints the command line it actually started, with arguments quoted for the platform's shell, so a stage name containing$or a quote is not expanded when pasted. ADR-0007 is amended to say so.Which runtime runs Alchemy is now chosen by Composer. The old
.binlink carried a#!/usr/bin/env nodeline, so Alchemy always started under Node. Starting the entry file ourselves means we choose the program. Composer uses its own process when it runs under Node. When it runs under Bun, it uses the firstnodeonPATH, and fails with the newDEPLOY.NODE_MISSINGif there is none. Alchemy's own startup code can still switch itself to Bun when it sees it was invoked throughbunxorbun run. We measured each way of runningprisma:prismaprismaruns underpnpm prisma …ornpx prisma …bunx prisma …bunx --bun prisma …bun node_modules/prisma/dist/prisma.js …The deploying guide shows this table and recommends the first form. The deploy-cli design doc records the rule: Composer starts Alchemy with Node and lets Alchemy's startup code decide whether to switch.
Docs
The deploying guide and the shipped agent skill describe the new lookup and the runtime table. While in those files, the
effectoverride example now shows the pnpm 11 form, anoverrides:block inpnpm-workspace.yaml, since pnpm 11 ignores overrides inpackage.json.How it was verified
prisma dev module.tsran thealchemybeside@prisma/composerand reached ready. Underbun node_modules/prisma/dist/prisma.js, the process list showed Alchemy on the system Node. Ctrl-C ended with an ok result.@prisma/composerreached through a symlink, no resolvable@prisma/composer, noalchemybeside it, and abinentry that is a string, an object without analchemykey, a missing file, malformed JSON or unreadable.nodeonPATH, and WindowsPATHparsing with quoted entries andPATHEXT.pr-$USER,it`s!,o'brienandsay "hi", quoted for both POSIX shells andcmd.exe.test/integration. CI passes on Linux, macOS and Windows.Alternatives considered
alchemyto their app. This is what the old error said. Alchemy is Composer's implementation detail, and a second copy in the app can drift from the version Composer was built against.@prisma/composer-cli, which can differ from the copy the stack file loads through the app's@prisma/composer.node:imports by design, and the lookup needs the file system.Agent: columbo-17, then saruman-38
🤖 Generated with Claude Code