Skip to content

Fetch crates through importCargoLock with an accepted User-Agent - #25

Merged
thedavidmeister merged 1 commit into
mainfrom
2026-09-14-crate-fetch-user-agent
Sep 14, 2026
Merged

thedavidmeister merged 1 commit into
mainfrom
2026-09-14-crate-fetch-user-agent

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

Refs rainlanguage/rainix#377. Replaces the approach in #24.

What

cargoDeps is importCargoLock again, called with a fetchurl that appends --user-agent Nixpkgs to curl. fetchCargoVendor and its hash are gone.

Why

#24 moved crate fetching to fetchCargoVendor, whose hash covers Cargo.lock. The automated release commit that followed (bce8de4, the crate version bump) changed one line of Cargo.lock and the build has failed on a hash mismatch since; every consumer that bumped its rain input today had to pin 91d70ac instead of main. importCargoLock needs no hash, so a version bump cannot break it. Its only problem was the User-Agent: crates.io answers 403 to anything starting with curl/, which is what nixpkgs fetchurl sends, and accepts any other value. Overriding the agent on the fetcher fixes the download; the crate tarballs are fixed-output derivations keyed by content hash, so every cache hit is unchanged.

QA

  • Discriminating tests: n/a, packaging only; the proof is the build.
  • Mutations applied: n/a, no logic changed.
  • Oracle: nix build .#rain on this branch, on top of bce8de4, fetched all 762 crate tarballs and produced the binary; the fetch log for alloy-provider 1.8.3 shows the download completing from the API URL that returns 403 under the default agent. bce8de4 itself fails to build on main.
  • Category check: rainix#377 asks for rain-cli rebuilds to stop 403ing on crate fetches without breaking on every release; covered.

After merge, consumers can point their rain input at main again.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V8ViHcKLVk2YoS2joH4HdN

fetchCargoVendor hashes Cargo.lock, so the release version bump in
bce8de4 broke every build until re-hashed. importCargoLock needs no
hash; it only needs a fetchurl whose User-Agent crates.io accepts.

Refs rainlanguage/rainix#377

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V8ViHcKLVk2YoS2joH4HdN
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 5eb5349d-ea5c-480c-83f8-cfbf1f82831a

📥 Commits

Reviewing files that changed from the base of the PR and between bce8de4 and 7f01fc3.

📒 Files selected for processing (1)
  • flake.nix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thedavidmeister
thedavidmeister merged commit 699a083 into main Sep 14, 2026
5 of 6 checks passed
@thedavidmeister thedavidmeister mentioned this pull request Sep 14, 2026
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