fix(license): treat UNKNOWN-category dependencies as incompatible#548
Open
a-oren wants to merge 1 commit into
Open
fix(license): treat UNKNOWN-category dependencies as incompatible#548a-oren wants to merge 1 commit into
a-oren wants to merge 1 commit into
Conversation
Split the UNKNOWN category check in getCompatibility() so that dependencies with UNKNOWN license category are flagged as incompatible when the project has a known category. Add a distinct reason message for unrecognized licenses recommending manual review. Project-UNKNOWN still returns 'unknown' to avoid false positives. Implements TC-4706 Assisted-by: Claude Code
Reviewer's GuideAdjusts license compatibility logic to treat UNKNOWN-category dependencies as incompatible when the project has a known license category, and introduces targeted tests and user-facing messaging for this new behavior while preserving UNKNOWN-project behavior. Sequence diagram for runLicenseCheck incompatible UNKNOWN dependency reasonsequenceDiagram
participant RunLicenseCheck
participant GetCompatibility
RunLicenseCheck->>GetCompatibility: getCompatibility(projectCategory, entry.category)
GetCompatibility-->>RunLicenseCheck: status
RunLicenseCheck->>RunLicenseCheck: [status === incompatible]
alt entry.category.toUpperCase() === UNKNOWN
RunLicenseCheck->>RunLicenseCheck: reason = License not recognized as a standard SPDX identifier. Manual review recommended to verify compatibility.
else other incompatible
RunLicenseCheck->>RunLicenseCheck: reason = Dependency license(s) are incompatible with the project license.
end
RunLicenseCheck->>RunLicenseCheck: incompatibleDependencies.push({ purl, licenses, category, reason })
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="test/providers/license.test.js" line_range="67-73" />
<code_context>
})
+suite('getCompatibility with UNKNOWN category', () => {
+ /** @type {Array<{proj: string, dep: string, expected: string}>} */
+ const cases = [
+ { proj: 'PERMISSIVE', dep: 'UNKNOWN', expected: 'incompatible' },
+ { proj: 'WEAK_COPYLEFT', dep: 'UNKNOWN', expected: 'incompatible' },
+ { proj: 'STRONG_COPYLEFT', dep: 'UNKNOWN', expected: 'incompatible' },
+ { proj: 'UNKNOWN', dep: 'PERMISSIVE', expected: 'unknown' },
+ { proj: 'UNKNOWN', dep: 'UNKNOWN', expected: 'unknown' },
+ ];
+
</code_context>
<issue_to_address>
**suggestion (testing):** Consider adding tests to confirm UNKNOWN-category handling is case-insensitive.
These cases exercise UNKNOWN vs known categories, but only with uppercase names. Since `getCompatibility` uses `toUpperCase()`, please add at least one test where `proj` and/or `dep` is `'unknown'` (lower or mixed case) to verify the UNKNOWN-specific branches behave correctly with varied input casing.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
Author
Verification Report for TC-4706 (commit 7ccd3fa)
Overall: PASSAll checks pass. One minor note: test doc comments use This comment was AI-generated by sdlc-workflow/verify-pr v0.9.1. |
Strum355
approved these changes
Jun 5, 2026
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.
Summary
getCompatibility()UNKNOWN category check: dependencies with UNKNOWN license category are now flagged as incompatible when the project has a known category (PERMISSIVE, WEAK_COPYLEFT, STRONG_COPYLEFT)'unknown'to avoid false positivesImplements TC-4706
Test plan
getCompatibility('PERMISSIVE', 'UNKNOWN')returns'incompatible'getCompatibility('WEAK_COPYLEFT', 'UNKNOWN')returns'incompatible'getCompatibility('STRONG_COPYLEFT', 'UNKNOWN')returns'incompatible'getCompatibility('UNKNOWN', 'PERMISSIVE')returns'unknown'getCompatibility('UNKNOWN', 'UNKNOWN')returns'unknown'getCompatibility(null, 'UNKNOWN')returns'unknown'Summary by Sourcery
Tighten license compatibility handling for UNKNOWN-category dependencies and surface a clearer incompatibility reason during license checks.
New Features:
Tests: