Repository navigation
Use installed version licenses for policies - #284
Merged
Merged
Conversation
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use license metadata for the installed package version when evaluating
git pkgs licensespolicies. Fall back to package metadata when version data is unavailable or lockfile resolution is ambiguous.Update
enrichmentto v0.6.2 so version license data is available.Fixes #283