Skip to content

feat: take the version and checksum from composer.json's extra - #7

Merged
lens0021 merged 1 commit into
mainfrom
claude/composer-extra-mago-version
Aug 15, 2026
Merged

feat: take the version and checksum from composer.json's extra#7
lens0021 merged 1 commit into
mainfrom
claude/composer-extra-mago-version

Conversation

@lens0021

Copy link
Copy Markdown
Contributor

mago is a Rust binary, so a project that installs it from its release archive has no
carthage-software/mago requirement for the version to live in — it states it under extra
instead. chaotic-ground/wikven does exactly that:

"extra": {
    "mago-version": "1.29.0",
    "mago-sha256": "5e99d1232fa93e6adc6feaaddaf2b46c148b2990173cdcf18400b474646bf046"
}

…and then repeats both values in the workflow that installs the tool. This reads them, so the
workflow repeats neither.

What changed

  • extra.mago-version is read first, ahead of composer.lock and the composer.json
    requirement: 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 one value, or an object keyed by target triple,
    which is the honest shape for something that differs per platform.
  • A stated checksum is only offered for the version stated beside it. A workflow pinning a
    different version cannot end up verifying one archive against another's hash, and the sha256
    input still wins over the project's value.
  • The effective checksum is a new sha256 output and part of the cache key, so changing a pin
    re-downloads and re-verifies rather than being handed what an earlier run cached.

Testing

  • test/version-test.sh gains 9 cases: extra detection, extra winning over a lockfile that
    says 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.
  • The detect job installs from test/fixtures/extra and asserts both the version and that the
    archive was verified against the stated checksum, then requires test/fixtures/extra-wrong to
    stop the install — a checksum nothing enforces is worse than none.
  • shellcheck, yamllint, rumdl, typos and zizmor pass locally.

Stacked on nothing: this is independent of #6, which touches only the platform mapping.


Generated by Claude Code

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
lens0021 marked this pull request as ready for review August 15, 2026 05:35
@lens0021
lens0021 merged commit f77c462 into main Aug 15, 2026
17 checks passed
@lens0021
lens0021 deleted the claude/composer-extra-mago-version branch August 15, 2026 05:36
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>
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