Land the CLI compatibility contract on main - #14
Closed
kristof-siket wants to merge 2 commits into
Closed
Conversation
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 |
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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#13 (version guard, canary workflow, compatibility matrix) was merged while its base still pointed at the stacked
fix/current-prisma-clibranch instead ofmain, 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