Skip to content

feat(release): install release archives with cargo binstall - #2764

Merged
thiras merged 3 commits into
mainfrom
feat/binstall-metadata
Oct 29, 2026
Merged

thiras merged 3 commits into
mainfrom
feat/binstall-metadata

Conversation

@thiras

@thiras thiras commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

What

cargo binstall <crate> now installs the signed release archive instead of compiling.

  • decdn-cli, decdn-node, sponsord and sponsord-onramp each carry [package.metadata.binstall]. Each one names <bin>-<version>-<target>.tar.gz (.zip on Windows) under tag v<version>, with the binary at the archive root.
    • decdn-cli needs an explicit pkg-url. Its archive is named for the decdn binary, and binstall's default patterns use the crate name. The other three would resolve without one, but setting it explicitly means a rename can't silently fall back to binstall's pattern guessing.
  • disabled-strategies = ["quick-install"]: binstall never installs a third-party cargo-quickinstall build. A target with no archive compiles from source (sponsord* off Linux, decdn-node on Windows ARM64).
  • New guard .github/scripts/check-binstall-metadata.sh, run in the packaging job and pre-commit. It reads release.yml's build-binaries matrix and renders each crate's pkg-url, pkg-fmt and bin-dir for every target it ships, including overrides. It fails on any mismatch, and on binstall metadata for a crate the matrix doesn't build.
    • It reads the workflow line by line (stdlib only). The tests parse the real release.yml with pyyaml and compare the two, so the line reader can't drift into a false pass.
  • decdn self-update refuses a binary in ~/.cargo/bin. That message used to name only cargo install --locked decdn-cli, which is wrong advice for a binstall user. It now names both commands.

Follow-up PR: minisign each archive and add [package.metadata.binstall.signing], so binstall verifies what it installs. Until then binstall checks only TLS to GitHub; SECURITY.md says so.

Reviewer notes

  • The metadata only takes effect for a version published to crates.io, so the first release after this merge is the first that binstall installs from archives.
  • The guard is modelled on check_workspace_manifests.py (same wrapper, version guard and main).

Verification

  • Real binstall against the published v0.2.0 archives, using the local manifests with compile disabled, so a URL mismatch would fail rather than build:
    • cargo binstall --manifest-path crates/cli --strategies crate-meta-data --root <tmp> --no-confirm decdn-cli installed decdn 0.2.0. The same for crates/node installed decdn-node 0.2.0.
    • Dry runs with --targets x86_64-pc-windows-msvc, aarch64-pc-windows-msvc and aarch64-apple-darwin all resolved to the release archive (decdn.exe from the zip on Windows).
    • decdn-node on aarch64-pc-windows-msvc, which has no archive, fails with "Fallback to cargo-install is disabled" and doesn't fetch a third-party build.
  • .github/scripts/check-binstall-metadata.sh: binstall metadata OK (15 archives across 6 targets), which matches release.yml's EXPECTED_ARCHIVES. Mutations on the real repo fail it: a renamed matrix binary, and quick-install removed from one crate.
  • uvx --with pyyaml pytest .github/scripts/tests scripts/tests: 337 passed (23 new).
  • cargo nextest run -p decdn-cli --test self_update_cli: 4 passed. cargo clippy -p decdn-cli --all-targets is clean.
  • pre-commit run on the changed files passes. The cargo-deny RUSTSEC-2026-0387 finding is pre-existing and warn-only.

Always:

  • pre-commit run (changed files)
  • CARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-features (left to CI; only decdn-cli Rust changed, and it was clippy'd locally)
  • cargo nextest run (left to CI; ran the touched self_update_cli suite)
  • PR title type and lowercase subject

Only if touched:

  • User-visible change: CHANGELOG.md entry added

🤖 Generated with Claude Code

@thiras thiras self-assigned this Oct 29, 2026
Copilot AI balanced review requested due to automatic review settings October 29, 2026 20:33
Each binary crate (decdn-cli, decdn-node, sponsord, sponsord-onramp) now
carries [package.metadata.binstall] naming the archive release.yml attaches
to the GitHub Release, so `cargo binstall <crate>` downloads it instead of
compiling. decdn-cli needs an explicit pkg-url: its archive is named for the
`decdn` binary, which no default binstall pattern matches. The fallback to
third-party cargo-quickinstall builds is disabled; a target with no archive
compiles from source.

check-binstall-metadata.sh renders each crate's pkg-url, pkg-fmt and bin-dir
for every target the build-binaries matrix ships and fails on drift, in the
packaging job and pre-commit. decdn self-update names `cargo binstall` next to
`cargo install` when it refuses a binary in a cargo bin directory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The metadata guard silently skips valid flow-style matrix rows, allowing it to pass despite incorrect archive URLs and formats for unchecked targets.

1 open issue
What changed in this PR

This PR enables cargo binstall to install deCDN’s release archives instead of compiling supported targets, and adds checks to keep package metadata aligned with the release matrix.

Changes:

  • Add archive metadata for all four binary crates, with Windows overrides where applicable and third-party builds disabled.
  • Add a metadata guard, regression tests, and CI/pre-commit integration.
  • Update installation guidance and self-update messages, including the current signature-verification limitation.
File Description
SECURITY.md Documents binstall’s trust model and manual signature verification.
README.md Updates installation and self-update guidance.
crates/​sponsord/​Cargo.toml Adds sponsorship daemon archive metadata.
crates/​sponsord-onramp/​Cargo.toml Adds onramp archive metadata.
crates/​node/​README.md Documents installation with binstall.
crates/​node/​Cargo.toml Adds node archive metadata and Windows overrides.
crates/​cli/​tests/​self_update_cli.rs Checks that update advice includes binstall.
crates/​cli/​src/​commands/​self_update/​mod.rs Names both Cargo installation commands in update advice.
crates/​cli/​src/​commands/​self_update/​install.rs Updates ownership comments to include binstall.
crates/​cli/​README.md Documents installation with binstall.
crates/​cli/​Cargo.toml Maps the CLI crate to decdn archives.
CHANGELOG.md Records archive installation support.
.pre-commit-config.yaml Registers the metadata guard.
.github/​workflows/​ci.yml Runs the guard in the packaging job.
.github/​scripts/​tests/​test_check_binstall_metadata.py Adds metadata validation and parser regression tests.
.github/​scripts/​check-binstall-metadata.sh Provides the guard’s shell entry point.
.github/​scripts/​check_binstall_metadata.py Validates binstall metadata against the release matrix.

Review effort: Balanced

@github-code-quality

github-code-quality Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Rust, Solidity

Rust / code-coverage/cargo-llvm-cov

main c44dfb2 feat/binstall-metada... e427162 +/-
77% 77% 0%
View coverage of the 3 most impacted files.
File main c44dfb2 feat/binstall-metada... e427162 +/-
crates/client/src/lib.rs 89% 89% 0%
crates/node/src...s/client/mod.rs 91% 91% 0%
crates/node/src/dht/publish.rs 78% 80% +2%

Solidity / code-coverage/forge

main c44dfb2 feat/binstall-metada... e427162 +/-
92% 92% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 29, 2026 21:25 UTC

thiras and others added 2 commits October 29, 2026 23:45
The release-matrix line reader skipped any line inside `include:` that was
not `key: value`, so a flow-style row (`- {target: …, archive: zip}`) went
unchecked while the rows around it passed. Every non-blank line inside
`include:` must now be a `key: value` scalar of a block-style row, at the
row's key indent; a flow row, a nested map or list, a block scalar, an empty
value or a key before the first row is an error naming the line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The guard filled pkg-url, pkg-fmt and bin-dir from one placeholder set, so
`{ bin }` in pkg-url passed while binstall fails to render it and compiles
from source. Each key now gets the placeholders binstall offers it: pkg-url
has no `{ bin }`, bin-dir has no archive placeholders, `{ format }` is the
archive format in one and the binary extension in the other, and a tgz
archive may be spelled `tgz` or `tar.gz`, as binstall tries both.

Windows overrides are keyed by exact target triple. cargo-binstall releases
before cfg support ignore a `cfg(target_os = …)` key and use the base
settings, so the guard now refuses one. It also refuses a non-list
`disabled-strategies`, which binstall cannot parse, and pins release.yml's
archive step lines, so renaming an archive or moving its binary there fails
too. release.yml joins the `scripts` path filter so the YAML cross-check of
the line reader runs when it changes.

Docs: the SECURITY.md binstall section says what binstall trusts and how to
verify the installed binary, since binstall keeps no archive. Install lines
and the self-update hint pass `--locked`, which binstall hands to its source
fallback. The self-update help text and ADR appendix name both cargo tools.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thiras

thiras commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Review round (code, tests, comments, silent failures), addressed in e427162:

  • The guard falsely passed { bin } in pkg-url. binstall offers no { bin } there: it fails to render the template ("missing key bin", reproduced with 1.26.1) and builds from source. Each key now gets binstall's own placeholder set. pkg-url has no { bin }. bin-dir has no archive placeholders. { format } is the archive format in pkg-url and the binary extension in bin-dir. For a tgz archive, tgz and tar.gz both pass, since binstall tries both.
  • The Windows overrides are now keyed by exact triple (x86_64-pc-windows-msvc, plus aarch64-pc-windows-msvc for the CLI). Releases from before binstall supported cfg(…) keys ignore them, so the guard now refuses one. I re-ran the dry runs against v0.2.0: cli linux/win-x64/win-arm64 and node win-x64/mac-arm64 all resolve to the release archives.
  • More guard checks:
    • It pins release.yml's archive step lines, so renaming an archive or moving its binary there now fails the guard.
    • It refuses a non-list disabled-strategies, which binstall can't parse.
    • release.yml joins the scripts path filter, so the pyyaml cross-check runs when release.yml changes.
  • Tests: 46 tests now, up from 30. They add the empty matrix, missing keys, per-key override merging, an override for an unbuilt target, a misspelled triple, and each placeholder rule. Each unsupported-line case now asserts its own line. The tests for the new behaviour fail against the previous guard.
  • Docs:
    • SECURITY.md said to "check the archive", but binstall keeps no archive. It now says what binstall trusts and gives a binary-hash recipe.
    • The install lines and the self-update hint pass --locked, which binstall hands to its source-build fallback.
    • The README says cargo-binstall must be installed first.
    • The self-update --help text and the ADR appendix name both cargo tools.

Not changed: pinning repository to decdn/decdn. check_workspace_manifests.py already refuses a crate that restates it, and changing the root value would be deliberate.

@thiras
thiras merged commit 55cd383 into main Oct 29, 2026
39 checks passed
@thiras
thiras deleted the feat/binstall-metadata branch October 29, 2026 21:30
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