Skip to content

Commit 1888687

Browse files
authored
chore(lfs): add resolution error for missing resource (#420)
A common error class for us in lockfileless is inaccessible resources that are needed for the build. This is typically caused by incomplete private package manager configuration, but could theoretically also be caused by a package manager misconfiguration. I believe that in all cases, there is not much we can do on our end. So this PR creates a new type of resolution error to capture these. - [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! - [x] Any accompanying changes in `semgrep-proprietary` are approved and ready to merge once this PR is merged
1 parent e2ba73a commit 1888687

File tree

7 files changed

+400
-2
lines changed

7 files changed

+400
-2
lines changed

semgrep_output_v1.atd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,6 +2599,8 @@ type resolution_error_kind
25992599
(* a lockfile parser failed
26002600
* since semgrep 1.109.0 (to replace dependency_parser_error) *)
26012601
| ScaParseError of sca_parser_name
2602+
(* unable to access private registry, likely due to missing credentials *)
2603+
| ResourceInaccessible of resource_inaccessible
26022604
] <ocaml repr="classic">
26032605

26042606
type resolution_cmd_failed
@@ -2609,6 +2611,17 @@ type resolution_cmd_failed
26092611
message: string;
26102612
}
26112613

2614+
type resource_inaccessible
2615+
<ocaml attr="deriving show">
2616+
<python decorator="dataclass(frozen=True)"> =
2617+
{
2618+
command: string;
2619+
(* we attempt to parse out the actual registry URL that we tried to access *)
2620+
registry_url: string option;
2621+
(* and just include the entire error message too, just in case *)
2622+
message: string;
2623+
}
2624+
26122625
(* used only from pysemgrep for now
26132626
* TODO? we should merge dependency_{parser,resolution}_error with cli_error
26142627
*)

semgrep_output_v1.jsonschema

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.proto

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.py

Lines changed: 55 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.ts

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)