Repository navigation
perf/build stamp at binaries - #2109
Merged
Merged
Conversation
zackees
commented
Nov 20, 2026
Member
- refactor(core): split the commit-stamp probe into commit_stamp.rs
- perf(build): stamp the commit in the binaries, not in fbuild-core
- fix(core): keep the git probe out of fbuild-core's test build
- test(cli): annotate the build-stamp test's direct spawns
The git probe and its worktree/packed-refs watch-path helpers move out of fbuild-core's build.rs and build_stamp.rs into commit_stamp.rs, a std-only file outside src/ (it spawns git) that any build.rs can #[path]-include. build_stamp.rs keeps only the embedded-assets digest, which needs sha2. fbuild-core's build.rs still calls commit_stamp::emit, so the stamp is unchanged. The git-layout tests move with the code, and a new test covers the probe degrading to 'unknown' outside a checkout. No behaviour change; this lets the binaries stamp the commit themselves in the next commit.
fbuild-core's build script stamped the checkout commit with
cargo:rustc-env. That value changes on every commit, so every commit
recompiled fbuild-core and, since cargo rebuilds every dependent of a
rebuilt crate, all 19 workspace crates that depend on it. Every hosted
clippy, test and Dylint pass therefore rechecked the whole workspace
whatever the commit touched. On main's Dylint job that was 31-59 zccache
misses per pass and about 2 minutes per run (setup-soldr#682).
fbuild-cli and fbuild-daemon, the top of the crate graph and the two
binaries that report the id, now stamp it in their own build scripts
(commit_stamp.rs) and install it from main into
fbuild_core::build_id::STAMP via build_stamp!(). fbuild-core keeps the
formatting and the embedded-assets digest, which only changes with the
assets. Output is unchanged: --version, daemon status and the no-op
build fingerprint report the same <version>+git.<commit>[-dirty]. A
process that installs no stamp (tests, tools) reports 'unknown', as an
unstamped build always has.
Tests: fbuild-core asserts it is no longer commit-stamped (fails on the
old build script), BuildStamp formatting, and an fbuild-cli integration
test checks the real fbuild --version still carries the checkout commit.
Ci-Attestation: {"at":1795114750,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["382844262884c3dfd0b6736115a0bc14c3483296"],"secs":5848,"stamp":"94f4f385895f4d01b970b86be1d46d3a","tree":"88e1fcb5e707ffeaab70cf9c53bba4ba0a70fb81","v":1,"via":"run"}
Ci-Attestation: {"at":1795114750,"gate":"rust/aarch64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["382844262884c3dfd0b6736115a0bc14c3483296"],"secs":5848,"stamp":"fa790dacfe869282083d4e8e26cf1f54","tree":"88e1fcb5e707ffeaab70cf9c53bba4ba0a70fb81","v":1,"via":"run"}
Ci-Attestation: {"at":1795114750,"gate":"rust/aarch64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["382844262884c3dfd0b6736115a0bc14c3483296"],"secs":5848,"stamp":"54d6de8265b04c50e842aaaad7c81e7e","tree":"88e1fcb5e707ffeaab70cf9c53bba4ba0a70fb81","v":1,"via":"run"}
Ci-Attestation: {"at":1795114750,"gate":"rust/aarch64-unknown-linux-musl/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["382844262884c3dfd0b6736115a0bc14c3483296"],"secs":5848,"stamp":"90435cfa1c7900f8a02d23b52a34fbcb","tree":"88e1fcb5e707ffeaab70cf9c53bba4ba0a70fb81","v":1,"via":"run"}
Ci-Attestation: {"at":1795114750,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["382844262884c3dfd0b6736115a0bc14c3483296"],"secs":5848,"stamp":"39a125cfd60fb7df5a6bf09921644d10","tree":"88e1fcb5e707ffeaab70cf9c53bba4ba0a70fb81","v":1,"via":"run"}
Ci-Attestation: {"at":1795114750,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["382844262884c3dfd0b6736115a0bc14c3483296"],"secs":5848,"stamp":"167ca4123226b16685949513dbeca0b4","tree":"88e1fcb5e707ffeaab70cf9c53bba4ba0a70fb81","v":1,"via":"run"}
Ci-Attestation: {"at":1795114750,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["382844262884c3dfd0b6736115a0bc14c3483296"],"secs":5848,"stamp":"d7665fc3fc37aff6f0f5fe98a0851510","tree":"88e1fcb5e707ffeaab70cf9c53bba4ba0a70fb81","v":1,"via":"run"}
Ci-Attestation: {"at":1795114750,"gate":"rust/x86_64-unknown-linux-musl/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["382844262884c3dfd0b6736115a0bc14c3483296"],"secs":5848,"stamp":"42d006a5e49c618bdbb6433282fca47c","tree":"88e1fcb5e707ffeaab70cf9c53bba4ba0a70fb81","v":1,"via":"run"}
fbuild-core's tests compile commit_stamp.rs through src/, where the
spawn-discipline Dylint (ban_raw_subprocess) rejects its raw git spawn.
The probe and emit() are only ever called from build scripts, so they
are compiled outside cfg(test) only; core's tests keep the git-layout
helpers, and the fbuild-cli integration test covers the probe end to
end through fbuild --version.
Ci-Attestation: {"at":1795130341,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"c5bb97aeb0dbb414d157a17170c182b7","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"70a8515c8b5735bd769ee8393feb9cef","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/aarch64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"d120fa04b2dbc5484646e495e253740a","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/aarch64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"9a70111dfacc12ae81a70faf3ec092a7","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/aarch64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"27d12351ff69f3fe06199a923e4e8b4e","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/aarch64-unknown-linux-gnu/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"0bc46fb798a126c1a8f446803b7850cc","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/aarch64-unknown-linux-musl/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"4f99d3db6f58228184c48ac2be152b69","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/aarch64-unknown-linux-musl/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"8ec2f8bf9cccea458f8c30bbf7f96e20","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"d7ec0da5aa236554d6a04a12c9542d24","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"2f2dd188c0d7d29b375cfd613e2259bc","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"80f4ebfbd66b28e2e0b620fa3fc0bd75","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"17ab0e3d9201fdd79be6651e68bece56","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"80c6079a3ac37063aa51bcf9f3067179","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/x86_64-unknown-linux-gnu/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"b9b0a10b7871f64d4791c0d10f8ee6a0","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/x86_64-unknown-linux-musl/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"1829d9918e7ec8a45520000d3e096260","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
Ci-Attestation: {"at":1795130341,"gate":"rust/x86_64-unknown-linux-musl/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["504e51f05d1adeb4beafccd10e26a0a38b0006fc"],"secs":14616,"stamp":"01405f2a67efeda4ca5490e13a9fdff2","tree":"68b8e60593d467cf3c120234b9afe6b407be627e","v":1,"via":"run"}
The spawn-discipline gate (ci/find_direct_subprocess.py) requires an
allow-direct-spawn reason at every raw Command site, test drivers included.
Ci-Attestation: {"at":1795147568,"gate":"general/all/dylint-policy","host":"linux-x86_64","key":"","lane":"dylint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":6415,"stamp":"ad3a5d8b93c926279aaa638944c9d064","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"21c61dbbc5fbdbfd14cd42a2de33fe9d","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"102c502eb876cd685a3738b2ca11892c","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/aarch64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"3406c0141290229bb7254273f971d258","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/aarch64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"83325a106ee161c4b6f5b55fed23d650","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/aarch64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"240553c732581bea5f7abaeb475feac8","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/aarch64-unknown-linux-gnu/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"aa82ab90206ebc9d447f74d182d62c9a","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/aarch64-unknown-linux-musl/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"59f1b42808d45a475de9e4b71fe6324c","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/aarch64-unknown-linux-musl/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"c203a309667c347914e39f2f9c1e5a75","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"2fbe62b88a4dbb61dab06bb79138800a","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"7802f8da62f801d2499f096e18ed8870","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"550331e801ef8da6f79487d632371fb6","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"8c46c00da6fd7a033c7c45bc9cab6e60","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"2dc18da766fb5e27cdaced71e3a12f87","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/x86_64-unknown-linux-gnu/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"8dd6e2d6ed825d7c4ddc8c3d7489f2a4","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795147568,"gate":"rust/x86_64-unknown-linux-gnu/dylint-library-check","host":"linux-x86_64","key":"","lane":"dylint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":6415,"stamp":"6467f7dd39bf5f26324dceb78b212d37","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795147568,"gate":"rust/x86_64-unknown-linux-gnu/workspace-dylint","host":"linux-x86_64","key":"","lane":"dylint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":6415,"stamp":"61693e4a0124256d235e9de45b397581","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/x86_64-unknown-linux-musl/clippy","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"c0282efdab3ba394a75b759bb8a37743","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
Ci-Attestation: {"at":1795141150,"gate":"rust/x86_64-unknown-linux-musl/dylint","host":"linux-x86_64","key":"","lane":"lint","parents":["c8de588ad19746376f6608d253378c70c5e7e4f0"],"secs":47,"stamp":"d2fa8639ed550a86be884f941d79f3db","tree":"0bb9aae15d440272e13a213bf2b6f800bfc0dca2","v":1,"via":"run"}
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.