← Back to Pull requests

cargo: declare build-script tool files and runfiles #4302

Open
unknown opened this pull request with 177 lines diff across 2 files
View on GitHub
unknown unknown commented on Sep 28, 2026 19:55 UTC
Author

Build scripts now register their explicitly declared tools as FilesToRunProvider values in the action's tools list. Bazel stages each executable and its own runfiles at the execution paths used by build_script_env, including when a compiler incoming transition configures the script's runfiles differently from the action's tools.

The regression uses a rust_binary with runtime data generated by write_file. The tool reads that data through Runfiles and rlocation!; the build script clears inherited runfiles environment variables before launching it, so the test exercises the tool's own runfiles. Coverage includes the public macro and an incoming-transition fixture, plus analysis checks for the exact tool execution paths. The fixture uses the default build-setting scope for compatibility with Bazel 7.4.1.

Fixes #4297.

Validation on macOS arm64 after rebasing onto b11ab7e2:

  • All six tests in //cargo/tests/cargo_build_script/tool_inputs:all, //cargo/tests/cargo_build_script/runfiles:all, and //cargo/tests/cargo_build_script/tools_exec:all pass with Bazel 9.3.1 and 7.4.1, sandboxed execution, rustfmt, and clippy. The Bazel 7.4.1 invocation uses --build_runfile_links, matching the minimum-version CI configuration.

  • The revised regression fails with RunfilesDirNotFound before the provider fix and passes after it.

  • Repository pre-commit checks and git diff --check pass.
  • Diff: 177 lines (+132 / -45) across 2 files Reviewer: jrandolf Review duration: 92374m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.42) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 177 lines diff across 2 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.310
    Real PR Conversation Timeline
    1 comments
    "Review active on #4302"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.4% (MEDIUM) · Higher = larger blast radius
    42.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.5% · Safe to merge
    23.5%