carrick 0.3.107 → 0.3.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -542,9 +542,77 @@ export interface BundleResponse extends BaseResponse {
542
542
  export interface InferResponse extends BaseResponse {
543
543
  /** Successfully inferred types */
544
544
  inferred_types?: InferredType[];
545
+ /** How long the requests took, and which were slowest (carrick#1985) */
546
+ infer_timing?: InferTiming;
545
547
  /** General errors */
546
548
  errors?: string[];
547
549
  }
550
+ /**
551
+ * How long one request of an `infer` batch took (carrick#1985).
552
+ *
553
+ * It names the request and measures its answer. It never holds the answer:
554
+ * the type a request printed is here as a length only.
555
+ */
556
+ export interface InferSlotTiming {
557
+ /** The alias the request carried, when it carried one */
558
+ alias?: string;
559
+ /** The file the request named, as it named it */
560
+ file_path: string;
561
+ /** The line the request named */
562
+ line_number: number;
563
+ /** The kind of inference the request asked for */
564
+ infer_kind: InferKind;
565
+ /**
566
+ * Wall time, in milliseconds, from the batch taking the request up to it
567
+ * keeping the request's answer or its error.
568
+ */
569
+ ms: number;
570
+ /**
571
+ * Of `ms`, the time in the compiler call that computes the type: a
572
+ * function's `getReturnType()`, a parameter's `getType()`. It is told
573
+ * apart for `signature_return` and `function_param`, and is 0 for the
574
+ * other kinds, whose time in the compiler stays in `ms` alone.
575
+ */
576
+ type_ms: number;
577
+ /**
578
+ * Of `ms`, the time in the inferrer's print of a type to text. Truncation
579
+ * is off, so a type is printed at its whole length. For
580
+ * `signature_return` and `function_param` this is every print the request
581
+ * makes; the other kinds also print through the structural expander, and
582
+ * that time stays in `ms` alone.
583
+ */
584
+ print_ms: number;
585
+ /** Characters in the `type_string` the request printed; 0 when it printed none */
586
+ printed_length: number;
587
+ /**
588
+ * No earlier request named this file to the project that answered. Such a
589
+ * request does the work the file's later ones reuse: the index of the
590
+ * file's functions, and every type the checker resolves on the way that it
591
+ * had not resolved before.
592
+ */
593
+ first_in_file: boolean;
594
+ }
595
+ /**
596
+ * The timing of the requests of one `infer` batch (carrick#1985).
597
+ */
598
+ export interface InferTiming {
599
+ /** Requests the batch was done with: answered, refused, skipped or failed */
600
+ slots: number;
601
+ /** Their wall times, added up, in milliseconds */
602
+ slots_ms: number;
603
+ /** Of `slots_ms`, the time computing types (each request's `type_ms`) */
604
+ type_ms: number;
605
+ /** Of `slots_ms`, the time printing types (each request's `print_ms`) */
606
+ print_ms: number;
607
+ /** How many of them were the first asked of their file */
608
+ first_in_file_slots: number;
609
+ /** The wall times of those, added up, in milliseconds */
610
+ first_in_file_ms: number;
611
+ /** The slowest requests, slowest first: `SLOWEST_SLOTS` of them at most */
612
+ slowest: InferSlotTiming[];
613
+ /** The request that printed the longest type; absent when none printed one */
614
+ longest_printed?: InferSlotTiming;
615
+ }
548
616
  /**
549
617
  * Response for resolve_definitions action
550
618
  */
@@ -934,6 +1002,8 @@ export interface InferResult {
934
1002
  success: boolean;
935
1003
  /** Successfully inferred types */
936
1004
  inferred_types?: InferredType[];
1005
+ /** How long each request took, summed up (carrick#1985) */
1006
+ timing: InferTiming;
937
1007
  /** General error messages */
938
1008
  errors?: string[];
939
1009
  }
@@ -305,6 +305,7 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
305
305
  span_end: z.ZodOptional<z.ZodNumber>;
306
306
  line_number: z.ZodOptional<z.ZodNumber>;
307
307
  expression_text: z.ZodOptional<z.ZodString>;
308
+ param_name: z.ZodOptional<z.ZodString>;
308
309
  unwrap: z.ZodOptional<z.ZodEnum<["awaited", "none"]>>;
309
310
  }, "strip", z.ZodTypeAny, {
310
311
  kind: "infer";
@@ -315,6 +316,7 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
315
316
  span_start?: number | undefined;
316
317
  span_end?: number | undefined;
317
318
  expression_text?: string | undefined;
319
+ param_name?: string | undefined;
318
320
  unwrap?: "awaited" | "none" | undefined;
319
321
  }, {
320
322
  kind: "infer";
@@ -325,6 +327,7 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
325
327
  span_start?: number | undefined;
326
328
  span_end?: number | undefined;
327
329
  expression_text?: string | undefined;
330
+ param_name?: string | undefined;
328
331
  unwrap?: "awaited" | "none" | undefined;
329
332
  }>, z.ZodObject<{
330
333
  kind: z.ZodLiteral<"literal">;
@@ -375,10 +378,6 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
375
378
  tsconfig_path: z.ZodOptional<z.ZodString>;
376
379
  scan_root: z.ZodOptional<z.ZodString>;
377
380
  }, "strip", z.ZodTypeAny, {
378
- request_id: string;
379
- action: "capture_v2";
380
- repo_root: string;
381
- service_name: string;
382
381
  anchors: ({
383
382
  kind: "symbol";
384
383
  symbol_name: string;
@@ -401,6 +400,7 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
401
400
  span_start?: number | undefined;
402
401
  span_end?: number | undefined;
403
402
  expression_text?: string | undefined;
403
+ param_name?: string | undefined;
404
404
  unwrap?: "awaited" | "none" | undefined;
405
405
  } | {
406
406
  kind: "literal";
@@ -415,14 +415,14 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
415
415
  }[] | undefined;
416
416
  raw_text_read?: true | undefined;
417
417
  })[];
418
- out_dir: string;
419
- tsconfig_path?: string | undefined;
420
- scan_root?: string | undefined;
421
- }, {
422
418
  request_id: string;
423
419
  action: "capture_v2";
424
420
  repo_root: string;
425
421
  service_name: string;
422
+ out_dir: string;
423
+ tsconfig_path?: string | undefined;
424
+ scan_root?: string | undefined;
425
+ }, {
426
426
  anchors: ({
427
427
  kind: "symbol";
428
428
  symbol_name: string;
@@ -445,6 +445,7 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
445
445
  span_start?: number | undefined;
446
446
  span_end?: number | undefined;
447
447
  expression_text?: string | undefined;
448
+ param_name?: string | undefined;
448
449
  unwrap?: "awaited" | "none" | undefined;
449
450
  } | {
450
451
  kind: "literal";
@@ -459,6 +460,10 @@ export declare const CaptureV2RequestSchema: z.ZodObject<{
459
460
  }[] | undefined;
460
461
  raw_text_read?: true | undefined;
461
462
  })[];
463
+ request_id: string;
464
+ action: "capture_v2";
465
+ repo_root: string;
466
+ service_name: string;
462
467
  out_dir: string;
463
468
  tsconfig_path?: string | undefined;
464
469
  scan_root?: string | undefined;
@@ -2088,6 +2093,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2088
2093
  span_end: z.ZodOptional<z.ZodNumber>;
2089
2094
  line_number: z.ZodOptional<z.ZodNumber>;
2090
2095
  expression_text: z.ZodOptional<z.ZodString>;
2096
+ param_name: z.ZodOptional<z.ZodString>;
2091
2097
  unwrap: z.ZodOptional<z.ZodEnum<["awaited", "none"]>>;
2092
2098
  }, "strip", z.ZodTypeAny, {
2093
2099
  kind: "infer";
@@ -2098,6 +2104,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2098
2104
  span_start?: number | undefined;
2099
2105
  span_end?: number | undefined;
2100
2106
  expression_text?: string | undefined;
2107
+ param_name?: string | undefined;
2101
2108
  unwrap?: "awaited" | "none" | undefined;
2102
2109
  }, {
2103
2110
  kind: "infer";
@@ -2108,6 +2115,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2108
2115
  span_start?: number | undefined;
2109
2116
  span_end?: number | undefined;
2110
2117
  expression_text?: string | undefined;
2118
+ param_name?: string | undefined;
2111
2119
  unwrap?: "awaited" | "none" | undefined;
2112
2120
  }>, z.ZodObject<{
2113
2121
  kind: z.ZodLiteral<"literal">;
@@ -2158,10 +2166,6 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2158
2166
  tsconfig_path: z.ZodOptional<z.ZodString>;
2159
2167
  scan_root: z.ZodOptional<z.ZodString>;
2160
2168
  }, "strip", z.ZodTypeAny, {
2161
- request_id: string;
2162
- action: "capture_v2";
2163
- repo_root: string;
2164
- service_name: string;
2165
2169
  anchors: ({
2166
2170
  kind: "symbol";
2167
2171
  symbol_name: string;
@@ -2184,6 +2188,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2184
2188
  span_start?: number | undefined;
2185
2189
  span_end?: number | undefined;
2186
2190
  expression_text?: string | undefined;
2191
+ param_name?: string | undefined;
2187
2192
  unwrap?: "awaited" | "none" | undefined;
2188
2193
  } | {
2189
2194
  kind: "literal";
@@ -2198,14 +2203,14 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2198
2203
  }[] | undefined;
2199
2204
  raw_text_read?: true | undefined;
2200
2205
  })[];
2201
- out_dir: string;
2202
- tsconfig_path?: string | undefined;
2203
- scan_root?: string | undefined;
2204
- }, {
2205
2206
  request_id: string;
2206
2207
  action: "capture_v2";
2207
2208
  repo_root: string;
2208
2209
  service_name: string;
2210
+ out_dir: string;
2211
+ tsconfig_path?: string | undefined;
2212
+ scan_root?: string | undefined;
2213
+ }, {
2209
2214
  anchors: ({
2210
2215
  kind: "symbol";
2211
2216
  symbol_name: string;
@@ -2228,6 +2233,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2228
2233
  span_start?: number | undefined;
2229
2234
  span_end?: number | undefined;
2230
2235
  expression_text?: string | undefined;
2236
+ param_name?: string | undefined;
2231
2237
  unwrap?: "awaited" | "none" | undefined;
2232
2238
  } | {
2233
2239
  kind: "literal";
@@ -2242,6 +2248,10 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
2242
2248
  }[] | undefined;
2243
2249
  raw_text_read?: true | undefined;
2244
2250
  })[];
2251
+ request_id: string;
2252
+ action: "capture_v2";
2253
+ repo_root: string;
2254
+ service_name: string;
2245
2255
  out_dir: string;
2246
2256
  tsconfig_path?: string | undefined;
2247
2257
  scan_root?: string | undefined;
@@ -3650,3 +3660,31 @@ export type ValidatedInferRequest = z.infer<typeof InferRequestSchema>;
3650
3660
  export type ValidatedHealthRequest = z.infer<typeof HealthRequestSchema>;
3651
3661
  export type ValidatedShutdownRequest = z.infer<typeof ShutdownRequestSchema>;
3652
3662
  export type ValidatedSidecarRequest = z.infer<typeof SidecarRequestSchema>;
3663
+ /** Every key any member of a union declares. */
3664
+ type KeysOfAny<Union> = Union extends unknown ? keyof Union : never;
3665
+ /** What `Key` holds, across the members of a union that declare it. */
3666
+ type ValueAt<Union, Key extends PropertyKey> = Union extends unknown ? Key extends keyof Union ? Union[Key] : never : never;
3667
+ /** The members of `Other` with the tag `One` has, when `One` has one. */
3668
+ type SameVariant<One, Other> = One extends {
3669
+ action: infer Tag;
3670
+ } ? Extract<Other, {
3671
+ action: Tag;
3672
+ }> : One extends {
3673
+ kind: infer Tag;
3674
+ } ? Extract<Other, {
3675
+ kind: Tag;
3676
+ }> : Other;
3677
+ /**
3678
+ * The keys of `One` that `Other` does not declare, each as the path that
3679
+ * reaches it; `never` when there are none.
3680
+ */
3681
+ type UndeclaredKeys<One, Other, At extends string = ''> = One extends readonly (infer Item)[] ? UndeclaredKeys<Item, Other extends readonly (infer Element)[] ? Element : never, `${At}[]`> : One extends object ? {
3682
+ [Key in keyof One & string]-?: Key extends KeysOfAny<SameVariant<One, Other>> ? UndeclaredKeys<One[Key], ValueAt<SameVariant<One, Other>, Key>, `${At}.${Key}`> : `${At}.${Key}`;
3683
+ }[keyof One & string] : never;
3684
+ /** Compiles for `never` alone. */
3685
+ type None<Paths extends never> = Paths;
3686
+ /** A key a handler may read that the schema would drop. */
3687
+ export type KeysTheSchemaDrops = None<UndeclaredKeys<SidecarRequest, ValidatedSidecarRequest>>;
3688
+ /** A key the schema lets through that no handler's type knows. */
3689
+ export type KeysNoHandlerKnows = None<UndeclaredKeys<ValidatedSidecarRequest, SidecarRequest>>;
3690
+ export {};
@@ -176,6 +176,10 @@ const CaptureAnchorRequestSchema = z.discriminatedUnion('kind', [
176
176
  span_end: z.number().int().nonnegative().optional(),
177
177
  line_number: z.number().int().positive().optional(),
178
178
  expression_text: z.string().optional(),
179
+ // Any string, the empty one included: a name no parameter has is the
180
+ // capture's to demote, and refusing it here would fail every anchor of
181
+ // the request.
182
+ param_name: z.string().optional(),
179
183
  unwrap: z.enum(['awaited', 'none']).optional(),
180
184
  }),
181
185
  z.object({
@@ -44,11 +44,12 @@ find_similar({{SCOPE}})
44
44
  Call again with `offset: <next_offset>` for as long as the response carries
45
45
  `has_more`, and class what every page returned.
46
46
 
47
- Where the project is larger than one pass, the response carries `error` in place
48
- of clusters and names the two routes under the ceiling: a `service`, or a higher
49
- `min_lines`. Take the route the response names and run it again. Where
50
- `truncated` is present the audit is partial, and its `scanned_functions` of `of`
51
- says by how much.
47
+ Where the project is larger than one pass, the response carries `window`: the
48
+ functions it compared, in path order, each against every function after them.
49
+ Call again with `scan_from: <next_scan_from>` until a response carries no
50
+ `next_scan_from`; the windows together compare every pair once. `path` narrows
51
+ an audit to one directory. Where `truncated` is present the audit is partial,
52
+ and its `scanned_functions` of `of` says by how much.
52
53
 
53
54
  ## Class every row
54
55