← Back to Pull requests

fix(tools): derive gopkg.in license URLs when gopkg.in is down #3191

Closed
unknown closed this pull request without merging on Oct 12, 2026 15:31 UTC
View on GitHub
unknown unknown commented on Oct 12, 2026 14:44 UTC
Author

Summary

When gopkg.in is down, the license-URL normalizer now derives the GitHub URL for gopkg.in modules itself instead of failing make notices. A gopkg.in outage no longer turns main red or blocks a release build.

Motivation / Context

On 2026-10-12 gopkg.in returned 502 Proxy Error and timeouts for about 30 minutes. merge-gate's notices-generator failed on main twice, on bcb73fe95 (#3189) and 6cd65debd (#3180), and neither commit touched Go dependencies:

ERROR: no reachable license source URL for gopkg.in/yaml.v3:
  tried (000: Could not resolve host: Unknown): Unknown

go-licenses finds a gopkg.in module's GitHub repository through the go-source tag that gopkg.in serves. When that request fails, go-licenses writes the literal Unknown as the URL (go-licenses v2.0.1 report.go), and the normalizer fails closed on it. make release depends on make notices, so the same outage would also stop a release.

Fixes: N/A
Related: #3189, #3180

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

  • New feature (non-breaking change that adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to change)

  • Documentation update

  • Refactoring (no functional changes)

  • Build/CI/tooling
  • Component(s) Affected

  • CLI (cmd/aicr, pkg/cli)

  • API server (cmd/aicrd, pkg/server)

  • Recipe engine / data (pkg/recipe)

  • Bundler and deployers (pkg/bundler, pkg/component)

  • Collectors / snapshotter (pkg/collector, pkg/snapshotter)

  • Validator (pkg/validator)

  • Core libraries (pkg/errors, pkg/k8s)

  • Docs/examples (docs/, examples/)

  • Other: tools/normalize-go-license-urls (make notices, make release)
  • Implementation Notes

    gopkg.in's naming rule is fixed: gopkg.in/pkg.vN is github.com/go-pkg/pkg, and gopkg.in/user/pkg.vN is github.com/user/pkg. When a row's URL is Unknown and the package is under gopkg.in, the normalizer builds candidate GitHub blob URLs from three sources:

  • The naming rule.

  • The module version from go list -m. Any pseudo-version form resolves to its commit.

  • The license files in the local copy of the module. They are searched in go-licenses' own order (licenses/find.go): the package's directory first, then each parent up to the module root, files in name order, using go-licenses' license file name pattern. The fallback therefore cites the same file a normal run does.
  • The candidates are probed exactly like every other URL. The first reachable one wins, and an inconclusive probe fails the row.

    These still fail the build, as before:

  • any other Unknown URL;

  • a gopkg.in module whose version or local source go cannot resolve;

  • a gopkg.in module with a replace directive ({{if not .Replace}} prints nothing for it).
  • GO_BIN can be overridden like CURL_BIN. The test's curl stub now reports a result for every URL it is given, as real curl does, including the literal Unknown.

    Testing

    make qualify   # clean detached worktree: passed
    

  • Unit: tools/normalize-go-license-urls_test.sh covers:

  • - module paths with and without an owner;
    - all three pseudo-version forms;
    - a subpackage with its own license (the nearer file wins);
    - COPYING before LICENSE, and LICENSE before NOTICE (name order);
    - a LICENSE.md-only module;
    - three cases that must still fail: a non-gopkg.in Unknown, an unresolvable gopkg.in module, and a replaced gopkg.in module.

    Removing each fix from the source makes its case fail. The new cases also fail on main with CI's exact error. shellcheck is clean.

  • replace semantics with real go: in a temp module with replace gopkg.in/yaml.v3 => ./local, the format string prints nothing, so the row fails closed.

  • Real network: the four current gopkg.in modules, fed in as Unknown, resolve to the same URLs go-licenses emits with gopkg.in up. That holds under bash 5 and macOS /bin/bash 3.2.

  • End to end: I ran make notices through a local proxy that refuses only gopkg.in.

  • - On main it fails with CI's error for the same four modules.
    - On this branch it passes, and THIRD_PARTY_NOTICES.md is byte-identical (cmp) to a normal run with gopkg.in reachable.

    Risk Assessment

  • Low — Isolated change, well-tested, easy to revert

  • Medium — Touches multiple components or has broader impact

  • High — Breaking change, affects critical paths, or complex rollout
  • Rollout notes: N/A. Only rows that would otherwise have failed the build are affected.

    Checklist

  • Tests pass locally (make test with -race)

  • Linter passes (make lint)

  • I did not skip/disable tests to make CI green

  • I added/updated tests for new functionality

  • I updated docs if user-facing behavior changed

  • Changes follow existing patterns in the codebase

  • Commits are signed off and cryptographically signed (git commit -s -S) — GPG signing info
  • Diff: 642 lines (+481 / -161) across 8 files Reviewer: lalitadithya Review duration: 46m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 642 lines diff across 8 files
    0.52
    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.387
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3191"
    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: 51.9% (MEDIUM) · Higher = larger blast radius
    51.9%
    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: 20.5% · Safe to merge
    20.5%
    Repository