Skip to content

Fetch a crate from each forge for real - #53

Merged
jackmarsh merged 2 commits into
mainfrom
test-forge-fetch
Aug 24, 2026
Merged

Fetch a crate from each forge for real#53
jackmarsh merged 2 commits into
mainfrom
test-forge-fetch

Conversation

@jackmarsh

Copy link
Copy Markdown
Collaborator

Follow-up to #21, which is merged. That PR asserted the archive URLs at parse time. This checks the bytes arrive and compile.

What runs now

forge scheme what is proven
codeberg (forgejo/gitea) /archive/<rev>.tar.gz fetched, BUILD files generated, compiled, test passes
gitlab.com /-/archive/<rev>/<name>-<rev>.tar.gz fetched, generated, compiled, test passes
salsa.debian.org gitlab on a host that does not say so, git_forge = "gitlab" archive fetched, name = "debcargo" asserted inside it

The third is the case inference cannot get right, and the only one that exercises the override. It is download-only on purpose: debcargo is a binary with a dependency graph this test has no use for, and 188KB of archive is enough to prove the URL reaches real bytes.

Two things worth a decision

This puts three third-party hosts in the CI path. CI already fetches crates.io for every declaration, so the network is not a new dependency, but codeberg or salsa being down now fails a build here. If that is not wanted, these belong behind a label that CI can exclude, or in rust-corpus instead.

No hashes are pinned. A forge archive is not guaranteed byte-stable; gzip settings have changed under people before, and GitHub regenerated archives in 2023 breaking checksums across the ecosystem. A pinned hash gives integrity and can break on its own. For a crate nothing ships, no hash seemed the better trade, but a consumer pinning a fork should know the risk either way. Worth documenting, and worth its own issue if you want the rules to say something about it.

191 tests pass.

#21 asserted the archive URLs while the package parses, which catches a
wrong scheme but says nothing about whether the bytes arrive, extract to
the layout rust_repo expects, and compile.

Three fetches, one per scheme:

  codeberg          forgejo, github's /archive/ scheme, built and tested
  gitlab.com        /-/archive/<rev>/<name>-<rev>, built and tested
  salsa.debian.org  gitlab on a host whose name does not say so, which is
                    the case inference cannot get right. Download only:
                    the crate behind it is a binary with a dependency
                    graph this has no use for.

These reach three third-party hosts during a test run. CI already
fetches crates.io for every declaration, so the network is not a new
dependency, but codeberg or salsa being down now fails a build here.

No hashes are pinned. A forge archive is not guaranteed byte-stable,
gzip settings have changed under people before, and a hash that breaks
on its own is worse here than no hash on a crate nothing ships.
test/forge_fetch declares its own rust_resolve, and the root
rust_project did not name it, so both crates it declares were in no lock
and their imports resolved to nothing in the editor.

CI caught this rather than a person: the guard added in #20 fails the
build when a dep falls outside every lock, which is exactly what this
was. It was working within two changes of being written.
@jackmarsh
jackmarsh merged commit 376cea9 into main Aug 24, 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.

1 participant