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: Treat issue summary targets optional #1422

Merged
merged 7 commits into from
May 3, 2024
Merged

Fix: Treat issue summary targets optional #1422

merged 7 commits into from
May 3, 2024

Conversation

jssblck
Copy link
Member

@jssblck jssblck commented May 1, 2024

Overview

Companion PR to https://github.com/fossas/FOSSA/pull/12559, fixes https://fossa.atlassian.net/browse/ANE-1738 but in a different way.

Updates the issue summary datatype to treat targets as optional.

Note: I put this in "unreleased" because, since we're also doing the Core-side change, I don't think this is worth the time of going through the release process on its own, and can just go in the next release we perform.

Mostly I just integrated this change on this end for on-premise users and for completeness (if we consider it optional, we should consider it optional on the client side too).

Acceptance criteria

fossa test and fossa report are able to work on first-party-license-scanned builds, without the changes in the linked Core PR.

Testing plan

I tested manually against the current production version of FOSSA:

; fossa test -p {project} --revision {revision} --debug
[DEBUG] Loading configuration file from "/Users/jessica/projects/fossa-cli/"

Using project name: {project}
Using revision: {revision}

[DEBUG] [ Checking build completion for {revision}... ]
[DEBUG] [ Waiting for issue scan completion... ]
[DEBUG] An issue occurred

  *** Relevant Errors ***

      Error: An error occurred when deserializing a response from the FOSSA API:Error in $.summary: key "targets" not found

      Traceback:
        - Calling FOSSA API

[ERROR] An issue occurred

  *** Relevant Errors ***

      Error: An error occurred when deserializing a response from the FOSSA API:Error in $.summary: key "targets" not found

After this change:

; cabal run fossa -- test -p {project} --revision {revision} --debug
[DEBUG] Loading configuration file from "/Users/jessica/projects/fossa-cli/"

Using project name: `{project}`
Using revision: `{revision}`

[DEBUG] [ Checking build completion for {revision}... ]
[DEBUG] [ Waiting for issue scan completion... ]
[DEBUG]

[ERROR]

  ========================================================================
  Tested Following Project:
  ========================================================================


  Project Title: {project}
  Project Revision: {revision}
  Project Visibility: public



  COMPLIANCE ISSUES (Total 4)

  ========================================================================
  Flagged by Policy (Total 4)
  ========================================================================
  { ... omitted project specific details ... }


[DEBUG] An issue occurred

  *** Relevant Errors ***

      Error: The scan has revealed issues. Number of issues found: 4

      Traceback:
        (none)

[ERROR] An issue occurred

  *** Relevant Errors ***

      Error: The scan has revealed issues. Number of issues found: 4

Risks

None

Metrics

None

References

Fixes https://fossa.atlassian.net/browse/ANE-1738

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.

@jssblck jssblck marked this pull request as ready for review May 1, 2024 20:45
@jssblck jssblck requested a review from a team as a code owner May 1, 2024 20:45
@jssblck jssblck requested a review from csasarak May 1, 2024 20:45
Comment on lines 356 to 360
<$> obj
.: "revision"
<*> obj
.: "targets"
.:? "targets"
.!= []
Copy link
Contributor

Choose a reason for hiding this comment

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

[Optional] I think older versions may not, but the newer CI/Fourmolu/HLS 2.7.0.0 should accept:

      <$> obj .: "revision"
      <*> obj .:? "targets" .!= []

Which I think is nicer.

Copy link
Member Author

Choose a reason for hiding this comment

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

omg thank you, added a commit that fixes this across the codebase.

Copy link
Contributor

Choose a reason for hiding this comment

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

Even better than Christmas!

@jssblck jssblck enabled auto-merge (squash) May 3, 2024 19:48
@jssblck jssblck merged commit 2458583 into master May 3, 2024
16 checks passed
@jssblck jssblck deleted the fix/ane1738 branch May 3, 2024 20:19
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