feat: take the version and checksum from composer.json's extra - #7
Merged
Conversation
A project that runs mago from its release archive rather than through composer has nowhere to state the version as a dependency, so it states it under extra -- and then repeats it, and the archive's checksum, in every workflow that installs the tool. Two places to change for one upgrade, and a checksum that lives next to the job rather than next to the version it verifies. extra.mago-version is now read first, ahead of the lockfile and the manifest requirement, since stating it there is a statement about the binary where a lockfile entry is about the package. extra.mago-sha256 is read with it, either as one value or as an object keyed by target triple, which is the honest shape for a value that differs per platform. A stated checksum is offered only for the version stated beside it, so a workflow that pins a different version cannot end up verifying one archive against another's hash, and the sha256 input still wins. The effective checksum is now an output and part of the cache key, so a project that changes its pin re-downloads and re-verifies rather than being handed what an earlier run cached. The detect job installs from the new fixtures, checks that the stated checksum is the one the archive was verified against, and requires a wrong one to stop the install -- a checksum nothing enforces is worse than none. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M6rDhYwHnJwtMQn8nPA1de
lens0021
marked this pull request as ready for review
August 15, 2026 05:35
lens0021
pushed a commit
that referenced
this pull request
Aug 15, 2026
🤖 I have created a release *beep* *boop* --- ## [1.1.0](v1.0.0...v1.1.0) (2026-08-15) ### Features * take the version and checksum from composer.json's extra ([#7](#7)) ([f77c462](f77c462)) ### Bugfixes * turn down arm64 Windows instead of fetching an asset that does not exist ([#6](#6)) ([465b927](465b927)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
mago is a Rust binary, so a project that installs it from its release archive has no
carthage-software/magorequirement for the version to live in — it states it underextrainstead.
chaotic-ground/wikvendoes exactly that:…and then repeats both values in the workflow that installs the tool. This reads them, so the
workflow repeats neither.
What changed
extra.mago-versionis read first, ahead ofcomposer.lockand thecomposer.jsonrequirement: stating it there is a statement about the binary, where a lockfile entry is about
the package.
extra.mago-sha256is read with it — either one value, or an object keyed by target triple,which is the honest shape for something that differs per platform.
different
versioncannot end up verifying one archive against another's hash, and thesha256input still wins over the project's value.
sha256output and part of the cache key, so changing a pinre-downloads and re-verifies rather than being handed what an earlier run cached.
Testing
test/version-test.shgains 9 cases:extradetection,extrawinning over a lockfile thatsays something else, and the checksum rules (one value, per-triple object, the entry for another
platform, no entry for this platform, a version nobody stated, a project that states nothing).
It runs on ubuntu, macOS and Windows.
detectjob installs fromtest/fixtures/extraand asserts both the version and that thearchive was verified against the stated checksum, then requires
test/fixtures/extra-wrongtostop the install — a checksum nothing enforces is worse than none.
shellcheck,yamllint,rumdl,typosandzizmorpass locally.Stacked on nothing: this is independent of #6, which touches only the platform mapping.
Generated by Claude Code