Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

VSI: Special case filtering #407

Merged
merged 12 commits into from
Nov 4, 2021
Merged

VSI: Special case filtering #407

merged 12 commits into from
Nov 4, 2021

Conversation

jssblck
Copy link
Member

@jssblck jssblck commented Oct 22, 2021

Overview

Today when we run filters on analysis targets, we do all the analysis and then filter after the fact. This works, generally, except in the face of very large projects- which are also the ones most commonly run with --enable-vsi. The failure mode in such very large projects is that analysis may take so long to complete that the user gives up, which also blocks our VSI use case (which can support projects of almost arbitrary size- we've successfully scanned projects around the size of AOSP, so millions of files and hundreds of gigabytes of data).

Due to this, this PR adds special casing to the application to unblock VSI scans for very large projects. When the user runs with --enable-vsi and only --only-target vsi, we skip running any other analysis on the project.

If the user provides only-paths or exclude-paths, we still work with that, but if the user provides multiple only-target options we fall back to standard filtering. So this special casing only kicks in when the user provides a single only-target option, and that single option is literally "vsi".

Acceptance criteria

  1. You agree with this.

Testing plan

I ran the following scans. Note that we're looking primarily to ensure that the "Running in VSI only mode" log lines only appear when we run with a single only-target vsi option.

❯ cabal run fossa -- analyze ~/projects/scratch/cpp-demo/example-internal-project --project vsi-only --enable-vsi --only-target vsi
Up to date
[ INFO] Running VSI analysis
[ INFO] Running in VSI only mode, skipping manual source units
[ INFO] Running in VSI only mode, skipping other analyzers
[ INFO]
[ INFO] Using project name: `vsi-only`
[ INFO] Using revision: `0477c1de74fead0461070395ebaa452b601220b0`
[ INFO] Using branch: `main`
[ INFO] ============================================================

      View FOSSA Report:
      https://app.fossa.com/projects/custom+24357%2fvsi-only/refs/branch/main/0477c1de74fead0461070395ebaa452b601220b0

  ============================================================

❯ cabal run fossa -- analyze ~/projects/scratch/cpp-demo/example-internal-project --project vsi-only --enable-vsi --only-target vsi --only-target npm
Up to date
[ INFO] Running VSI analysis
[ INFO]
[ INFO] Using project name: `vsi-only`
[ INFO] Using revision: `0477c1de74fead0461070395ebaa452b601220b0`
[ INFO] Using branch: `main`
[ INFO] ============================================================

      View FOSSA Report:
      https://app.fossa.com/projects/custom+24357%2fvsi-only/refs/branch/main/0477c1de74fead0461070395ebaa452b601220b0

  ============================================================

❯ cabal run fossa -- analyze ~/projects/scratch/cpp-demo/example-internal-project --project vsi-only --enable-vsi
Up to date
[ INFO] Running VSI analysis
[ INFO]
[ INFO] Using project name: `vsi-only`
[ INFO] Using revision: `0477c1de74fead0461070395ebaa452b601220b0`
[ INFO] Using branch: `main`
[ INFO] ============================================================

      View FOSSA Report:
      https://app.fossa.com/projects/custom+24357%2fvsi-only/refs/branch/main/0477c1de74fead0461070395ebaa452b601220b0

  ============================================================

❯ cabal run fossa -- analyze ~/projects/scratch/cpp-demo/example-internal-project --project vsi-only
Up to date
[ERROR] ----------
  An error occurred:

      No analysis targets found in directory.

      Make sure your project is supported. See the user guide for details:
          https://github.com/fossas/spectrometer/blob/master/docs/userguide.md


      Traceback:
        - fossa-analyze

Risks

I don't think this is super risky.

References

Internal slack convo about a POC, DM me for details.

Checklist

  • I added tests for this PR's change (or confirmed tests are not viable).
  • If this PR introduced a user-visible change, I added documentation into docs/.
  • I updated Changelog.md if this change is externally facing. If this PR did not mark a release, I added my changes into an # Unreleased section at the top.
  • I linked this PR to any referenced GitHub issues, if they exist.

@jssblck jssblck requested review from a team and meghfossa and removed request for a team October 22, 2021 18:54
Copy link
Contributor

@meghfossa meghfossa left a comment

Choose a reason for hiding this comment

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

This might be better handled with - https://github.com/fossas/team-analysis/issues/722. If filter, are aptly applied at discovery, we shouldn't have to do these branching for optimization.

If this is time sensitive customer request, go ahead with the merge (and add comment on 722 - to remove this branching in future)

I did not test this locally, but changes seem small enough.

LGTM.

Changelog.md Outdated
@@ -1,5 +1,9 @@
# Spectrometer Changelog

## v2.18.1

- Special cases scans with a single VSI only filter to skip other analysis strategies ([$407](https://github.com/fossas/spectrometer/pull/407))
Copy link
Contributor

Choose a reason for hiding this comment

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

#407 instead of $407

@jssblck jssblck merged commit 9558b3d into master Nov 4, 2021
@jssblck jssblck deleted the vsi-only-special-case branch November 4, 2021 21:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants