Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Provenance): Add RemoteProvenance sub interface #9476

Closed

Conversation

pepper-jk
Copy link
Contributor

@pepper-jk pepper-jk commented Nov 20, 2024

In preparation to split KnownProvenance hierarchy between the upcoming LocalProvances and the existing RemoteProvenances, both RepositoryProvenance and ArtifactProvance now inherit from the RemoteProvenance interface instead of KnownProvenance.

Conditional types, casts, and conditional cases were adjusted as to fit the new interface hierarchy.

Signed-off-by: Jens Keim [email protected]

@pepper-jk
Copy link
Contributor Author

Hi @sschuberth, do you have any feedback for me yet?

model/src/main/kotlin/Provenance.kt Show resolved Hide resolved
@@ -108,7 +108,7 @@ data class ScannerRun(

init {
scanResults.forEach { scanResult ->
require(scanResult.provenance is KnownProvenance) {
require(scanResult.provenance is RemoteProvenance) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure whether this has to be / should be changed. If the requirement fails, the log message explicitly talks about "an unknown provenance". And as we said it would be fine for the scanner to have the restriction that local provenances can only be scanned if the scanner is executed on the same machine as the analyzer, I think this can stay at KnownProvenance.

Copy link
Member

Choose a reason for hiding this comment

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

More clearly: We should be able to scan non-remote provenance, but not store it in any scan storage, I believe. What's your view @mnonnenmacher?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure whether this has to be / should be changed. If the requirement fails, the log message explicitly talks about "an unknown provenance". [...] I think this can stay at KnownProvenance.

Sounds reasonable. Removed the change.

Keeping the Thread open for @mnonnenmacher 's opinion.

model/src/main/kotlin/licenses/LicenseInfoResolver.kt Outdated Show resolved Hide resolved
@sschuberth
Copy link
Member

Hi @sschuberth, do you have any feedback for me yet?

I had started a review but wasn't able to finish it. I did so now.

@pepper-jk pepper-jk force-pushed the provenance-hierarchy branch from 39d170a to 7a6f396 Compare November 26, 2024 15:34
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 68.08%. Comparing base (5629cd5) to head (4e947ba).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...del/src/main/kotlin/config/PackageConfiguration.kt 0.00% 1 Missing ⚠️
model/src/main/kotlin/utils/PurlExtensions.kt 0.00% 1 Missing ⚠️
...main/kotlin/provenance/NestedProvenanceResolver.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9476      +/-   ##
============================================
- Coverage     68.12%   68.08%   -0.04%     
  Complexity     1292     1292              
============================================
  Files           250      250              
  Lines          8840     8843       +3     
  Branches        917      919       +2     
============================================
- Hits           6022     6021       -1     
- Misses         2431     2434       +3     
- Partials        387      388       +1     
Flag Coverage Δ
funTest-docker 65.14% <ø> (ø)
funTest-non-docker 33.33% <40.00%> (-0.04%) ⬇️
test-ubuntu-24.04 35.74% <0.00%> (-0.02%) ⬇️
test-windows-2022 35.72% <0.00%> (-0.02%) ⬇️

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

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

@pepper-jk pepper-jk force-pushed the provenance-hierarchy branch 2 times, most recently from b823ee6 to e67dac2 Compare November 27, 2024 15:16
@pepper-jk pepper-jk requested a review from sschuberth November 27, 2024 15:20
@pepper-jk
Copy link
Contributor Author

@sschuberth are you happy with the changes I made?

Also any word from @mnonnenmacher and @fviernau regarding your questions?

In preparation to split the `KnownProvenance` hierarchy further, for now
introduce a `RemoteProvenance` that bundles the `RepositoryProvenance` and
`ArtifactProvance`. Later an additional `LocalProvance` will be introduced.

See [1] for context.

[1]: oss-review-toolkit#8803 (comment)

Signed-off-by: Jens Keim <[email protected]>
In some instances, the verification of `KnownProvenance` is
a failsafe before expecting a `RepositoryProvenance` or
`ArtifactProvenance`.
Since these classes are now more strictly `RemoteProvenance`s,
the conditionals are now using the new interface.

All cases of `is KnownProvenance` conditionals were investigated
for this, especially the s, using the _Find Usage_ Feature from
IntelliJ, the recommended IDE for ORT.
Both context of surrounding and calling code was investigated.

Signed-off-by: Jens Keim <[email protected]>
In some instances, the casting to `KnownProvenance` is not
explicitly required by receiving functions, here a more
strict casting to `RemoteProvenance` is cleaner.

All cases of `KnownProvenance` as a cast type were investigated
by the same methods as the previous commit.

Signed-off-by: Jens Keim <[email protected]>
Functions accepting a `KnownProvenance` often only
handle the two explicit cases of `Artifact` or
`RepositoryProvenance`.
Add `else` cases to conditional `when`s.

All conditional cases of `Artifact` and `RepositoryProvenance`
following after `KnownProvenance` as a parameter type were
investigated by the same methods as the previous commits.

Signed-off-by: Jens Keim <[email protected]>
@pepper-jk
Copy link
Contributor Author

Closed in favor of #9860.

@pepper-jk pepper-jk closed this Jan 29, 2025
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.

3 participants