Stage transitive dynamic libraries into binary runfiles #4310
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.46) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 271 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.335
Real PR Conversation Timeline
1 comments
"Review active on #4310"
general
weight: 0.35
krasimirgg
Fixes #4309.
rustc_compile_actionstaged a binary'sCcInfodynamic libraries into its runfiles by walking only the rule's owndepsandlink_deps, while_compute_rpathswalks the full transitive linker-input set. Arust_test(crate = ...)whose crate links a dylib therefore hadDT_NEEDEDfor it and an rpath into the_solib_<cpu>dir, but the file was never shipped, so the test failed at load time on any host without its own copy of the library (sandbox, remote execution, CI):Change
Iterate
dep_info.transitive_noncrates, the same set the rpath computation uses._is_dylibstill keeps only libraries that were linked dynamically, so this adds nothing the binary does not already need, and the existing assertion that acc_library's implicit.sostays out of runfiles when a static alternative exists still holds.Targets that reach the dylib through a
rust_libraryindepsare unchanged:establish_cc_infoalready merges the transitiveCcInfointo that library's provider, so the olddeps-only walk saw those.link_depsare folded intocrate_info.depsand so are covered by the transitive set as well. On Windows the same list feeds the symlink-next-to-binary logic, which now also covers dylibs reached only throughcrate.Test
test/unit/check_runfilesgains acc_importoflibbar.so, arust_librarythat depends on it, and arust_test(crate = ...)of that library. Acc_importputs nothing in its own runfiles, so the only waylibbar.soreaches the test's runfiles is through the staging inrustc_compile_action. The newcheck_runfiles_crate_testasserts it is there; it fails onmainand passes with this change.foo_crate_testitself also builds and runs. Note that it passes onmaintoo when run locally: glibc resolves$ORIGINfrom the binary's real path underbazel-out, so the rpath reaches the build output even though the runfiles tree lacks it. The failure only shows where the execroot is not there, such as remote execution, which is how it went unnoticed.