crate_universe: declare a crate's identity and license as package metadata #4455
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 208 lines diff across 2 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.320
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4455"
general
weight: 0.35
UebelAndre
This change makes
generate_rules_license_metadatadeclare every generated crate through thepackage_metadatamodule: apackage_metadatatarget with the crate'spurl,pkg:cargo/<name>@<version>, which the package'sdefault_package_metadataattaches to every target of the crate, and alicenseattribute with the SPDX kind of the crate's license and its license text when the crate ships one. The module records one license per package and has no model for a choice of licenses yet, so a crate offered under several is recorded under the first of them the module has a kind for. Each hub subpackage aliases both targets, so@crates//serde:licenseand@crates//serde:package_metadataname serde's. Generated BUILD files load the rules through@rules_rust//crate_universe/private:package_metadata.bzl, like everything else they load. The purl is a literal: a crate name needs no encoding and of a version only the+before build metadata does, which is written%2Bas the module's builder would. rules_rust depends onpackage_metadatain place of rules_license, whose rules it rendered before.A kind must exist as a target, and the module does not export the BUILD file declaring them, so the
spdx_license_kindsrepository of the development extension reads it and records the names inkinds.json.spdx_license_kinds_diff_testkeepssrc/rendering/spdx_license_kinds.jsonin step with it andspdx_license_kinds.installupdates the table, replacing the generated table's subcommand.The setting stays off by default: the lockfile digest covers the render settings, so turning it on for everyone would repin every workspace on upgrade.