Skip to content

pkgs/fleet: split dependency compilation out of the glibc variant builds with crane (code#8392) - #8572

Merged
dezren39 merged 1 commit into
mainfrom
buildperf/fleet-crane-split-20261111
Nov 11, 2026
Merged

dezren39 merged 1 commit into
mainfrom
buildperf/fleet-crane-split-20261111

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

What

pkgs/fleet's glibc variants (fleet, fleet-serve, fleet-connect) now compile their registry dependencies as their own derivation per variant (crane buildDepsOnly → cargoArtifacts) instead of recompiling the whole dependency tree inside every variant build on every source change. The root flake gains a crane input (pinned to rev 01bc1d40, the rev the lock graph already carried via rust-flake — the lock diff adds no new upstream source) and make-fleet passes craneLib in.

Kept identical on purpose:

  • Workspace source layout: src is still the pkgs/ fileset, cargo runs from source/fleet; crane vendors from the explicit cargoLock = ./Cargo.lock path (the lockfile is not at the source root here).
  • Check behaviour: buildRustPackage ran the workspace-wide test suite flagless. Crane's default check appends cargoExtraArgs (which carries -p fleet here and would narrow the run to the fleet crate's 27 tests), so the package build sets checkPhaseCargoCommand = "cargoWithProfile test --locked" to keep the workspace-wide run.
  • D7 size gate, full strip, alias symlinks, FLEET_SOURCE_REV / ORT env wiring.

Exceptions (documented in the file header):

  • The two musl static variants stay on buildRustPackage: under pkgsStatic, crane's cargo environment applies crt-static to host build scripts too (a libc build script fails linking glibc's dynamic objects). The statics need crane's cross-toolchain treatment (build-platform toolchain + musl target + per-target CC for -sys crates) before they can split.
  • fleet-brokers stays monolithic: rollback inventory that retires at the epic's close, and its build/test flag split (--bins to build, lib tests to check) does not map onto crane's single cargoExtraArgs without changing which tests run.
  • Callers that pass no craneLib keep the monolith (fallback branch).

Measured (laptop, through ~/tools/fleet-build-lock, 2026-11-11, base 1670d42)

Build Monolith Crane split
Cold ~185s+ to a check-phase failure on the night (full compile + most of the suite; a source change redoes all of it, in every variant) deps layer y22n338d…-fleet-deps + package, 207s for both
One-line source change new single derivation per variant, everything recompiles dry-run: exactly 1 derivation (deps path unchanged — it did not even move when pkgs/fleet/default.nix itself was edited, since the deps key is the cargo files only), 180s, green — the time is workspace crates + the workspace test suite
fleet-connect — green; D7 gate ran in the crane build: bin/fleet is 926728 bytes (gate <= 2097152); alias symlink fleet-connect -> fleet present
fleet-serve — green (147s) after retries against the flake below

Honest remainder: the deps layer is per variant feature set (full / serve / connect are different graphs, and musl would be a fourth) — the split removes the per-source-change recompile, not the per-variant one.

Flake note (pre-existing, not this change)

Tonight the laptop ran at load 6–30 and the workspace suite failed intermittently in BOTH build systems, a different timing-sensitive test each run: atlas-search cli_parity's qvec race (in the atlas PR), fleet-proxy connect_udp EINTR, and four different fleet-queue client::tests::marker_search_* siblings — including in a pristine monolith build of this same base rev. Every failure passed on a later retry. Recorded on code#8392 as a follow-up: that test family races under load.

darwin eval: the change is platform-neutral (craneLib is built per-system inside make-fleet); aarch64-darwin instantiation was not run from this x86_64-linux host.

Refs code#8392.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 07:25
@dezren39
dezren39 merged commit bb1146a into main Nov 11, 2026
0 of 11 checks passed
@dezren39
dezren39 deleted the buildperf/fleet-crane-split-20261111 branch November 11, 2026 07:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T07:26:55.969025Z d9ed5de PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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