Skip to content

Normalize cached license metadata - #323

Merged
andrew merged 1 commit into
mainfrom
fix/license-cache-normalization
Aug 14, 2026
Merged

andrew merged 1 commit into
mainfrom
fix/license-cache-normalization

Conversation

@andrew

@andrew andrew commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Normalize cached package license values through the same path used for API responses. This keeps online and offline licenses output consistent for SPDX aliases and surrounding whitespace.

Add a regression test covering identical cached and fetched normalization.

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 ensures cached package license values are normalized using the same normalization path as fetched/API license data, keeping licenses output consistent in offline vs online modes (notably for SPDX aliases and leading/trailing whitespace).

Changes:

  • Normalize cached packages.license values via normalizeLicenseString when building licenseData.
  • Refactor fetched license conversion to consistently use normalizeLicenseString (removing inline SPDX normalization logic).
  • Add a regression test asserting cached and fetched normalization match and that whitespace-wrapped SPDX identifiers normalize correctly.

Reviewed changes

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

File Description
cmd/licenses.go Normalizes cached and fetched license strings through normalizeLicenseString for consistent output.
cmd/licenses_internal_test.go Adds regression coverage ensuring cached and fetched license normalization behavior matches.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@andrew
andrew merged commit 28cea76 into main Aug 14, 2026
8 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.

2 participants