Skip to content

Land the CLI compatibility contract on main - #14

Closed
kristof-siket wants to merge 2 commits into
mainfrom
fix/current-prisma-cli
Closed

Land the CLI compatibility contract on main#14
kristof-siket wants to merge 2 commits into
mainfrom
fix/current-prisma-cli

Conversation

@kristof-siket

Copy link
Copy Markdown
Collaborator

#13 (version guard, canary workflow, compatibility matrix) was merged while its base still pointed at the stacked fix/current-prisma-cli branch instead of main, so its content never reached main. This PR forwards the branch tip — exactly the reviewed #13 merge, nothing else — to main.

🤖 Generated with Claude Code

kristof-siket and others added 2 commits August 25, 2026 12:16
The 8.0.0-rc.8 command rename broke every released action version at
once because releases float against whatever CLI they find, with no
compatibility contract. Three guardrails:

- A version guard: before deploying with a repository's own prisma
  devDependency, check its version and fail with an error naming the
  supported range (>= 8.0.0-rc.8) instead of CLI.UNKNOWN_COMMAND. An
  unreadable or unparseable version only warns — the guard must never
  break a working deploy over output formatting.
- A daily canary workflow probing prisma@next for the command shape
  the action invokes. `--help` exits 0 even for unknown commands (the
  CLI falls back to the general help), so the probe greps for the
  deploy-specific usage line. It also checks the version guard accepts
  prisma@next, and posts a notice the day a destroy command appears.
- A compatibility matrix and the policy, documented in the README.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add a CLI compatibility contract: version guard, canary, matrix
Comment on lines +16 to +65
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
# Match runs.using in action.yml.
node-version: 24
- uses: oven-sh/setup-bun@v2
- name: Probe the top-level deploy command on prisma@next
# `--help` exits 0 even for an unknown command (the CLI falls back
# to the general help), so the probe greps for the deploy-specific
# usage line instead of trusting the exit code. The general help's
# Examples section shows a bare `$ prisma deploy`, so the marker
# includes `[options]`, which only the command's own help prints.
run: |
out="$(bunx -p prisma@next prisma deploy --help 2>&1)"
echo "$out"
echo "$out" | grep -F '$ prisma deploy [options]'
- name: Version guard accepts prisma@next
# The guard the action applies to a repository's local CLI must
# parse prisma@next's --version output and place it in the
# supported range; a guard that rejects the upcoming release would
# block users the day it ships.
run: |
PROBE_OUTPUT="$(bunx -p prisma@next prisma --version 2>&1)" \
node --input-type=module -e '
import { extractPrismaVersion, isSupportedPrismaVersion, SUPPORTED_PRISMA_RANGE } from "./cli.mjs";
const output = process.env.PROBE_OUTPUT;
console.log(output);
const version = extractPrismaVersion(output);
if (version === null) {
console.error("no version found in prisma --version output — extractPrismaVersion needs updating");
process.exit(1);
}
if (!isSupportedPrismaVersion(version)) {
console.error(`version guard rejects prisma@next (${version}); supported range is ${SUPPORTED_PRISMA_RANGE}`);
process.exit(1);
}
console.log(`version guard accepts prisma@next (${version})`);
'
- name: Watch for a teardown command returning (informational)
# mode: destroy is a documented known limitation while the CLI has
# no teardown command. This step never fails; it surfaces a notice
# the day a destroy command appears so the action can wire it up.
run: |
if bunx -p prisma@next prisma destroy --help 2>&1 | grep -qF '$ prisma destroy'; then
echo "::notice::prisma@next has a top-level destroy command — wire mode: destroy back up"
else
echo "destroy still absent on prisma@next (documented known limitation)"
fi
@kristof-siket

Copy link
Copy Markdown
Collaborator Author

Closing unmerged by decision: the compatibility-guard machinery adds a layer of complexity the action shouldn't carry. The protection model to pursue instead, if ever needed, is making the pinned CLI the only execution path (predefined conditions, net code deletion) rather than guarding a floating local CLI. Main stays as released-fix only (#12).

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