Skip to content

Accept a pinned version with or without the leading v - #29

Merged
mattpodwysocki merged 2 commits into
mainfrom
version-prefix
Sep 18, 2026
Merged

mattpodwysocki merged 2 commits into
mainfrom
version-prefix

Conversation

@mattpodwysocki

Copy link
Copy Markdown
Contributor

From @zmofei's review on #27, plus the gap his #26 comment exposed.

The bug

The channel's directories are named v0.2.1, and MAPBOX_CLI_VERSION went into the URL untouched:

$ MAPBOX_CLI_VERSION=0.2.1 …
curl: (56) The requested URL returned error: 403
mapbox-cli: could not read https://cli.mapbox.com/0.2.1/manifest.json

Every place a person reads a version from shows it without the vmapbox --version, CHANGELOG.md, Cargo.toml. So the only spelling that worked was the one nobody sees, and the failure was a bare S3 403, which reads as "you are not allowed" rather than "no such version".

The fix, rather than a note about it

The review asked for a note near the version section. A note documents a trap; this removes it. Both installers prepend the v when the value starts with a digit:

case "$VERSION" in
    [0-9]*) VERSION="v${VERSION}" ;;
esac

A leading digit is the signal, so latest — and any future channel name — is left alone.

Verified against the live channel:

0.2.1    -> Installed mapbox 0.2.1
v0.2.1   -> Installed mapbox 0.2.1
latest   -> Installed mapbox 0.2.1

Two cases added to each installer suite, including one that pins latest, because getting that wrong would break the default install rather than an edge case. Both confirmed to fail with the fix reverted — could not read …/0.1.0-dev.abc1234/manifest.json in bash, the same in PowerShell.

And the variable is documented now

This is the other half, and it came from the #26 comment. MAPBOX_CLI_VERSION appeared in no .md anywhere in the repo — so suggesting people use it was suggesting something they had no way to discover. It now sits in the install section alongside MAPBOX_INSTALL_DIR, which was also undocumented:

curl -fsSL https://cli.mapbox.com/install.sh | MAPBOX_CLI_VERSION=0.2.1 sh

601 Rust tests, both installer suites green, fmt clean, no broken anchors.

zmofei
zmofei previously approved these changes Sep 17, 2026
zmofei
zmofei previously approved these changes Sep 18, 2026
Reported on #27. The channel's directories are named `v0.2.1`, and
`MAPBOX_CLI_VERSION` went into the URL untouched — so the spelling a person
would actually copy failed:

    $ MAPBOX_CLI_VERSION=0.2.1 …
    curl: (56) The requested URL returned error: 403
    mapbox-cli: could not read https://cli.mapbox.com/0.2.1/manifest.json

Every place a version is read from shows it without the `v`: `mapbox
--version`, CHANGELOG.md, Cargo.toml. So the one spelling that worked was
the one nobody sees, and the failure was a bare S3 `403`, which reads as
"you are not allowed" rather than "no such version".

The review asked for a note about it. A note documents a trap; this removes
it. Both installers now prepend the `v` when the value starts with a digit,
which leaves `latest` — and any other channel name — alone, since only a
leading digit means a version number is being named.

Verified against the live channel: `0.2.1`, `v0.2.1` and `latest` all install
0.2.1. Two cases added to each installer suite, including one pinning
`latest` because getting that wrong would break the default install rather
than an edge case. Both confirmed to fail with the fix reverted.

**And the variable is now documented at all**, which is the other half of
this. `MAPBOX_CLI_VERSION` appeared in no `.md` in the repository — the
reviewer on #26 suggested using it, which is how I found that a reader had no
way to know it exists. It goes in the install section with
`MAPBOX_INSTALL_DIR`, which was also undocumented.

601 tests, both installer suites green, fmt clean, no broken anchors.
CI went red on the previous commit for a reason worth recording rather than
just fixing: `PSUseBOMForUnicodeEncodedFile` fails a non-ASCII `.ps1` that
carries no BOM, and the em-dash in my new comment was the first non-ASCII
byte the file had ever contained.

Both `.ps1` files were ASCII-clean before this branch and are again. The
comment says so, so the next person writing prose in there knows the
constraint exists before CI tells them.

Also ran PSScriptAnalyzer locally with ci.yml's exact rule set — the same
exclusions and the same `PSUseCompatibleSyntax` 5.1/7.0 pair — rather than
pushing and hoping. Clean on both files.
@mattpodwysocki
mattpodwysocki merged commit 52f4b46 into main Sep 18, 2026
8 checks passed
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.

3 participants