crate_universe: use repository_ctx APIs instead of `cp`/`find` in `local_crate_mirror` #4427
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 253 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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
Diff Size
diff_size
0.331
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4427"
general
weight: 0.35
UebelAndre
Fixes #4426.
Replaces
cp -rand thefind+readloop with a Starlark copy (readdir,read,file) plusrepository_ctx.watch_tree, solocal_crate_mirrorworks on Windows.local_path (external): that test vendors intomktemp -d, and the Linux sandbox hides/tmp.legacy_utf8 = Falsekeeps the copy byte-exact on Bazel 7.watch = "no"becausewatch_treealready covers the tree. With the default watches, deleting a subdirectory of the crate failed the refetch with "Inconsistent filesystem operations".watch_treeis called before the copy, so an edit made during the copy still refetches.repository_ctxcannot read file modes, so every copied file is executable.cp -rkept modes, but this keeps any script a build script runs working.cp -rkept them as links.This does what the #3025 review asked for (no shell,
watch_tree). That review leftwatcherroring on out-of-workspace paths as an open concern; it is retested below.Tested with stock rules_rust 0.75.0 plus this change, using the repro in #4426:
compile_error!fails the build and reverting it builds again. This holds for in-workspace paths and for absolute out-of-workspace paths.repository_ctx.copy(Bazel 10) could replace the walk once that is the minimum version.