← Back to Pull requests

crate_universe: declare a crate's identity and license as package metadata #4455

Closed
unknown closed this pull request without merging on Nov 24, 2026 00:49 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 20:23 UTC
Author

This change makes generate_rules_license_metadata declare every generated crate through the package_metadata module: a package_metadata target with the crate's purl, pkg:cargo/<name>@<version>, which the package's
default_package_metadata attaches to every target of the crate, and a license attribute 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:license and @crates//serde:package_metadata name 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 %2B as the module's builder would. rules_rust depends on package_metadata in 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_kinds repository of the development extension reads it and records the names in kinds.json. spdx_license_kinds_diff_test keeps src/rendering/spdx_license_kinds.json in step with it and spdx_license_kinds.install updates 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.

Diff: 208 lines (+156 / -52) across 2 files Reviewer: UebelAndre Review duration: 266m
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
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
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
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% 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: 36.4% (MEDIUM) · Higher = larger blast radius
36.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: 60.5% · Lower = rushed or shallow review
60.5%
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: 14.4% · Safe to merge
14.4%