Skip to content

ci: fetch git-pinned crates shallowly in the splice - #4019

Merged
ScriptedAlchemy merged 2 commits into
masterfrom
ci/cheap-git-crate-fetch
Oct 15, 2026
Merged

ScriptedAlchemy merged 2 commits into
masterfrom
ci/cheap-git-crate-fetch

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Why

Since #3983 pinned asupersync to a git rev, every CI job's crate_universe splice clones the full history of each git dependency into an empty CARGO_HOME. asupersync alone is about 1 GB, and the clone ran past 7 minutes on a hosted runner. #4017 raised the Repository gates limit to 30 minutes as a stopgap.

Cargo's shallow-deps git option fetches only the pinned commit of each git dependency. The splice runs rules_rust's stable host cargo (1.98.0), which ignores unstable options unless RUSTC_BOOTSTRAP=1 is set, so .bazelrc sets both through --repo_env. The mechanism covers every git dependency, so it stays in place after asupersync 0.6.0 reaches crates.io.

Scope

Tradeoffs

  • Nightly host cargo (rust_host_tools.host_tools(version = "nightly/2026-09-27") plus crate.from_cargo(host_tools = ...)) also works without RUSTC_BOOTSTRAP. It downloads a second 418 MB toolchain on every job, because a nightly without pinned checksums never hits the repository cache. Cold build 108 s against 75 s.
  • Caching the cargo git database across runs needs CARGO_BAZEL_ISOLATED=false and a shared CARGO_HOME, and still restores 1.3 GB of history. The shallow fetch is 76 MB.
  • --filter=blob:none has no git config that applies to cargo's URL fetches, and cargo checks out with libgit2, which cannot read a partial clone.

Blast Radius

The variables reach repository rules and module extensions only, not build actions. The generated @c hub is byte-identical before and after. If the 15-minute limit proves too tight, Repository gates times out and blocks merges until the limit goes back up.

Verification

Cold bazel build --config=ci //:rustfmt_check (expunged output base, no MODULE.bazel.lock): 417 s → 75 s. The splice: 389 s → 62 s. Git databases: 1.3 GB → 76 MB.


Devin Review

crate_universe clones every git dependency's full history into an empty
CARGO_HOME on each splice; asupersync alone is about 1 GB. Cargo's
shallow-deps fetch takes only the pinned commits. The splice runs the
stable host cargo, so RUSTC_BOOTSTRAP lets it read the unstable option.

Cold `bazel build --config=ci //:rustfmt_check` locally: 417 s and 364 s
before, 75 s and 76 s after. The generated @c hub is byte-identical.

With the fetch cheap again, restore the 15-minute Repository gates
limit that #4017 raised to 30.
@changeset-bot

changeset-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b7b094f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

The shallow fetch should bring the splice well under 15 minutes, but no CI run has confirmed it yet. Keep #4017's limit until one does.
@ScriptedAlchemy
ScriptedAlchemy merged commit 56a1f81 into master Oct 15, 2026
11 of 20 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