Repository navigation
Add license drift detection - #220
Conversation
andrew
left a comment
There was a problem hiding this comment.
Some real concerns before this can land.
Sequential GetVersions loop on cache misses. loadLicenseDriftVersionLicenses iterates missingPackagePURLs and calls client.GetVersions(ctx, packagePURL) one at a time, with a fresh 5-minute timeout per call. On a cold-cache lockfile with hundreds of resolved deps that's hundreds of sequential round-trips. The funding/maintainers PRs (#214, #215) ran into the same shape and resolved it by moving to BulkLookup. There's no bulk-versions API in enrichment so the resolution can't be identical, but at minimum the loop should run through a worker pool with a single shared timeout. Worth checking whether GetVersion (singular, returning just the installed version) is enough — you only need one version's license per package, not the full version list, so smaller responses plus parallel fetch may be the right shape.
--drift silently ignores other flags. runLicenses short-circuits into runLicenseDrift as soon as --drift is set, dropping --permissive, --copyleft, --unknown, --group, --allow, and --deny on the floor. Either reject those combinations explicitly with an error, or restructure so they compose. Silently ignoring is the worst option.
docs/internals.md not updated. The Package Enrichment section enumerates which commands fetch what; licenses --drift adds a new per-version fetch pattern that the section doesn't currently describe (the existing entry assumes package-level only). One sentence near the cache paragraph noting that --drift reads per-version license data from the versions cache and falls back to enrichment.GetVersions on misses would close the gap.
Minor: the drift text output repeats the package name three times — express (npm): express@4.18.2 MIT -> express@5.0.0 GPL-3.0-only. express (npm): 4.18.2 MIT -> 5.0.0 GPL-3.0-only is plenty.
|
Heads-up: #225 just landed and centralizes the user agent string into a package-level |
1318e2c to
791dce2
Compare
fixed.. |
fixed after rebasing onto current main. The drift fetch path now uses |
andrew
left a comment
There was a problem hiding this comment.
All prior asks resolved: loadLicenseDriftVersionLicenses now runs through an 8-worker pool sharing a single 5-minute timeout and uses client.GetVersion instead of the heavier GetVersions; validateLicenseDriftFlags rejects --drift combined with --allow/--deny/--permissive/--copyleft/--unknown/--group with an explicit error; docs/internals.md describes the new per-version cache+fetch behavior; the text output drops the duplicated package name; and the enrichment client uses the centralized userAgent var.
|
Approved — but #215 just landed and touches the same |
791dce2 to
92cefc1
Compare
rebased on current main and resolved the |
Closes #23
Summary
git pkgs licenses --driftto detect resolved dependencies whose installed-version license differs from latest package metadata--driftoption in the READMETests
go test ./cmd -run 'TestLicensesCommand|TestSpdxPermissiveCheck'go test ./...git diff --check