Skip to content

Use installed version licenses for policies - #284

Merged
andrew merged 2 commits into
mainfrom
fix/version-license-policies
Jul 22, 2026
Merged

andrew merged 2 commits into
mainfrom
fix/version-license-policies

Conversation

@andrew

@andrew andrew commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Use license metadata for the installed package version when evaluating git pkgs licenses policies. Fall back to package metadata when version data is unavailable or lockfile resolution is ambiguous.

Update enrichment to v0.6.2 so version license data is available.

Fixes #283

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates git pkgs licenses so license policy evaluation prefers license metadata for the installed/resolved package version when available, and falls back to package-level metadata when version-level data can’t be determined (e.g., ambiguous lockfile resolution). It also bumps the enrichment dependency to ensure version-level license metadata is available.

Changes:

  • Prefer version-level license metadata (installed version) for allow/deny policy checks, with fallback to package-level license data.
  • Add resolution logic to map direct (manifest) dependencies to a single resolved version from lockfiles when unambiguous.
  • Add/extend tests to cover installed-version policy behavior and the resolution rules.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
go.mod Bumps github.com/git-pkgs/enrichment to v0.6.2.
go.sum Updates sums for enrichment v0.6.2.
cmd/licenses.go Uses resolved-version license metadata for policy checks; adds resolution helper and generalizes version-license loader naming.
cmd/licenses_test.go Adds coverage ensuring policies use installed version license when available (and fall back when not).
cmd/licenses_internal_test.go Adds unit tests for resolvedLicenseVersions ambiguity/selection behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/licenses.go Resolved
Comment thread cmd/licenses.go Resolved
@andrew
andrew merged commit 88dbdb1 into main Jul 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

licenses reports the latest release's licence, not the installed version's

2 participants