Skip to content

model: Introduce the property Package.declaredLicensesOperator - #12487

Open
fviernau wants to merge 3 commits into
mainfrom
package-declared-licenses-operator-property
Open

fviernau wants to merge 3 commits into
mainfrom
package-declared-licenses-operator-property

Conversation

@fviernau

@fviernau fviernau commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

While this PR is part of #11459, it makes sense indepenndently of it.
In #11459 this is a necessary preparation, for not computing the processedDeclaredLicense for uncurated packages anymore.

It adds Package.declaredLicensesOperator, which has been the missing information needed for recomputing the processed declared license from the raw one(s). It make things more straight forward and clear, and simplifies the fix done by #10961.

Part of #11459.

@codecov

codecov Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.18%. Comparing base (44f0a33) to head (8e337ad).

Files with missing lines Patch % Lines
...kage-managers/maven/src/main/kotlin/tycho/Tycho.kt 0.00% 1 Missing ⚠️
...nagers/maven/src/main/kotlin/utils/MavenParsers.kt 0.00% 1 Missing ⚠️
...nagers/maven/src/main/kotlin/utils/MavenSupport.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12487      +/-   ##
============================================
- Coverage     59.21%   59.18%   -0.03%     
  Complexity     1892     1892              
============================================
  Files           366      366              
  Lines         13839    13837       -2     
  Branches       1462     1462              
============================================
- Hits           8195     8190       -5     
- Misses         5115     5118       +3     
  Partials        529      529              
Flag Coverage Δ
funTest-external-tools 16.13% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@mnonnenmacher

Copy link
Copy Markdown
Member

I would appreciate thoughts / comments on this.

IIUC this fixes a bug where incorrect operators are used for some package managers if declared license mappings are applied, so to me it would make sense to have this independent of any other change.

@sschuberth

Copy link
Copy Markdown
Member

Would this also help to fix #10721 in a better way than #10995?

val declaredLicenses: Set<String>,

@JsonInclude(JsonInclude.Include.NON_DEFAULT)
val declaredLicensesOperator: SpdxOperator = SpdxOperator.AND,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As the operator in use should only vary per ecosystem / package manager, does it really make sense to store this on the package level?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it does.

@sschuberth sschuberth Sep 19, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please explain why. Meaning: Not why it's programmatically easier to do so, but why it semantically makes sense. Specifically, it's unclear to me why for an ecosystem that by default uses OR, we should serialize the OR operator for every package.

@fviernau fviernau Sep 19, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Please explain why.

  • The package becomes self contained
  • The decision about the operator remains flexible, and remains in the package manager plugin
  • It would easily possible to allow curating the operator
  • No unnecessary limitations
  • Things are more obvious, regarding declaredLicenses, e.g. the operator is next to it.

@sschuberth sschuberth Sep 19, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm. 1) and 5) are essentially the same thing ("self contained" vs. "next to it"). Likewise for 2) and 4), because "more flexibility" is just a different way to say "fewer limitations". And for 3), I cannot think of a case where this can occur for a single package: If the operator as defined by the package manager implementation is wrong, it's most certainly wrong for all created packages of that package manager.

I'm not saying that for me this concrete proposal is totally out of the question. But so far the arguments are not convincing me fully. But it also depends on how we weight the different aspects, e.g. redundancy / storage vs. explicitness / (potential) flexibility.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Mind sharing your counterarguments?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To repeat what I wrote above:

Specifically, it's unclear to me why for an ecosystem that by default uses OR, we should serialize the OR operator for every package.

To me, storing this per-package is a waste of memory and disk space (for the non-default case) without a clear benefit.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

To me, the benefit is clear, and the amount of added memory and disk scace neglegible, so we are stuck now in discussing this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fine to be overridden. I just cannot (yet) wholeheartedly approve this on my own.

Esp. @mnonnenmacher and @MarcelBochtler, please also share your views, not only on the idea, but also the concrete implementation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm fine to be overridden. I just cannot (yet) wholeheartedly approve this on my own.

yes, I know such situations from myself too, no problem.

Esp. @mnonnenmacher and @MarcelBochtler, please also share your views,

yeah, let's just decide this as a group.

@fviernau

fviernau commented Sep 18, 2026 •

Copy link
Copy Markdown
Member Author

Would this also help to fix #10721 in a better way than #10995?

#10995 does not fix anything, it only adds a test.
I've looked at the test, and the test does not make sense - not in context of this PR and also not independently of that.

@sschuberth did you maybe mix-up the pull-id? e.g. maybe it was #10961?

I suppose it was 10961, so again

Would this also help to fix #10721 in a better way than #10995?

Yes, it not only helps but this PR already cleans up that code, and that is mentioned in the commit message, too.

@fviernau
fviernau force-pushed the package-declared-licenses-operator-property branch 3 times, most recently from 6d9c986 to 04a227d Compare September 18, 2026 23:40
@fviernau
fviernau marked this pull request as ready for review September 18, 2026 23:45
@fviernau
fviernau requested a review from a team as a code owner September 18, 2026 23:45
@fviernau
fviernau requested a review from sschuberth September 18, 2026 23:45
@sschuberth

sschuberth commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

@sschuberth did you maybe mix-up the pull-id? e.g. maybe it was #10961?

No, I was indeed meaning to refer to #10995 as its description says Fixes #10721., but that's actually a false statement because the PR really only adds a test, as you say.

I'll edit that PR's description to clarify.

@fviernau
fviernau force-pushed the package-declared-licenses-operator-property branch 5 times, most recently from a8c06c7 to 0947924 Compare September 21, 2026 12:01
Prepare for an upcoming change.

Signed-off-by: Frank Viernau <frank.viernau@gmail.com>
Any package has two versions of `declaredLicensesProcessed`:

1. The one contained in `AnalyzerResult` as set by the package manager
2. The one in the curated package, which is recomputed from the raw
   declared licenses, when curations get applied, e.g. in
   `OrtResult.kt`.

Add the operator corresponding to the (raw) declared licenses to
`Package`, so that the semantics of these (raw) declared licenses is
clear, and the package self-contained in that regard. Also the code for
re-computing the `declaredLicenseProcessed` in `PackageCurationData`
becomes more straight forward.

Note: This allows for dropping computing the processed license for
uncurated packages entirely, so that the processing happens only as
part of curating an uncurated package.

Signed-off-by: Frank Viernau <frank.viernau@gmail.com>
Signed-off-by: Frank Viernau <frank.viernau@gmail.com>
@fviernau
fviernau force-pushed the package-declared-licenses-operator-property branch from 0947924 to 8e337ad Compare September 22, 2026 06:35
@fviernau

Copy link
Copy Markdown
Member Author

Notes from discussion in dev call:

  • A use case could be:
    • AND is used by package manager, but readme says it's an OR
  • Add tests for usage of OR in declared license processor (maybe also in PackageCurationData)
@fviernau fviernau changed the title model: Introduce the property PackagedeclaredLicensesOperator Oct 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants