← Back to Pull requests

build: add script to refresh licenses.yaml versions #20736

Closed
unknown closed this pull request without merging on Oct 28, 2026 02:22 UTC
View on GitHub
unknown unknown commented on Oct 26, 2026 17:13 UTC
Author

Part of #20732.

Description

licenses.yaml records an exact version for every bundled dependency, so every dependency bump needs a hand edit before check-licenses.py passes. This PR adds distribution/bin/refresh-license-versions.py, which makes that edit from the same Maven dependency reports check-licenses.py reads. It is the first licenses.yaml item in #20732. It can be run on a Dependabot branch today, and the release-time step builds on it.

distribution/bin/generate-license-dependency-reports.py . target --clean-maven-artifact-transfer --parallel 2
distribution/bin/refresh-license-versions.py licenses.yaml target/license-reports [--dry-run]

What it changes

For each entry with libraries, it looks up each library in the report of the entry's own module, or in the other modules' reports when its own module does not ship that library (the java-core "AWS SDK for Java 2" entry, for example, lists kinesis, which only druid-kinesis-indexing-service ships). When all libraries of the entry moved to the same new version, it rewrites that entry's version: line. Nothing else in the file changes, so comments, ordering and notice blocks stay byte-identical. The new value keeps the old quotes, and gets quotes when YAML would otherwise read it as a number (2.22).

A version that another entry of the same module registers is never taken, so a stale entry such as jakarta.activation-api 1.2.2 in java-core stays as it is instead of moving onto the 2.1.4 that the current entry registers. When that library is bumped, both entries would move to the new version, so both are listed for a manual edit until the stale one is removed. The same library in different modules (for example PostgreSQL in three extensions) is updated in each.

Entries with skip_dependency_report_check, web-console entries and extensions-contrib/ entries are skipped, since no report covers them.

What it leaves for a person

It prints these entries instead of guessing, and exits non-zero:

  • libraries of one entry moved to different versions, or only some of them moved: the entry needs splitting;

  • a library has several new versions in the report;

  • some libraries moved while others are in no report, so the entry may be stale;

  • some libraries moved while another library only ships at versions other entries register: remove it from this entry;

  • two entries of one module would move the same library to the same version: one of them should go.
  • Shared report reading

    The loop that reads the dependency reports moves out of check_licenses() into read_dependency_reports() in check-licenses.py, so both scripts use it. check-licenses.py behaves as before.

    How it was checked

  • Unit tests for each rule above, in test_check_licenses.py, which the apache-release build already runs.

  • Ran it against real reports generated from current master:

  • - Replay of recent Dependabot PRs: I took licenses.yaml as it was at three earlier commits and compared the script's output with the version edits that were made by hand since.
    - From #20707's version: the same 3 edits (#20699, #20703).
    - From #20673's version: the same 8 edits.
    - From #20671's version: the same 16 edits, including the Google entries realigned in #20673.
    - Each replay also fixes the 6 entries of existing drift described below. The #20673 and #20671 replays list the "Jetbrains jdk7 jdk 8" entry for a manual edit, because three of its libraries are in no report.
    - On the #20707 version, check-licenses.py goes from 15 missing licenses to passing after the refresh.
    - Current master: it updates 6 entries and lists 4. These are existing per-module drift that check-licenses.py does not catch, since it matches versions across all modules (for example Protocol Buffers in java-core registered at 4.36.0 while java-core ships 4.36.2). This PR does not change licenses.yaml; #20737 fixes that drift.

    <hr>

    This PR has:

  • been self-reviewed.

  • added documentation for new or modified features or behaviors.

  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.

  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • Diff: 553 lines (+414 / -139) across 6 files Reviewer: amaechler Review duration: 1989m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 553 lines diff across 6 files
    0.48
    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.378
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #20736"
    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: 48.1% (MEDIUM) · Higher = larger blast radius
    48.1%
    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: 19% · Safe to merge
    19%
    Repository