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

Fix license file matches #1434

Merged
merged 4 commits into from
May 28, 2024
Merged

Fix license file matches #1434

merged 4 commits into from
May 28, 2024

Conversation

JeffreyHuynh1
Copy link
Contributor

@JeffreyHuynh1 JeffreyHuynh1 commented May 24, 2024

Overview

The changes from pr: Support true forced rebuilds for vendored dependencies, refactor types introduced a bug that caused the contents of the license file matches to be empty.

image-20240515-194646

Before the changes, the license file match contents appeared as:

Screenshot 2024-05-23 at 5 05 01 PM

After some investigation, it was discovered that the revision's license scan type was being set to full_files . This shouldn't have been the case because the given repro case should've had the scan type set to match_data

Note: Refer to the linked ANE ticket for repro case

Acceptance criteria

  • Ensure that the contents of the license file matches are not empty

Testing plan

  • fossa analyze on the project linked in the ANE ticket
  • Check the license file match contents
  • Check that the license scan type is set to the proper type: match_data

Risks

  • No risk

Metrics

References

Checklist

  • I added tests for this PR's change (or explained in the PR description why tests don't make sense).
  • If this PR introduced a user-visible change, I added documentation into docs/.
  • If this PR added docs, I added links as appropriate to the user manual's ToC in docs/README.ms and gave consideration to how discoverable or not my documentation is.
  • If this change is externally visible, I updated Changelog.md. If this PR did not mark a release, I added my changes into an # Unreleased section at the top.
  • If I made changes to .fossa.yml or fossa-deps.{json.yml}, I updated docs/references/files/*.schema.json AND I have updated example files used by fossa init command. You may also need to update these if you have added/removed new dependency type (e.g. pip) or analysis target type (e.g. poetry).
  • If I made changes to a subcommand's options, I updated docs/references/subcommands/<subcommand>.md.

@@ -947,7 +947,7 @@ archiveBuildUpload' apiOpts rebuild archive = context ("archive: '" <> toText ar
(baseUrl, baseOpts) <- useApiOpts apiOpts

let opts = "dependency" =: True <> "rawLicenseScan" =: True
let archiveProjects = ArchiveComponents [archive] rebuild FileUploadFullContent
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the previous code: https://github.com/fossas/fossa-cli/pull/1423/files#diff-a812ed3f7085f40e35cb15511136c5dea108406ba8c21818dde5a4029b9302d5L942

I've changed this to FileUpload to FileUploadMatchData

Copy link
Member

Choose a reason for hiding this comment

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

Since this is an archive upload, why isn't FullContent appropriate here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I changed this to be FileUploadMatchData due to the fact that archiveProjects was set to FullFileUploads False previously. But after looking at Scott's comments on your initial pr, it seems that this was intended bc we shouldn't ever do an archive upload without full files.

That's my fault, changing this back to FileUploadFullContent

@@ -151,7 +151,9 @@ instance ToJSON ArchiveComponents where
toJSON ArchiveComponents{..} =
object
[ "archives" .= archiveComponentsArchives
, "fullFiles" .= archiveComponentsUpload
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the previous code: https://github.com/fossas/fossa-cli/pull/1423/files#diff-78dfaf45d3d47ee1eb7bc8a678e57e40022f78c8c394da5c9adb61582e3c63c4L154

I've changed the json value for archiveComponentsUpload to be set to a boolean.

@JeffreyHuynh1 JeffreyHuynh1 changed the title Fix license scan bug Fix license file matches May 24, 2024
@JeffreyHuynh1 JeffreyHuynh1 marked this pull request as ready for review May 24, 2024 23:34
@JeffreyHuynh1 JeffreyHuynh1 requested a review from a team as a code owner May 24, 2024 23:34
Changelog.md Outdated
@@ -1,7 +1,8 @@
# FOSSA CLI Changelog

## Unreleased
## 3.9.19
Copy link
Member

Choose a reason for hiding this comment

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

lgtm, let's yank 3.9.18 after releasing

@JeffreyHuynh1 JeffreyHuynh1 merged commit 7df6382 into master May 28, 2024
18 checks passed
@JeffreyHuynh1 JeffreyHuynh1 deleted the license-scan-fix branch May 28, 2024 19:55
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.

None yet

2 participants