From 80145d6d2b2d04c59c8e0ea370c2ca608320d34d Mon Sep 17 00:00:00 2001 From: Matthew McQuaid Date: Fri, 27 Jun 2025 15:30:59 -0700 Subject: [PATCH] update symbol analysis rpc call --- semgrep_output_v1.atd | 2 +- semgrep_output_v1.jsonschema | 3 +-- semgrep_output_v1.proto | 2 +- semgrep_output_v1.py | 6 +++--- semgrep_output_v1.ts | 6 +++--- semgrep_output_v1_j.ml | 40 ++++++------------------------------ 6 files changed, 15 insertions(+), 44 deletions(-) diff --git a/semgrep_output_v1.atd b/semgrep_output_v1.atd index c719aed2..add96b8f 100644 --- a/semgrep_output_v1.atd +++ b/semgrep_output_v1.atd @@ -2661,7 +2661,7 @@ type function_call = [ *) | CallValidate of fpath | CallResolveDependencies of resolve_dependencies_params - | CallUploadSymbolAnalysis of ((* token *) string * (* scan_id *) int * symbol_analysis) + | CallUploadSymbolAnalysis of ((* token *) string * symbol_analysis) | CallDumpRulePartitions of dump_rule_partitions_params | CallGetTargets of scanning_roots (* for now, the transitive reachability filter takes only a single dependency graph as input. diff --git a/semgrep_output_v1.jsonschema b/semgrep_output_v1.jsonschema index 990f7b4f..728fd5fa 100644 --- a/semgrep_output_v1.jsonschema +++ b/semgrep_output_v1.jsonschema @@ -2501,11 +2501,10 @@ { "const": "CallUploadSymbolAnalysis" }, { "type": "array", - "minItems": 3, + "minItems": 2, "items": false, "prefixItems": [ { "type": "string" }, - { "type": "integer" }, { "$ref": "#/definitions/symbol_analysis" } ] } diff --git a/semgrep_output_v1.proto b/semgrep_output_v1.proto index 93f468b6..435c76f5 100644 --- a/semgrep_output_v1.proto +++ b/semgrep_output_v1.proto @@ -1,6 +1,6 @@ // Generated by jsonschema2protobuf. DO NOT EDIT! // Source file: semgrep_output_v1.jsonschema -// Source file sha256 digest: edc2ac117174f61454bce6fcc12a000ab551a15b8533604ce726d6f08ddc17de +// Source file sha256 digest: 1f4b354a8406097a294a8ba9a5fe05e36e91c8aa385806c007e81cf764f746f5 syntax = "proto3"; diff --git a/semgrep_output_v1.py b/semgrep_output_v1.py index 9a396b8e..992078dc 100644 --- a/semgrep_output_v1.py +++ b/semgrep_output_v1.py @@ -10378,7 +10378,7 @@ def to_json_string(self, **kw: Any) -> str: class CallUploadSymbolAnalysis: """Original type: function_call = [ ... | CallUploadSymbolAnalysis of ... | ... ]""" - value: Tuple[str, int, SymbolAnalysis] + value: Tuple[str, SymbolAnalysis] @property def kind(self) -> str: @@ -10386,7 +10386,7 @@ def kind(self) -> str: return 'CallUploadSymbolAnalysis' def to_json(self) -> Any: - return ['CallUploadSymbolAnalysis', (lambda x: [_atd_write_string(x[0]), _atd_write_int(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] + return ['CallUploadSymbolAnalysis', (lambda x: [_atd_write_string(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] def to_json_string(self, **kw: Any) -> str: return json.dumps(self.to_json(), **kw) @@ -10494,7 +10494,7 @@ def from_json(cls, x: Any) -> 'FunctionCall': if cons == 'CallResolveDependencies': return cls(CallResolveDependencies(ResolveDependenciesParams.from_json(x[1]))) if cons == 'CallUploadSymbolAnalysis': - return cls(CallUploadSymbolAnalysis((lambda x: (_atd_read_string(x[0]), _atd_read_int(x[1]), SymbolAnalysis.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) + return cls(CallUploadSymbolAnalysis((lambda x: (_atd_read_string(x[0]), SymbolAnalysis.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) if cons == 'CallDumpRulePartitions': return cls(CallDumpRulePartitions(DumpRulePartitionsParams.from_json(x[1]))) if cons == 'CallGetTargets': diff --git a/semgrep_output_v1.ts b/semgrep_output_v1.ts index abbfb1ab..c4386521 100644 --- a/semgrep_output_v1.ts +++ b/semgrep_output_v1.ts @@ -1192,7 +1192,7 @@ export type FunctionCall = | { kind: 'CallSarifFormat'; value: [SarifFormat, FormatContext, CliOutput] } | { kind: 'CallValidate'; value: Fpath } | { kind: 'CallResolveDependencies'; value: ResolveDependenciesParams } -| { kind: 'CallUploadSymbolAnalysis'; value: [string, number /*int*/, SymbolAnalysis] } +| { kind: 'CallUploadSymbolAnalysis'; value: [string, SymbolAnalysis] } | { kind: 'CallDumpRulePartitions'; value: DumpRulePartitionsParams } | { kind: 'CallGetTargets'; value: ScanningRoots } | { kind: 'CallTransitiveReachabilityFilter'; value: TransitiveReachabilityFilterParams } @@ -4932,7 +4932,7 @@ export function writeFunctionCall(x: FunctionCall, context: any = x): any { case 'CallResolveDependencies': return ['CallResolveDependencies', writeResolveDependenciesParams(x.value, x)] case 'CallUploadSymbolAnalysis': - return ['CallUploadSymbolAnalysis', ((x, context) => [_atd_write_string(x[0], x), _atd_write_int(x[1], x), writeSymbolAnalysis(x[2], x)])(x.value, x)] + return ['CallUploadSymbolAnalysis', ((x, context) => [_atd_write_string(x[0], x), writeSymbolAnalysis(x[1], x)])(x.value, x)] case 'CallDumpRulePartitions': return ['CallDumpRulePartitions', writeDumpRulePartitionsParams(x.value, x)] case 'CallGetTargets': @@ -4968,7 +4968,7 @@ export function readFunctionCall(x: any, context: any = x): FunctionCall { case 'CallResolveDependencies': return { kind: 'CallResolveDependencies', value: readResolveDependenciesParams(x[1], x) } case 'CallUploadSymbolAnalysis': - return { kind: 'CallUploadSymbolAnalysis', value: ((x, context): [string, number /*int*/, SymbolAnalysis] => { _atd_check_json_tuple(3, x, context); return [_atd_read_string(x[0], x), _atd_read_int(x[1], x), readSymbolAnalysis(x[2], x)] })(x[1], x) } + return { kind: 'CallUploadSymbolAnalysis', value: ((x, context): [string, SymbolAnalysis] => { _atd_check_json_tuple(2, x, context); return [_atd_read_string(x[0], x), readSymbolAnalysis(x[1], x)] })(x[1], x) } case 'CallDumpRulePartitions': return { kind: 'CallDumpRulePartitions', value: readDumpRulePartitionsParams(x[1], x) } case 'CallGetTargets': diff --git a/semgrep_output_v1_j.ml b/semgrep_output_v1_j.ml index 78d7e9c6..1adeca2c 100644 --- a/semgrep_output_v1_j.ml +++ b/semgrep_output_v1_j.ml @@ -38733,19 +38733,13 @@ let write_function_call = ( ( fun ob x -> Buffer.add_char ob '['; - (let x, _, _ = x in + (let x, _ = x in ( Yojson.Safe.write_string ) ob x ); Buffer.add_char ob ','; - (let _, x, _ = x in - ( - Yojson.Safe.write_int - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in + (let _, x = x in ( write_symbol_analysis ) ob x @@ -38962,17 +38956,6 @@ let read_function_call = ( x in let x1 = - let x = - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = let x = ( read_symbol_analysis @@ -38994,9 +38977,9 @@ let read_function_call = ( done with Yojson.End_of_tuple -> () ); - (x0, x1, x2) + (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); + Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) p lb in Yojson.Safe.read_space p lb; @@ -39232,17 +39215,6 @@ let read_function_call = ( x in let x1 = - let x = - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = let x = ( read_symbol_analysis @@ -39264,9 +39236,9 @@ let read_function_call = ( done with Yojson.End_of_tuple -> () ); - (x0, x1, x2) + (x0, x1) with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); + Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); ) p lb in Yojson.Safe.read_space p lb;