Skip to content

vendor: record the forks' crates.io releases and hold vendor/ to them - #341

Open
aimalygin wants to merge 1 commit into
mainfrom
claude/vendored-forks-published
Open

aimalygin wants to merge 1 commit into
mainfrom
claude/vendored-forks-published

Conversation

@aimalygin

Copy link
Copy Markdown
Owner

The seven forks in vendor/ are on crates.io. This PR records that and adds a CI check that holds each copy in vendor/ to its published package. No file under vendor/ changes.

The uploads

All seven were uploaded on 2026-11-23 from 06ad5e23e60da92c7c5e1b12a40baa71de5a05fa, the merge of the PR that named the last three. Each archive records that commit in .cargo_vcs_info.json.

Package Version SHA-256 of the archive
xray-quinn-proto 0.11.1900 9990bffafe7600ffdac6f264ae71b1afbd704a4e778c2a84440abce7d0ec8683
xray-quinn 0.11.1200 fdaab5b088caebdf4ca3bd26496238fa5f15221041dcc431f38132f685d72676
xray-h3 0.0.800 3b887266ea1a0267622118c7ed3ca0a19f4514e90939026f49da2bbab5393fc0
xray-h3-quinn 0.0.1000 6fe202ccf3a931a7c9ac8cc41df30a64c61533bc3cdf619fe27917ee45f4c556
xray-h2 0.4.2000 4e75d77c0b94312d27ad422687771ee3724f24785bbc0761a65b82c95799088d
xray-smoltcp 0.14.0 dae857ff47fec9de345794a15cb1b646c998b9cc1833dc4d8b1b0e2def14d70f
xray-gotatun 0.9.100 fb11358b0aac5c3c7ecfe3473b8726ff9df0f22dc94015aeba95089d85c4f5da

Why a check

The workspace builds the forks from vendor/, by path. A crate published from it will take them from crates.io, by version. The two are the same code only while a copy is what was uploaded under the version in its manifest, and a crates.io version cannot be replaced. Before this PR nothing noticed a copy edited without a new fork release.

What scripts/check-vendored-published.sh does

It runs in the supply-chain job, after the packaging check, and takes about four seconds.

  • It compares. The version in a copy's manifest must not be yanked. Its archive is downloaded, checked against the SHA-256 recorded in the script and compared with the copy, file for file. Four files at the package root are cargo's: the published Cargo.toml.orig has to equal the copy's Cargo.toml, and .cargo_vcs_info.json, the rewritten Cargo.toml and Cargo.lock are left out.
  • It keeps the list of releases. The table in the script names every fork release made from this repository, and the crates.io index has to list exactly those, with the recorded checksums. The workspace names xray-h2 as "0.4.2000" and xray-smoltcp as "0.14.0", requirements that accept a later release, so an upload nobody recorded would reach whoever depends on the fork. Such an upload fails the check.
  • It lets a new release wait. A version in a manifest that is not on crates.io is reported, with a warning on the CI run, and is not a failure. The change that raises a version can be merged before the upload it precedes.

One consequence to know

From an upload until its record is merged, the check fails for every pull request: it cannot tell an upload that is not recorded yet from one nobody made. docs/vendored-forks.md says to record an upload at once and how: the failing run prints the checksum the index lists.

Documents

  • docs/vendored-forks.md: the table shows when and from which commit each fork was uploaded; the checks section describes the new script; "Publishing a fork" ends with the steps that record an upload; a published fork's files change only with a new fork release, Cargo.lock excepted.
  • docs/cargo-publishing.md: steps 3 and 4 of the path are done as far as publishing goes. What stands in the way of publishing the workspace is now the workspace itself, steps 5 to 7.
  • docs/verification.md and CHANGELOG.md name the new check.

Verification

Of the uploads, done before this PR:

  • For each of the seven, the archive cargo uploaded, the checksum in the crates.io API and the archive downloaded back are the same SHA-256.
  • Each downloaded archive equals its copy in vendor/ apart from the four files above. xray-quinn and xray-h3-quinn differ from their copies' manifests by the removed path lines only.
  • docs.rs built the documentation of all seven.
  • A scratch project that takes the seven and shaped-rustls from crates.io by version, with the workspace's features and no paths, passes cargo check with one copy of each.

Of the script:

  • On this tree: held 7 vendored forks to their crates.io releases; 0 wait for an upload.
  • On 20 copies of vendor/ and the script, each changed in one way, it answers as intended. It fails on: a source line added, a manifest field changed, a file added, a file removed, a nested Cargo.toml added, a record removed, a record with a wrong checksum, a record of a version crates.io does not list, a release in the index that is not recorded, a yanked version, an index that answers 503, an archive that answers 404. It passes on: the unchanged tree, a changed Cargo.lock, a raised version (reported as waiting, with the warning when GITHUB_ACTIONS is set), an index with two recorded releases, an index without a final newline. The states crates.io is not in were served by a curl stand-in.
  • The same 20 cases on macOS (bash 3.2, bsdtar) and in a Debian container (bash 5.2, GNU tar and diff), since the packaging script had a fault only GNU tar showed.
  • bash -n for every script; the workflow parses; the script tests that read ci.yml or the changelog pass (check-release-version, check-prerelease-workflow, check-scheduled-interop-workflow, check-v05-host-hardening, test_candidate_ci, test_v07_stable_promotion); gitleaks on the staged change finds nothing.

Not run locally, left to CI: everything that builds. This PR changes one script, one workflow step and documents.

The 20 cases are not committed as a test: they need the network and a stand-in for curl, and the other vendored checks have no tests of their own either.

Not in this PR

  • The workspace's own crates. Their path dependencies on one another have no versions yet; that is the next stage.
  • Exact requirements for xray-h2 and xray-smoltcp. The other five forks are named with =. Whether these two should be is a question for the stage that publishes the workspace; the check added here covers the gap in the meantime.

🤖 Generated with Claude Code

The seven forks in vendor/ were uploaded to crates.io on 2026-11-23, from
06ad5e2:

  xray-quinn-proto 0.11.1900    xray-quinn 0.11.1200
  xray-h3 0.0.800               xray-h3-quinn 0.0.1000
  xray-h2 0.4.2000              xray-smoltcp 0.14.0
  xray-gotatun 0.9.100

The workspace builds them from vendor/, by path. A crate published from it
will take them from crates.io, by version. The two are the same code only
while a copy is what was uploaded under the version in its manifest, and a
crates.io version cannot be replaced.

scripts/check-vendored-published.sh, new in the supply-chain job, holds
that:

- The version in a copy's manifest must not be yanked, and its archive,
  downloaded and checked against the SHA-256 recorded in the script, has to
  equal the copy file for file. Four files at the package root are cargo's:
  the published Cargo.toml.orig has to equal the copy's Cargo.toml, and
  .cargo_vcs_info.json, the rewritten Cargo.toml and Cargo.lock are left
  out.
- The script's table is the list of the fork releases made from this
  repository, and the crates.io index has to list exactly those, with the
  recorded checksums. `xray-h2 = "0.4.2000"` accepts a later 0.4.x, so an
  upload nobody recorded would reach whoever depends on the fork; it fails
  the check.
- A version in a manifest that is not on crates.io is a fork release that
  waits for its upload: reported, with a warning on the CI run, and not a
  failure, so the change that raises a version can be merged before the
  upload.

The documents now say that the forks are published, how an upload is
recorded, and that the files of a published fork change only with a new
fork release, Cargo.lock excepted. No file under vendor/ changes.
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.

1 participant