Skip to content

Commit e4e6f32

Browse files
authored
feat(sca): add unresolved reason and errors to subproject stats (#356)
In semgrep/semgrep-proprietary#2872, we updated the SCA subproject logic to scan only changed subprojects in diff scans. Subprojects that remained unchanged were intentionally left unresolved with the reason UnresolvedSkipped. Previously, we didn't include this information in our subproject stats, leaving us without visibility into why a subproject was unresolved. This PR introduces two optional fields, unresolved_reason and errors, allowing us to capture more granular stats and better understand subproject resolution failures. - [x] I ran `make setup && make` to update the generated code after editing a `.atd` file (TODO: have a CI check) - [x] I made sure we're still backward compatible with old versions of the CLI. For example, the Semgrep backend need to still be able to *consume* data generated by Semgrep 1.50.0. See https://atd.readthedocs.io/en/latest/atdgen-tutorial.html#smooth-protocol-upgrades Note that the types related to the semgrep-core JSON output or the semgrep-core RPC do not need to be backward compatible!
1 parent f7da3e3 commit e4e6f32

7 files changed

+180
-3
lines changed

semgrep_output_v1.atd

+4
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,10 @@ type subproject_stats = {
17301730
dependency_sources: dependency_source_file list;
17311731
(* Results of dependency resolution, empty if resolution failed *)
17321732
?resolved_stats: dependency_resolution_stats option;
1733+
(* Reason why resolution failed, empty if resolution succeeded *)
1734+
?unresolved_reason: unresolved_reason option;
1735+
(* Errors encountered during subproject resolution *)
1736+
~errors: sca_error list
17331737
}
17341738

17351739
type dependency_source_file = {

semgrep_output_v1.jsonschema

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.proto

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.py

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.ts

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1_j.ml

+152-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1_j.mli

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)