Skip to content

ci: put the Wrangler CLI version under version control - #347

Open
FrameAutomata wants to merge 1 commit into
mainfrom
ci/331-wrangler-lockfile
Open

ci: put the Wrangler CLI version under version control#347
FrameAutomata wants to merge 1 commit into
mainfrom
ci/331-wrangler-lockfile

Conversation

@FrameAutomata

Copy link
Copy Markdown
Collaborator

Closes #331"Real, we should lock down the version".

What was actually unpinned

Nothing in the repo said which Wrangler deploys tracewayapp.com. Neither website/package.json nor docs/package.json depended on wrangler, so the version was an implementation detail of cloudflare/wrangler-action:

action default when wranglerVersion is unset
v3.15.0 (in use today) DEFAULT_WRANGLER_VERSION = "3.90.0"
v4.0.0 (proposed in #344) "4" — a range, so newest 4.x at deploy time

So today it is an exact version nobody chose, and after an action bump it becomes a floating one. Either way the tooling version on a production deploy path lives in someone else's repo.

The mechanism this uses

I read installWrangler rather than assuming (src/wranglerAction.ts on main, and confirmed the same code path is in v3.15.0's dist/index.mjs):

if (!config.didUserProvideWranglerVersion && installedVersion) {
    info("✅ No wrangler version specified, using pre-installed wrangler version …");
    return installedVersion;
}
if (config.didUserProvideWranglerVersion && versionSatisfied) {  }

An already-installed Wrangler wins when the input is absent, and is accepted when it satisfies the input. Both workflows already run npm ci in the same workingDirectory the action is given, so a devDependency lands exactly where the action looks.

That also means this composes with #344 in either merge order: #344 sets wranglerVersion: "3", an installed 3.114.17 satisfies it, so the lockfile still decides.

The change

website/package.json   + "wrangler": "3.114.17"   (exact)
docs/package.json      + "wrangler": "3.114.17"   (exact)
release-helm.yml       + wranglerVersion: "3.114.17"

release-helm.yml has no npm project to hold a lockfile, so it stays the one site that states the version — exactly, not as a bare major. "3" is a range the action re-resolves on every deploy, which is the drift the pin exists to stop.

The real gain is that this is the first version of this that a PR can test. npm ci && npm run build under the ci label now exercises the pinned CLI, on a path that otherwise has no pre-release validation at all.

Why 3.x and not 4

Locking down ≠ migrating. Wrangler 4 is a config migration — website/wrangler.toml is a Worker with main, [assets] and [observability.traces]; docs/wrangler.toml is assets-only — and it deserves its own change. That change is now possible to validate in a PR instead of by deploying to production, which it wasn't before this.

Verification

website $ npx wrangler --version   ->  3.114.17   (from package-lock.json)
docs    $ npx wrangler --version   ->  3.114.17

npm ci && npm run build passes in both.

Not run: the deploys themselves. As established on #331, workflow_dispatch is not a dry run on this path — it publishes to production Cloudflare.

🤖 Generated with Claude Code

Nothing in this repo said which Wrangler deploys tracewayapp.com. Neither
website/package.json nor docs/package.json depended on wrangler, so the
version was whatever cloudflare/wrangler-action defaulted to internally
-- 3.90.0 on v3.15.0, and "4" (a range, so newest 4.x) on v4.0.0. A
production deploy path whose tooling version is an implementation detail
of a third-party action, changing under us on an action bump, is what
#331 is about.

wrangler-action resolves an already-installed Wrangler when the
wranglerVersion input is absent, and when it is present accepts an
installed version that satisfies it (installWrangler in wranglerAction.ts;
the same code path is in v3.15.0's dist bundle, so this holds on the
action major in use today and on v4). Adding wrangler as an exact
devDependency therefore moves the version into package-lock.json, where
npm ci pins it, a PR can change it visibly, and `npm ci && npm run build`
under the ci label exercises it -- on a path that otherwise cannot be
tested before a real release.

  website/  wrangler 3.114.17 (exact)
  docs/     wrangler 3.114.17 (exact)

release-helm.yml has no npm project to hold a lockfile, so it is the one
site that still states the version, and it states it exactly. A bare "3"
would be a range the action re-resolves at deploy time, which is the
drift the pin is meant to stop.

3.x, not 4: this makes the version knowable and testable, which is what
was asked. Wrangler 4 is a config migration (website/wrangler.toml has
main, [assets] and [observability.traces]; docs/ is assets-only) and
wants its own change -- one that is now possible to validate in a PR
instead of by deploying.

Verified: both projects resolve `npx wrangler --version` to 3.114.17
from the lockfile, and `npm ci && npm run build` passes in each.

Closes #331.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
FrameAutomata added a commit that referenced this pull request Aug 28, 2026
"3" is a range wrangler-action re-resolves to the newest 3.x on every
deploy, so as a pin it only bounds the major. #347 puts the CLI version
in website/ and docs/ package-lock.json and pins this job -- the one with
no npm project -- to an exact 3.114.17.

Adopting that block verbatim here, so the two PRs make byte-identical
edits to this file and merge in either order without a conflict. The
only line that differs is the one this PR exists for, @V3 -> @v4.

The docs and website wranglerVersion pins stay as they are: they are the
safety net if this lands before #347, and an installed 3.114.17 satisfies
"3" once it does, so the lockfile still decides. They can be dropped in a
follow-up once both are in.

Refs #326, #331.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

wranglerVersion is pinned to 3 in three release workflows with no owner but a code comment

1 participant