From cdd8114d972f058db2fb982a38016b8dbd5142bd Mon Sep 17 00:00:00 2001 From: willbot Date: Tue, 24 Nov 2026 23:15:18 +1100 Subject: [PATCH 1/3] The CLI lists @prisma/orm-framework beside the ORM toolchain, at the toolchain's version An upcoming ORM release makes @prisma/orm-toolchain name @prisma/orm-framework as an exact peer dependency instead of bringing it as a dependency. Whoever lists the toolchain must then list the framework, or Yarn, which installs no peers, leaves the toolchain unable to load. - packages/cli and packages/prisma list @prisma/orm-framework at 8.0.0-rc.25, the version the toolchain already brings, so this changes nothing installed today. - update-product-versions.mjs pins the framework at the version it finds for the toolchain rather than reading the framework's own tag, so both move in one step and a run during the ORM's publish cannot pin them apart. - The conformance import-purity check excuses the framework in the shell's manifests: the shell supplies it for the toolchain's peer and never imports it. Co-Authored-By: Claude Opus Signed-off-by: willbot Signed-off-by: Will Madden --- docs/architecture/package-structure.md | 2 +- docs/oss/release-automation.md | 4 +- packages/cli/package.json | 1 + packages/cli/scripts/conformance.ts | 18 ++++++++- packages/prisma/package.json | 1 + pnpm-lock.yaml | 6 +++ scripts/update-product-versions.mjs | 35 ++++++++++++++--- scripts/update-product-versions.test.mjs | 49 ++++++++++++++++++++++++ 8 files changed, 105 insertions(+), 11 deletions(-) diff --git a/docs/architecture/package-structure.md b/docs/architecture/package-structure.md index cd731ae0e..e611e1dec 100644 --- a/docs/architecture/package-structure.md +++ b/docs/architecture/package-structure.md @@ -28,7 +28,7 @@ Authentication (token storage, refresh, the login flow) lives in this repository `@prisma/cli` and `prisma` ship the same shell. `packages/prisma/src/bin.ts` imports `@prisma/cli/src/bin`, and its build bundles `@prisma/cli`, `@repo/cli-telemetry`, and `@prisma/credentials-store` into `dist/prisma.js`, so a command cannot behave differently depending on which package a user installed. The wrapper also exports `prisma/config`, which re-exports `definePrismaConfig` from the engine so a user's `prisma.config.ts` never depends on `@prisma/cli-engine` directly, and it ships the `prisma-platform-core-concepts` agent skill in its `skills/` directory, staged from the repository root `skills/` tree at `prepack` by `scripts/stage-skills.mjs`. -The wrapper's `package.json` carries its own copy of the runtime dependencies, including the product version pins on `@prisma/composer-cli` and `@prisma/orm-toolchain` and the `workspace:` pin on the engine. A user's `npm install prisma` resolves from the wrapper's copy, so the two manifests must declare the same dependencies at the same versions. Three checks keep them equal to `packages/cli`'s: `packages/cli/tests/manifest-pins.test.ts` asserts the wrapper's `dependencies` deep-equal the shell's; the conformance tarball check (`packages/cli-conformance/src/checks/tarball.ts`) fails on any dependency two packed manifests pin differently and on any engine pin that differs from the engine version packed beside it, then installs each packed bin into its own sandbox and starts it; and `scripts/update-product-versions.mjs` and `scripts/bump-cli-engine-version.ts` rewrite both manifests in one step so a pin cannot move in one without the other. +The wrapper's `package.json` carries its own copy of the runtime dependencies, including the product version pins on `@prisma/composer-cli`, `@prisma/orm-toolchain` and `@prisma/orm-framework` (the toolchain's peer, which the shell supplies at the toolchain's version) and the `workspace:` pin on the engine. A user's `npm install prisma` resolves from the wrapper's copy, so the two manifests must declare the same dependencies at the same versions. Three checks keep them equal to `packages/cli`'s: `packages/cli/tests/manifest-pins.test.ts` asserts the wrapper's `dependencies` deep-equal the shell's; the conformance tarball check (`packages/cli-conformance/src/checks/tarball.ts`) fails on any dependency two packed manifests pin differently and on any engine pin that differs from the engine version packed beside it, then installs each packed bin into its own sandbox and starts it; and `scripts/update-product-versions.mjs` and `scripts/bump-cli-engine-version.ts` rewrite both manifests in one step so a pin cannot move in one without the other. ## Agent skills diff --git a/docs/oss/release-automation.md b/docs/oss/release-automation.md index 81bc38691..a40621d67 100644 --- a/docs/oss/release-automation.md +++ b/docs/oss/release-automation.md @@ -6,7 +6,7 @@ The unified CLI is assembled from three repositories. This page explains how a n | --- | --- | --- | | `prisma/prisma-cli` (this one) | `@prisma/cli-engine`, `@prisma/cli`, `prisma` | — | | `prisma/composer` | `@prisma/composer-cli` (and the `@prisma/composer` library) | a dependency of the shell | -| `prisma/prisma` | `@prisma/orm-toolchain` | a dependency of the shell | +| `prisma/prisma` | `@prisma/orm-toolchain` (and `@prisma/orm-framework`, which the toolchain names as a peer) | dependencies of the shell, always at the same version | One more repository depends on this CLI instead of feeding it: `prisma/cloud-deploy-action`, whose test this repository runs (see [Keeping `prisma/cloud-deploy-action` working](#keeping-prismacloud-deploy-action-working)). @@ -17,7 +17,7 @@ A **release** of the CLI depends only on **released** versions of the products. ## What happens when a product publishes 1. The product repository's publish workflow finishes and sends a `repository_dispatch` event of type `product-published` to `prisma/prisma-cli`. -2. [`update-product-versions.yml`](../../.github/workflows/update-product-versions.yml) runs [`scripts/update-product-versions.mjs`](../../scripts/update-product-versions.mjs), which asks the registry for each watched package's version at its **release** dist-tag and rewrites `packages/cli/package.json` and `packages/prisma/package.json` where they differ. Every watched package publishes its releases under `latest`, pre-release versions included: they are all new packages with no pre-8 audience to protect. The bare `prisma` name, which this repository publishes, was the one exception: its `latest` served Prisma 7 until the 2026-08-25 cutover, and since then every release of it publishes under `latest` too (see [versioning.md](versioning.md)). Each package carries a list of candidate tags rather than one name, most-preferred first, so a product moving where it publishes does not silently freeze the CLI on an old version — and a package that publishes none of its candidates fails the run instead of looking like "nothing to update". +2. [`update-product-versions.yml`](../../.github/workflows/update-product-versions.yml) runs [`scripts/update-product-versions.mjs`](../../scripts/update-product-versions.mjs), which asks the registry for each watched package's version at its **release** dist-tag and rewrites `packages/cli/package.json` and `packages/prisma/package.json` where they differ. Every watched package publishes its releases under `latest`, pre-release versions included: they are all new packages with no pre-8 audience to protect. The bare `prisma` name, which this repository publishes, was the one exception: its `latest` served Prisma 7 until the 2026-08-25 cutover, and since then every release of it publishes under `latest` too (see [versioning.md](versioning.md)). `@prisma/orm-framework` reads no tag of its own: it takes the version found for `@prisma/orm-toolchain`, because the toolchain names it as an exact peer and a run during the ORM's publish must not pin the two apart. Each other package carries a list of candidate tags rather than one name, most-preferred first, so a product moving where it publishes does not silently freeze the CLI on an old version — and a package that publishes none of its candidates fails the run instead of looking like "nothing to update". 3. If any pin changed, or `main` holds pins the last release (its `v` tag) did not ship, the workflow bumps the CLI to its next version with `pnpm bump-version` (which also refreshes `pnpm-lock.yaml`), opens a pull request titled `Release : follow the products' released versions: ...`, and arms auto-merge. Every earlier open pull request from this workflow, and every open `Bump to version` release pull request, is closed first: each bumps the same version, so only one can merge. 4. The pull request runs the full quality and conformance checks. When they pass and CodeRabbit approves it (the `main` ruleset requires one approving review), it merges, and that push to `main` changes the root version, so [`publish.yml`](../../.github/workflows/publish.yml) publishes the release under `latest` with the committed product versions, plus the usual `dev` build. diff --git a/packages/cli/package.json b/packages/cli/package.json index f132a7465..5dd4dfdf6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -53,6 +53,7 @@ "@prisma/composer-cli": "0.40.0", "@prisma/compute-sdk": "0.43.0", "@prisma/management-api-sdk": "1.101.0", + "@prisma/orm-framework": "8.0.0-rc.25", "@prisma/orm-toolchain": "8.0.0-rc.25", "@vercel/detect-agent": "^1.2.3", "better-result": "^2.9.2", diff --git a/packages/cli/scripts/conformance.ts b/packages/cli/scripts/conformance.ts index 3403120d0..9b76867ad 100644 --- a/packages/cli/scripts/conformance.ts +++ b/packages/cli/scripts/conformance.ts @@ -45,6 +45,10 @@ const PRISMA_DIR = join(CLI_DIR, "..", "prisma"); // time out unrelated tests. const WORK_DIR = join(CLI_DIR, "..", "..", ".conformance", "cli"); +// The ORM toolchain names the framework as a peer, so the shell supplies +// it; the shell's own code never imports it. +const SHELL_UNIMPORTED = ["@prisma/orm-framework"]; + const CHANNEL: PublishChannel = process.env.PUBLISH_CHANNEL === "dev" ? "dev" : "release"; @@ -59,12 +63,14 @@ async function importPurity(): Promise { label: "@prisma/cli", output: await sweepBuiltOutput(join(CLI_DIR, "dist")), manifest: await manifest(CLI_DIR), + allowedUnimported: SHELL_UNIMPORTED, requiredSpecifiers: ["@prisma/cli-engine", "@prisma/composer-cli/family"], }); const unscoped = checkImportPurity({ label: "prisma", output: await sweepBuiltOutput(join(PRISMA_DIR, "dist")), manifest: await manifest(PRISMA_DIR), + allowedUnimported: SHELL_UNIMPORTED, requiredSpecifiers: ["@prisma/cli-engine", "@prisma/composer-cli/family"], }); const engine = checkImportPurity({ @@ -97,8 +103,16 @@ async function tarball(): Promise { return checkTarball( { packages: [ - { name: "@prisma/cli", dir: CLI_DIR }, - { name: "prisma", dir: PRISMA_DIR }, + { + name: "@prisma/cli", + dir: CLI_DIR, + allowedUnimported: SHELL_UNIMPORTED, + }, + { + name: "prisma", + dir: PRISMA_DIR, + allowedUnimported: SHELL_UNIMPORTED, + }, { name: "@prisma/cli-engine", dir: ENGINE_DIR, diff --git a/packages/prisma/package.json b/packages/prisma/package.json index 0e950770a..5af04fdd7 100644 --- a/packages/prisma/package.json +++ b/packages/prisma/package.json @@ -54,6 +54,7 @@ "@prisma/composer-cli": "0.40.0", "@prisma/compute-sdk": "0.43.0", "@prisma/management-api-sdk": "1.101.0", + "@prisma/orm-framework": "8.0.0-rc.25", "@prisma/orm-toolchain": "8.0.0-rc.25", "@vercel/detect-agent": "^1.2.3", "better-result": "^2.9.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9363c5811..f78c10ffc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,6 +38,9 @@ importers: '@prisma/management-api-sdk': specifier: 1.101.0 version: 1.101.0 + '@prisma/orm-framework': + specifier: 8.0.0-rc.25 + version: 8.0.0-rc.25(typescript@6.0.3) '@prisma/orm-toolchain': specifier: 8.0.0-rc.25 version: 8.0.0-rc.25(@prisma/cli-engine@packages+cli-engine)(magicast@0.5.3)(typanion@3.14.0)(typescript@6.0.3)(vite@7.3.5(@types/node@22.19.19)(jiti@2.7.0)(tsx@4.22.4)(yaml@2.9.1)) @@ -221,6 +224,9 @@ importers: '@prisma/management-api-sdk': specifier: 1.101.0 version: 1.101.0 + '@prisma/orm-framework': + specifier: 8.0.0-rc.25 + version: 8.0.0-rc.25(typescript@6.0.3) '@prisma/orm-toolchain': specifier: 8.0.0-rc.25 version: 8.0.0-rc.25(@prisma/cli-engine@packages+cli-engine)(magicast@0.5.3)(typanion@3.14.0)(typescript@6.0.3)(vite@7.3.5(@types/node@22.19.19)(jiti@2.7.0)(tsx@4.22.4)(yaml@2.9.1)) diff --git a/scripts/update-product-versions.mjs b/scripts/update-product-versions.mjs index e80e1a4ac..cbe331b67 100644 --- a/scripts/update-product-versions.mjs +++ b/scripts/update-product-versions.mjs @@ -51,6 +51,11 @@ const WATCHED = /** @type {const} */ ([ // package it ships beside, or the fixture resolves a second copy. { name: "@prisma/composer", release: ["latest"] }, { name: "@prisma/orm-toolchain", release: ["latest"] }, + // The toolchain names the framework as an exact peer, so whoever lists + // the toolchain lists the framework too, at the same version. It takes + // the toolchain's version rather than reading its own tag, so a run + // during the ORM's publish cannot pin the two apart. + { name: "@prisma/orm-framework", sameVersionAs: "@prisma/orm-toolchain" }, ]); const MANIFEST_PATHS = [ @@ -91,6 +96,29 @@ export function selectTag(distTags, candidates) { return undefined; } +/** + * Each watched package's version on the channel. Pure apart from + * `lookup`; exported for tests. + * + * @param {"release" | "dev"} channel + * @param {(name: string, tags: readonly string[]) => string | undefined} lookup + * @returns {Map} + */ +export function publishedVersions(channel, lookup) { + const published = new Map(); + for (const entry of WATCHED) { + if ("release" in entry) { + published.set(entry.name, lookup(entry.name, tagsFor(entry, channel))); + } + } + for (const entry of WATCHED) { + if ("sameVersionAs" in entry) { + published.set(entry.name, published.get(entry.sameVersionAs)); + } + } + return published; +} + /** * @param {string} path * @param {string} field @@ -273,12 +301,7 @@ function main() { path, manifest: JSON.parse(readFileSync(join(rootDir, path), "utf-8")), })); - const published = new Map( - WATCHED.map((entry) => [ - entry.name, - publishedVersion(entry.name, tagsFor(entry, channel)), - ]), - ); + const published = publishedVersions(channel, publishedVersion); const updates = computeUpdates(manifests, published); applyUpdates(manifests, updates); diff --git a/scripts/update-product-versions.test.mjs b/scripts/update-product-versions.test.mjs index a42ffa900..d220831d0 100644 --- a/scripts/update-product-versions.test.mjs +++ b/scripts/update-product-versions.test.mjs @@ -5,6 +5,7 @@ import { computeUpdates, isPackageAbsent, pinChanges, + publishedVersions, selectTag, tagsFor, } from "./update-product-versions.mjs"; @@ -228,6 +229,54 @@ describe("computeUpdates", () => { }); }); +describe("publishedVersions", () => { + const registry = { + "@prisma/composer-cli": "0.41.0", + "@prisma/composer": "0.41.0", + "@prisma/orm-toolchain": "8.0.0-rc.26", + "@prisma/orm-framework": "8.0.0-rc.27", + }; + + /** + * The toolchain names the framework as an exact peer, so the two pins + * must agree. Reading the framework's own tag could catch the ORM + * mid-publish with one moved and not the other. + */ + it("pins the framework at the toolchain's version without asking the registry", () => { + const asked = []; + const published = publishedVersions("release", (name) => { + asked.push(name); + return registry[name]; + }); + assert.equal(published.get("@prisma/orm-framework"), "8.0.0-rc.26"); + assert.equal(asked.includes("@prisma/orm-framework"), false); + }); + + it("moves the framework in the same run as the toolchain", () => { + const updates = computeUpdates( + [ + { + path: PRISMA, + manifest: { + dependencies: { + "@prisma/orm-framework": "8.0.0-rc.25", + "@prisma/orm-toolchain": "8.0.0-rc.25", + }, + }, + }, + ], + publishedVersions("release", (name) => registry[name]), + ); + assert.deepEqual( + updates.map(({ name, to }) => [name, to]), + [ + ["@prisma/orm-toolchain", "8.0.0-rc.26"], + ["@prisma/orm-framework", "8.0.0-rc.26"], + ], + ); + }); +}); + describe("applyUpdates", () => { it("writes each update into the manifest it names", () => { const manifests = [ From c7377963de669aeb78c07ab1f8d9c56d57da3eca Mon Sep 17 00:00:00 2001 From: willbot Date: Tue, 24 Nov 2026 23:29:05 +1100 Subject: [PATCH 2/3] Comments and docs on the framework pin hold before and after the ORM makes it a peer The toolchain has the framework as an ordinary dependency until the ORM release after 8.0.0-rc.25, so the comments no longer say it is a peer today. The allowedUnimported doc comments now cover a package listed only so another package's peer is met. Co-Authored-By: Claude Opus Signed-off-by: willbot Signed-off-by: Will Madden --- docs/architecture/package-structure.md | 2 +- docs/oss/release-automation.md | 4 ++-- packages/cli-conformance/src/checks/import-purity.ts | 3 ++- packages/cli-conformance/src/checks/tarball.ts | 5 +++-- packages/cli/scripts/conformance.ts | 5 +++-- scripts/update-product-versions.mjs | 5 +++-- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/architecture/package-structure.md b/docs/architecture/package-structure.md index e611e1dec..5de9dde4e 100644 --- a/docs/architecture/package-structure.md +++ b/docs/architecture/package-structure.md @@ -28,7 +28,7 @@ Authentication (token storage, refresh, the login flow) lives in this repository `@prisma/cli` and `prisma` ship the same shell. `packages/prisma/src/bin.ts` imports `@prisma/cli/src/bin`, and its build bundles `@prisma/cli`, `@repo/cli-telemetry`, and `@prisma/credentials-store` into `dist/prisma.js`, so a command cannot behave differently depending on which package a user installed. The wrapper also exports `prisma/config`, which re-exports `definePrismaConfig` from the engine so a user's `prisma.config.ts` never depends on `@prisma/cli-engine` directly, and it ships the `prisma-platform-core-concepts` agent skill in its `skills/` directory, staged from the repository root `skills/` tree at `prepack` by `scripts/stage-skills.mjs`. -The wrapper's `package.json` carries its own copy of the runtime dependencies, including the product version pins on `@prisma/composer-cli`, `@prisma/orm-toolchain` and `@prisma/orm-framework` (the toolchain's peer, which the shell supplies at the toolchain's version) and the `workspace:` pin on the engine. A user's `npm install prisma` resolves from the wrapper's copy, so the two manifests must declare the same dependencies at the same versions. Three checks keep them equal to `packages/cli`'s: `packages/cli/tests/manifest-pins.test.ts` asserts the wrapper's `dependencies` deep-equal the shell's; the conformance tarball check (`packages/cli-conformance/src/checks/tarball.ts`) fails on any dependency two packed manifests pin differently and on any engine pin that differs from the engine version packed beside it, then installs each packed bin into its own sandbox and starts it; and `scripts/update-product-versions.mjs` and `scripts/bump-cli-engine-version.ts` rewrite both manifests in one step so a pin cannot move in one without the other. +The wrapper's `package.json` carries its own copy of the runtime dependencies, including the product version pins on `@prisma/composer-cli`, `@prisma/orm-toolchain` and `@prisma/orm-framework` (listed at the toolchain's version so the shell does not rely on the toolchain bringing it) and the `workspace:` pin on the engine. A user's `npm install prisma` resolves from the wrapper's copy, so the two manifests must declare the same dependencies at the same versions. Three checks keep them equal to `packages/cli`'s: `packages/cli/tests/manifest-pins.test.ts` asserts the wrapper's `dependencies` deep-equal the shell's; the conformance tarball check (`packages/cli-conformance/src/checks/tarball.ts`) fails on any dependency two packed manifests pin differently and on any engine pin that differs from the engine version packed beside it, then installs each packed bin into its own sandbox and starts it; and `scripts/update-product-versions.mjs` and `scripts/bump-cli-engine-version.ts` rewrite both manifests in one step so a pin cannot move in one without the other. ## Agent skills diff --git a/docs/oss/release-automation.md b/docs/oss/release-automation.md index a40621d67..4c86fe276 100644 --- a/docs/oss/release-automation.md +++ b/docs/oss/release-automation.md @@ -6,7 +6,7 @@ The unified CLI is assembled from three repositories. This page explains how a n | --- | --- | --- | | `prisma/prisma-cli` (this one) | `@prisma/cli-engine`, `@prisma/cli`, `prisma` | — | | `prisma/composer` | `@prisma/composer-cli` (and the `@prisma/composer` library) | a dependency of the shell | -| `prisma/prisma` | `@prisma/orm-toolchain` (and `@prisma/orm-framework`, which the toolchain names as a peer) | dependencies of the shell, always at the same version | +| `prisma/prisma` | `@prisma/orm-toolchain` (and `@prisma/orm-framework`, listed so the shell does not rely on the toolchain bringing it; the toolchain names it as a peer from the ORM release after 8.0.0-rc.25) | dependencies of the shell, always at the same version | One more repository depends on this CLI instead of feeding it: `prisma/cloud-deploy-action`, whose test this repository runs (see [Keeping `prisma/cloud-deploy-action` working](#keeping-prismacloud-deploy-action-working)). @@ -17,7 +17,7 @@ A **release** of the CLI depends only on **released** versions of the products. ## What happens when a product publishes 1. The product repository's publish workflow finishes and sends a `repository_dispatch` event of type `product-published` to `prisma/prisma-cli`. -2. [`update-product-versions.yml`](../../.github/workflows/update-product-versions.yml) runs [`scripts/update-product-versions.mjs`](../../scripts/update-product-versions.mjs), which asks the registry for each watched package's version at its **release** dist-tag and rewrites `packages/cli/package.json` and `packages/prisma/package.json` where they differ. Every watched package publishes its releases under `latest`, pre-release versions included: they are all new packages with no pre-8 audience to protect. The bare `prisma` name, which this repository publishes, was the one exception: its `latest` served Prisma 7 until the 2026-08-25 cutover, and since then every release of it publishes under `latest` too (see [versioning.md](versioning.md)). `@prisma/orm-framework` reads no tag of its own: it takes the version found for `@prisma/orm-toolchain`, because the toolchain names it as an exact peer and a run during the ORM's publish must not pin the two apart. Each other package carries a list of candidate tags rather than one name, most-preferred first, so a product moving where it publishes does not silently freeze the CLI on an old version — and a package that publishes none of its candidates fails the run instead of looking like "nothing to update". +2. [`update-product-versions.yml`](../../.github/workflows/update-product-versions.yml) runs [`scripts/update-product-versions.mjs`](../../scripts/update-product-versions.mjs), which asks the registry for each watched package's version at its **release** dist-tag and rewrites `packages/cli/package.json` and `packages/prisma/package.json` where they differ. Every watched package publishes its releases under `latest`, pre-release versions included: they are all new packages with no pre-8 audience to protect. The bare `prisma` name, which this repository publishes, was the one exception: its `latest` served Prisma 7 until the 2026-08-25 cutover, and since then every release of it publishes under `latest` too (see [versioning.md](versioning.md)). `@prisma/orm-framework` reads no tag of its own: it takes the version found for `@prisma/orm-toolchain`, because the two must agree (from the ORM release after 8.0.0-rc.25 the toolchain names it as an exact peer) and a run during the ORM's publish must not pin the two apart. Each other package carries a list of candidate tags rather than one name, most-preferred first, so a product moving where it publishes does not silently freeze the CLI on an old version — and a package that publishes none of its candidates fails the run instead of looking like "nothing to update". 3. If any pin changed, or `main` holds pins the last release (its `v` tag) did not ship, the workflow bumps the CLI to its next version with `pnpm bump-version` (which also refreshes `pnpm-lock.yaml`), opens a pull request titled `Release : follow the products' released versions: ...`, and arms auto-merge. Every earlier open pull request from this workflow, and every open `Bump to version` release pull request, is closed first: each bumps the same version, so only one can merge. 4. The pull request runs the full quality and conformance checks. When they pass and CodeRabbit approves it (the `main` ruleset requires one approving review), it merges, and that push to `main` changes the root version, so [`publish.yml`](../../.github/workflows/publish.yml) publishes the release under `latest` with the committed product versions, plus the usual `dev` build. diff --git a/packages/cli-conformance/src/checks/import-purity.ts b/packages/cli-conformance/src/checks/import-purity.ts index c78451637..ba53c8e58 100644 --- a/packages/cli-conformance/src/checks/import-purity.ts +++ b/packages/cli-conformance/src/checks/import-purity.ts @@ -23,7 +23,8 @@ export interface ImportPurityInput { /** * Declared dependencies reached without a static import, so the * reverse half must not report them. `import.meta.resolve` is the - * case: it is not an import, by design. + * case: it is not an import, by design. A package listed only so + * that another package's peer dependency is met is the other case. */ readonly allowedUnimported?: readonly string[]; /** diff --git a/packages/cli-conformance/src/checks/tarball.ts b/packages/cli-conformance/src/checks/tarball.ts index 177313a27..da00b31f3 100644 --- a/packages/cli-conformance/src/checks/tarball.ts +++ b/packages/cli-conformance/src/checks/tarball.ts @@ -88,8 +88,9 @@ export interface TarballInput { dir: string; /** * Declared dependencies this package reaches without a static - * import (`import.meta.resolve` and friends), handed through to - * check 3a's import purity over the packed files. + * import (`import.meta.resolve` and friends), or never reaches but + * lists so another package's peer is met; handed through to check + * 3a's import purity over the packed files. */ allowedUnimported?: readonly string[]; }[]; diff --git a/packages/cli/scripts/conformance.ts b/packages/cli/scripts/conformance.ts index 9b76867ad..24f23694f 100644 --- a/packages/cli/scripts/conformance.ts +++ b/packages/cli/scripts/conformance.ts @@ -45,8 +45,9 @@ const PRISMA_DIR = join(CLI_DIR, "..", "prisma"); // time out unrelated tests. const WORK_DIR = join(CLI_DIR, "..", "..", ".conformance", "cli"); -// The ORM toolchain names the framework as a peer, so the shell supplies -// it; the shell's own code never imports it. +// The shell lists the framework so it does not rely on the toolchain +// bringing it (the toolchain peers on it from the ORM release after +// 8.0.0-rc.25). The shell's own code never imports it. const SHELL_UNIMPORTED = ["@prisma/orm-framework"]; const CHANNEL: PublishChannel = diff --git a/scripts/update-product-versions.mjs b/scripts/update-product-versions.mjs index cbe331b67..fa73af9ee 100644 --- a/scripts/update-product-versions.mjs +++ b/scripts/update-product-versions.mjs @@ -51,8 +51,9 @@ const WATCHED = /** @type {const} */ ([ // package it ships beside, or the fixture resolves a second copy. { name: "@prisma/composer", release: ["latest"] }, { name: "@prisma/orm-toolchain", release: ["latest"] }, - // The toolchain names the framework as an exact peer, so whoever lists - // the toolchain lists the framework too, at the same version. It takes + // The shell lists the framework so it does not rely on the toolchain + // bringing it; from the ORM release after 8.0.0-rc.25 the toolchain + // names it as an exact peer. It takes // the toolchain's version rather than reading its own tag, so a run // during the ORM's publish cannot pin the two apart. { name: "@prisma/orm-framework", sameVersionAs: "@prisma/orm-toolchain" }, From dfdb40a08bfa978c0680e142abcaac0ee0ce4d38 Mon Sep 17 00:00:00 2001 From: willbot Date: Tue, 24 Nov 2026 23:35:54 +1100 Subject: [PATCH 3/3] The shell's import-purity test and the conformance script share one allowed-unimported list v8-conformance.test.ts ran the import-purity check on the built shell without the framework excuse that conformance.ts passes, so it failed on @prisma/orm-framework. Both now read SHELL_ALLOWED_UNIMPORTED from packages/cli/scripts/shell-conformance-inputs.ts. Co-Authored-By: Claude Opus Signed-off-by: willbot Signed-off-by: Will Madden --- packages/cli/scripts/conformance.ts | 14 +++++--------- packages/cli/scripts/shell-conformance-inputs.ts | 6 ++++++ packages/cli/tests/v8-conformance.test.ts | 2 ++ 3 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 packages/cli/scripts/shell-conformance-inputs.ts diff --git a/packages/cli/scripts/conformance.ts b/packages/cli/scripts/conformance.ts index 24f23694f..f3feb3077 100644 --- a/packages/cli/scripts/conformance.ts +++ b/packages/cli/scripts/conformance.ts @@ -36,6 +36,7 @@ import { ormCommandFamily, platformCommandFamily, } from "../src/cli"; +import { SHELL_ALLOWED_UNIMPORTED } from "./shell-conformance-inputs"; const CLI_DIR = fileURLToPath(new URL("..", import.meta.url)); const ENGINE_DIR = join(CLI_DIR, "..", "cli-engine"); @@ -45,11 +46,6 @@ const PRISMA_DIR = join(CLI_DIR, "..", "prisma"); // time out unrelated tests. const WORK_DIR = join(CLI_DIR, "..", "..", ".conformance", "cli"); -// The shell lists the framework so it does not rely on the toolchain -// bringing it (the toolchain peers on it from the ORM release after -// 8.0.0-rc.25). The shell's own code never imports it. -const SHELL_UNIMPORTED = ["@prisma/orm-framework"]; - const CHANNEL: PublishChannel = process.env.PUBLISH_CHANNEL === "dev" ? "dev" : "release"; @@ -64,14 +60,14 @@ async function importPurity(): Promise { label: "@prisma/cli", output: await sweepBuiltOutput(join(CLI_DIR, "dist")), manifest: await manifest(CLI_DIR), - allowedUnimported: SHELL_UNIMPORTED, + allowedUnimported: SHELL_ALLOWED_UNIMPORTED, requiredSpecifiers: ["@prisma/cli-engine", "@prisma/composer-cli/family"], }); const unscoped = checkImportPurity({ label: "prisma", output: await sweepBuiltOutput(join(PRISMA_DIR, "dist")), manifest: await manifest(PRISMA_DIR), - allowedUnimported: SHELL_UNIMPORTED, + allowedUnimported: SHELL_ALLOWED_UNIMPORTED, requiredSpecifiers: ["@prisma/cli-engine", "@prisma/composer-cli/family"], }); const engine = checkImportPurity({ @@ -107,12 +103,12 @@ async function tarball(): Promise { { name: "@prisma/cli", dir: CLI_DIR, - allowedUnimported: SHELL_UNIMPORTED, + allowedUnimported: SHELL_ALLOWED_UNIMPORTED, }, { name: "prisma", dir: PRISMA_DIR, - allowedUnimported: SHELL_UNIMPORTED, + allowedUnimported: SHELL_ALLOWED_UNIMPORTED, }, { name: "@prisma/cli-engine", diff --git a/packages/cli/scripts/shell-conformance-inputs.ts b/packages/cli/scripts/shell-conformance-inputs.ts new file mode 100644 index 000000000..30b9c8866 --- /dev/null +++ b/packages/cli/scripts/shell-conformance-inputs.ts @@ -0,0 +1,6 @@ +// The shell lists the framework so it does not rely on the toolchain +// bringing it (the toolchain peers on it from the ORM release after +// 8.0.0-rc.25). The shell's own code never imports it. +export const SHELL_ALLOWED_UNIMPORTED: readonly string[] = [ + "@prisma/orm-framework", +]; diff --git a/packages/cli/tests/v8-conformance.test.ts b/packages/cli/tests/v8-conformance.test.ts index 8ff2a23c2..a04b2854c 100644 --- a/packages/cli/tests/v8-conformance.test.ts +++ b/packages/cli/tests/v8-conformance.test.ts @@ -18,6 +18,7 @@ import { sweepBuiltOutput } from "@repo/cli-conformance/module-graph"; import { sectionsFrom } from "@repo/cli-conformance/subjects"; import { checkValidatorNoThrow } from "@repo/cli-conformance/validator-no-throw"; import { describe, expect, test } from "vitest"; +import { SHELL_ALLOWED_UNIMPORTED } from "../scripts/shell-conformance-inputs"; import { composerCommandFamily, mountedCommands, @@ -68,6 +69,7 @@ describe("conformance: import purity", () => { label: "@prisma/cli", output, manifest, + allowedUnimported: SHELL_ALLOWED_UNIMPORTED, // Anti-vacuity, and more: these two are the engine boundary this // package exists to compose, so a build that stopped importing // either one is a broken shell rather than a tidy one.