carrick 0.3.138 → 0.3.140
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.
- package/package.json +7 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/affected-set.d.ts +172 -0
- package/sidecar/dist/src/affected-set.js +936 -0
- package/sidecar/dist/src/capture/api.d.ts +34 -0
- package/sidecar/dist/src/capture/backfill.d.ts +37 -0
- package/sidecar/dist/src/capture/backfill.js +75 -0
- package/sidecar/dist/src/capture/index.js +419 -133
- package/sidecar/dist/src/capture/installed-package.js +36 -29
- package/sidecar/dist/src/capture/self-check.d.ts +14 -3
- package/sidecar/dist/src/capture/self-check.js +168 -30
- package/sidecar/dist/src/index.js +84 -14
- package/sidecar/dist/src/infer-cache.d.ts +0 -8
- package/sidecar/dist/src/infer-cache.js +0 -14
- package/sidecar/dist/src/library-claims.js +4 -3
- package/sidecar/dist/src/module-format.d.ts +13 -2
- package/sidecar/dist/src/module-format.js +31 -1
- package/sidecar/dist/src/origin.d.ts +10 -7
- package/sidecar/dist/src/origin.js +10 -7
- package/sidecar/dist/src/program-files.d.ts +34 -11
- package/sidecar/dist/src/program-files.js +52 -10
- package/sidecar/dist/src/project-loader.d.ts +7 -0
- package/sidecar/dist/src/project-loader.js +20 -0
- package/sidecar/dist/src/retype-deferred.d.ts +34 -0
- package/sidecar/dist/src/retype-deferred.js +326 -0
- package/sidecar/dist/src/retype-selector.d.ts +43 -0
- package/sidecar/dist/src/retype-selector.js +217 -0
- package/sidecar/dist/src/retype.d.ts +28 -3
- package/sidecar/dist/src/retype.js +106 -41
- package/sidecar/dist/src/type-inferrer.js +3 -2
- package/sidecar/dist/src/types.d.ts +113 -3
- package/sidecar/dist/src/validators.d.ts +413 -4
- package/sidecar/dist/src/validators.js +41 -1
|
@@ -25,10 +25,13 @@
|
|
|
25
25
|
* project other requests read is the project the scan loaded.
|
|
26
26
|
*/
|
|
27
27
|
import { Node, SyntaxKind, ts } from 'ts-morph';
|
|
28
|
+
import { replaceFileText } from './program-files.js';
|
|
28
29
|
import { readsResponseStatus, statusesIn, SUCCEEDED, testsOnPath, } from './failure-path.js';
|
|
29
30
|
import { statesNoBody } from './capture/index.js';
|
|
30
31
|
import { lineIndex } from './line-index.js';
|
|
31
32
|
import { typeToStringAsDeclared } from './print-type.js';
|
|
33
|
+
import { deferredResultNeedsUndefined } from './retype-deferred.js';
|
|
34
|
+
import { resolvedDeclaration, typeArgumentOnlySelects } from './retype-selector.js';
|
|
32
35
|
import { fileDiagnostics } from './unwidened.js';
|
|
33
36
|
/** Names appended to a file that is not ours carry this prefix. */
|
|
34
37
|
const PREFIX = '__carrick_';
|
|
@@ -66,14 +69,14 @@ export class Retyper {
|
|
|
66
69
|
const before = new Map();
|
|
67
70
|
return items.map((item) => {
|
|
68
71
|
if (performance.now() >= deadline) {
|
|
69
|
-
return abstain(item, `the retype check ran out of its ${budgetMs}ms budget`);
|
|
72
|
+
return runFailed(abstain(item, `the retype check ran out of its ${budgetMs}ms budget`));
|
|
70
73
|
}
|
|
71
74
|
let outcome;
|
|
72
75
|
try {
|
|
73
76
|
outcome = this.runOne(item, before);
|
|
74
77
|
}
|
|
75
78
|
catch (err) {
|
|
76
|
-
outcome = abstain(item, `the retype check failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
79
|
+
outcome = runFailed(abstain(item, `the retype check failed: ${err instanceof Error ? err.message : String(err)}`));
|
|
77
80
|
}
|
|
78
81
|
onJudged?.();
|
|
79
82
|
return outcome;
|
|
@@ -88,24 +91,11 @@ export class Retyper {
|
|
|
88
91
|
// comment over the rest of the call.
|
|
89
92
|
return abstain(item, "the producer's response type carries a comment");
|
|
90
93
|
}
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
93
|
-
return abstain(item,
|
|
94
|
-
const { sourceFile, call } =
|
|
95
|
-
|
|
96
|
-
// Nothing reads the response, so nothing can disagree with it: an
|
|
97
|
-
// "agrees" here would be a verdict about no comparison at all.
|
|
98
|
-
return abstain(item, 'the consumer never reads the response');
|
|
99
|
-
}
|
|
100
|
-
const escape = resultEscapes(call);
|
|
101
|
-
if (escape) {
|
|
102
|
-
// Only this file's diagnostics are compared, so reads made where the
|
|
103
|
-
// value escapes to are invisible and an "agrees" would claim them.
|
|
104
|
-
return abstain(item, escape);
|
|
105
|
-
}
|
|
106
|
-
const plan = this.plan(call, producer, item.wire);
|
|
107
|
-
if (typeof plan === 'string')
|
|
108
|
-
return abstain(item, plan);
|
|
94
|
+
const found = this.beforeRewrite(item);
|
|
95
|
+
if (typeof found === 'string')
|
|
96
|
+
return abstain(item, found);
|
|
97
|
+
const { sourceFile, call } = found;
|
|
98
|
+
const plan = found.plan(producer, item.wire);
|
|
109
99
|
// Planned now: a check forgets every node of the file, `call` included.
|
|
110
100
|
const unwidened = this.unwidenedPlan(call, item);
|
|
111
101
|
const original = sourceFile.getFullText();
|
|
@@ -156,6 +146,65 @@ export class Retyper {
|
|
|
156
146
|
})),
|
|
157
147
|
};
|
|
158
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Per item, the reason `run` abstains for before any rewrite, which no
|
|
151
|
+
* producer type changes, or `undefined` when only the rewrite can decide
|
|
152
|
+
* the call (carrick#3132). The scan asks this in the consumer's own
|
|
153
|
+
* analysis, so a consumer whose calls all abstain here builds no retype
|
|
154
|
+
* program. A call that throws here is left to the retype, which reports
|
|
155
|
+
* the failure itself.
|
|
156
|
+
*/
|
|
157
|
+
prescreen(items) {
|
|
158
|
+
return items.map((item) => {
|
|
159
|
+
try {
|
|
160
|
+
const found = this.beforeRewrite(item);
|
|
161
|
+
if (typeof found === 'string')
|
|
162
|
+
return { reason: found };
|
|
163
|
+
// carrick#3158: no producer type is read here, so this is only the
|
|
164
|
+
// reason the retype would give for ANY object type literal; the
|
|
165
|
+
// scanner applies it when the producer's type is one.
|
|
166
|
+
if (typeArgumentOnlySelects(found.call)) {
|
|
167
|
+
return { fresh_type_reason: this.notReachedReason(found.call) };
|
|
168
|
+
}
|
|
169
|
+
// carrick#3165: a deferred result whose every member holds an
|
|
170
|
+
// `undefined` the stated type does not reach. The scanner applies it
|
|
171
|
+
// when the producer's type has no top-level `undefined`. The quoted
|
|
172
|
+
// type is the call's own result, as no producer type is read here.
|
|
173
|
+
return deferredResultNeedsUndefined(found.call)
|
|
174
|
+
? { undefined_free_reason: this.notReachedReason(found.call) }
|
|
175
|
+
: {};
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
return {};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The call and how to state a type at it, or why the retype abstains
|
|
184
|
+
* before any rewrite. Reads only the consumer's own code: the producer's
|
|
185
|
+
* type is stated by the returned plan.
|
|
186
|
+
*/
|
|
187
|
+
beforeRewrite(item) {
|
|
188
|
+
const located = this.inferrer.locateCall(asLocator(item));
|
|
189
|
+
if (!located)
|
|
190
|
+
return 'the consumer call could not be located in its file';
|
|
191
|
+
const { sourceFile, call } = located;
|
|
192
|
+
if (resultIsDiscarded(call)) {
|
|
193
|
+
// Nothing reads the response, so nothing can disagree with it: an
|
|
194
|
+
// "agrees" here would be a verdict about no comparison at all.
|
|
195
|
+
return 'the consumer never reads the response';
|
|
196
|
+
}
|
|
197
|
+
const escape = resultEscapes(call);
|
|
198
|
+
if (escape) {
|
|
199
|
+
// Only this file's diagnostics are compared, so reads made where the
|
|
200
|
+
// value escapes to are invisible and an "agrees" would claim them.
|
|
201
|
+
return escape;
|
|
202
|
+
}
|
|
203
|
+
const plan = this.plan(call);
|
|
204
|
+
if (typeof plan === 'string')
|
|
205
|
+
return plan;
|
|
206
|
+
return { sourceFile, call, plan };
|
|
207
|
+
}
|
|
159
208
|
/**
|
|
160
209
|
* The rewrite that states the producer's UNWIDENED return (carrick#1516),
|
|
161
210
|
* when the item carries one that can be stated at this call.
|
|
@@ -164,15 +213,16 @@ export class Retyper {
|
|
|
164
213
|
const text = oneLine(item.producer_unwidened_type ?? '');
|
|
165
214
|
if (!text || text.includes('//') || text.includes('/*'))
|
|
166
215
|
return undefined;
|
|
167
|
-
const plan = this.plan(call
|
|
168
|
-
return typeof plan === 'string' ? undefined : plan;
|
|
216
|
+
const plan = this.plan(call);
|
|
217
|
+
return typeof plan === 'string' ? undefined : plan(text, item.wire);
|
|
169
218
|
}
|
|
170
219
|
/**
|
|
171
|
-
* How to state
|
|
172
|
-
*
|
|
220
|
+
* How to state a producer's type at this call, or why it cannot be done
|
|
221
|
+
* whatever that type is. The builder it returns takes the type, and then
|
|
222
|
+
* builds the wire and the declared form from one decision.
|
|
173
223
|
*/
|
|
174
|
-
plan(call
|
|
175
|
-
const
|
|
224
|
+
plan(call) {
|
|
225
|
+
const statedAs = (producer, wire) => (useWire) => useWire && wire ? `${WIRE}<(${producer})>` : `(${producer})`;
|
|
176
226
|
const callStart = call.getStart();
|
|
177
227
|
const callEnd = call.getEnd();
|
|
178
228
|
const typeArgs = call.getTypeArguments();
|
|
@@ -183,7 +233,8 @@ export class Retyper {
|
|
|
183
233
|
// Positions are read now: the rewrite forgets every node of the file.
|
|
184
234
|
const argStart = typeArgs[0].getStart();
|
|
185
235
|
const argEnd = typeArgs[0].getEnd();
|
|
186
|
-
return (useWire) => {
|
|
236
|
+
return (producer, wire) => (useWire) => {
|
|
237
|
+
const stated = statedAs(producer, wire);
|
|
187
238
|
const text = stated(useWire);
|
|
188
239
|
const delta = text.length - (argEnd - argStart);
|
|
189
240
|
return {
|
|
@@ -205,7 +256,8 @@ export class Retyper {
|
|
|
205
256
|
if (!open)
|
|
206
257
|
return 'the consumer call has no argument list to retype';
|
|
207
258
|
const at = open.getStart();
|
|
208
|
-
return (useWire) => {
|
|
259
|
+
return (producer, wire) => (useWire) => {
|
|
260
|
+
const stated = statedAs(producer, wire);
|
|
209
261
|
const text = `<${stated(useWire)}>`;
|
|
210
262
|
return {
|
|
211
263
|
edits: [{ start: at, end: at, text, statedAt: 1 }],
|
|
@@ -231,7 +283,8 @@ export class Retyper {
|
|
|
231
283
|
return reads;
|
|
232
284
|
if (reads.length > 0) {
|
|
233
285
|
const edits = reads.map(bodyReadEdit);
|
|
234
|
-
return (useWire) => {
|
|
286
|
+
return (producer, wire) => (useWire) => {
|
|
287
|
+
const stated = statedAs(producer, wire);
|
|
235
288
|
const text = stated(useWire);
|
|
236
289
|
return {
|
|
237
290
|
edits: edits.flatMap((edit) => edit(text)),
|
|
@@ -267,7 +320,7 @@ export class Retyper {
|
|
|
267
320
|
const rewritten = applyEdits(original, rewrite.edits) + appendix;
|
|
268
321
|
const bodyEnd = rewritten.length - appendix.length;
|
|
269
322
|
const originOf = (pos) => pos >= bodyEnd ? { kind: 'inserted' } : mapBack(pos, rewrite.edits);
|
|
270
|
-
sourceFile
|
|
323
|
+
replaceFileText(sourceFile, rewritten);
|
|
271
324
|
try {
|
|
272
325
|
if (rewrite.typeArgumentCall) {
|
|
273
326
|
const reached = this.typeArgumentReachesResult(sourceFile, rewrite.typeArgumentCall);
|
|
@@ -313,7 +366,7 @@ export class Retyper {
|
|
|
313
366
|
return { kind: 'checked', added };
|
|
314
367
|
}
|
|
315
368
|
finally {
|
|
316
|
-
sourceFile
|
|
369
|
+
replaceFileText(sourceFile, original);
|
|
317
370
|
}
|
|
318
371
|
}
|
|
319
372
|
/**
|
|
@@ -394,8 +447,7 @@ export class Retyper {
|
|
|
394
447
|
if (!stated)
|
|
395
448
|
return 'the retyped call carries no type argument';
|
|
396
449
|
const checker = this.project.getTypeChecker().compilerObject;
|
|
397
|
-
const
|
|
398
|
-
const result = checker.getAwaitedType(returned) ?? returned;
|
|
450
|
+
const result = this.resultOf(call);
|
|
399
451
|
const target = stated.compilerType;
|
|
400
452
|
if (result === target)
|
|
401
453
|
return true;
|
|
@@ -413,13 +465,33 @@ export class Retyper {
|
|
|
413
465
|
if (checker.getTypeOfSymbolAtLocation(property, call.compilerNode) === target)
|
|
414
466
|
return true;
|
|
415
467
|
}
|
|
468
|
+
return this.notReachedReason(call);
|
|
469
|
+
}
|
|
470
|
+
/** What the call yields once awaited: the type the reach test compares. */
|
|
471
|
+
resultOf(call) {
|
|
472
|
+
const checker = this.project.getTypeChecker().compilerObject;
|
|
473
|
+
const returned = call.getType().compilerType;
|
|
474
|
+
return checker.getAwaitedType(returned) ?? returned;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* The abstention for a call whose type argument is not in its result. The
|
|
478
|
+
* one place the sentence is built: the reach test gives it after the
|
|
479
|
+
* rewrite, and the prescreen gives it before one (carrick#3158), so the two
|
|
480
|
+
* can never word it differently.
|
|
481
|
+
*/
|
|
482
|
+
notReachedReason(call) {
|
|
483
|
+
const checker = this.project.getTypeChecker().compilerObject;
|
|
416
484
|
return ("the call's type argument does not reach its result " +
|
|
417
|
-
`('${checker.typeToString(
|
|
485
|
+
`('${checker.typeToString(this.resultOf(call))}'), so it does not state the response`);
|
|
418
486
|
}
|
|
419
487
|
}
|
|
420
488
|
function abstain(item, reason) {
|
|
421
489
|
return { item_id: item.item_id, outcome: 'abstain', diagnostics: [], reason };
|
|
422
490
|
}
|
|
491
|
+
/** `outcome`, marked as an abstention the run caused (carrick#3104). */
|
|
492
|
+
function runFailed(outcome) {
|
|
493
|
+
return { ...outcome, run_failed: true };
|
|
494
|
+
}
|
|
423
495
|
function asLocator(item) {
|
|
424
496
|
return {
|
|
425
497
|
file_path: item.file_path,
|
|
@@ -450,13 +522,6 @@ function resultIsDiscarded(call) {
|
|
|
450
522
|
}
|
|
451
523
|
return !!parent && Node.isExpressionStatement(parent);
|
|
452
524
|
}
|
|
453
|
-
function resolvedDeclaration(call) {
|
|
454
|
-
const signature = call
|
|
455
|
-
.getProject()
|
|
456
|
-
.getTypeChecker()
|
|
457
|
-
.compilerObject.getResolvedSignature(call.compilerNode);
|
|
458
|
-
return signature?.getDeclaration();
|
|
459
|
-
}
|
|
460
525
|
/**
|
|
461
526
|
* Why the call's result leaves what this file's type-check can see, or
|
|
462
527
|
* `undefined` when every use of it stays in view.
|
|
@@ -34,6 +34,7 @@ import { callsOf, descendantsOf, descendantsOnLine, descendantsOnLines, wrap, }
|
|
|
34
34
|
import { elapsedMs, inferTiming, phaseClock, timedPhase } from './infer-timing.js';
|
|
35
35
|
import { StatedParams } from './stated-params.js';
|
|
36
36
|
import { bindingToleratesAbsence, handlerToleratesAbsentBody } from './absent-body.js';
|
|
37
|
+
import { replaceFileText } from './program-files.js';
|
|
37
38
|
import { classifyStatusCodes, constituents, httpStatus, statesNoBody, statesNoShape, statusKeyCode, statusTableOf, successEntries, } from './capture/index.js';
|
|
38
39
|
import { addedDiagnostics, applyInsertions, fileDiagnostics, literalInsertions, mapBack, mapForward, normalise, pathOf, } from './unwidened.js';
|
|
39
40
|
import { expandTypeStructural, jsonWireType, } from './type-structural-expander.js';
|
|
@@ -828,7 +829,7 @@ export class TypeInferrer {
|
|
|
828
829
|
originals.set(file, file.getFullText());
|
|
829
830
|
try {
|
|
830
831
|
for (const [file, list] of insertions) {
|
|
831
|
-
file
|
|
832
|
+
replaceFileText(file, applyInsertions(originals.get(file), list));
|
|
832
833
|
}
|
|
833
834
|
// A diagnostic the marking added sits in a function on some request's
|
|
834
835
|
// path (or elsewhere in that function's file): every request whose path
|
|
@@ -891,7 +892,7 @@ export class TypeInferrer {
|
|
|
891
892
|
}
|
|
892
893
|
finally {
|
|
893
894
|
for (const [file, text] of originals)
|
|
894
|
-
file
|
|
895
|
+
replaceFileText(file, text);
|
|
895
896
|
}
|
|
896
897
|
}
|
|
897
898
|
/**
|
|
@@ -154,6 +154,14 @@ export interface CaptureV2Request extends BaseRequest {
|
|
|
154
154
|
tsconfig_path?: string;
|
|
155
155
|
/** The scanned repo's root, as on `init` (carrick#1776). */
|
|
156
156
|
scan_root?: string;
|
|
157
|
+
/**
|
|
158
|
+
* carrick#2041: alias -> literal type text the scanner can stand behind. A
|
|
159
|
+
* demoted alias with a text here is captured again in this request,
|
|
160
|
+
* re-anchored on the text, into `backfill_out_dir`.
|
|
161
|
+
*/
|
|
162
|
+
backfill_texts?: Record<string, string>;
|
|
163
|
+
/** Where the backfilled stub is written; sent with `backfill_texts`. */
|
|
164
|
+
backfill_out_dir?: string;
|
|
157
165
|
}
|
|
158
166
|
/**
|
|
159
167
|
* Response for the capture_v2 action
|
|
@@ -272,6 +280,52 @@ export interface ShutdownRequest extends BaseRequest {
|
|
|
272
280
|
export interface ListProgramFilesRequest extends BaseRequest {
|
|
273
281
|
action: 'list_program_files';
|
|
274
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* The import graph without statement texts. Every name and path is an index
|
|
285
|
+
* into `strings`. Per file: its path, whether it is a script, its declared
|
|
286
|
+
* names, the identifiers each declared name mentions that can matter (a
|
|
287
|
+
* binding, a whole-module local or one of the file's own declared names), the
|
|
288
|
+
* same for each loose statement, its exports, its export targets, its
|
|
289
|
+
* bindings (local, imported name or -1, origin file and name pairs), its
|
|
290
|
+
* whole-module locals, and its stems (target file or -1, locals, stems).
|
|
291
|
+
*/
|
|
292
|
+
export interface SerialGraph {
|
|
293
|
+
version: 1;
|
|
294
|
+
strings: string[];
|
|
295
|
+
files: Array<{
|
|
296
|
+
p: number;
|
|
297
|
+
g: 0 | 1;
|
|
298
|
+
d: number[];
|
|
299
|
+
r: number[][];
|
|
300
|
+
l: number[][];
|
|
301
|
+
e: number[];
|
|
302
|
+
t: number[][];
|
|
303
|
+
b: Array<[number, number, number[]]>;
|
|
304
|
+
w: number[];
|
|
305
|
+
s: Array<[number, number[], number[]]>;
|
|
306
|
+
}>;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* The import graph of every program the process has built, without statement
|
|
310
|
+
* texts (carrick#3100). Builds the default program when none is built.
|
|
311
|
+
*/
|
|
312
|
+
export interface ReachGraphRequest extends BaseRequest {
|
|
313
|
+
action: 'reach_graph';
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* The files a set of edits can reach in a graph `reach_graph` wrote
|
|
317
|
+
* (carrick#3100). Needs no program and no `init`. Paths are relative to the
|
|
318
|
+
* scan root; a missing side of an added or deleted file is `''`.
|
|
319
|
+
*/
|
|
320
|
+
export interface ReachRequest extends BaseRequest {
|
|
321
|
+
action: 'reach';
|
|
322
|
+
graph: SerialGraph;
|
|
323
|
+
changes: Array<{
|
|
324
|
+
file: string;
|
|
325
|
+
before: string;
|
|
326
|
+
after: string;
|
|
327
|
+
}>;
|
|
328
|
+
}
|
|
275
329
|
/**
|
|
276
330
|
* Add files to the programs that type them, in the given order
|
|
277
331
|
* (carrick#2027).
|
|
@@ -353,7 +407,7 @@ export interface ResolveDefinitionsRequest extends BaseRequest {
|
|
|
353
407
|
* The locator is the one the consumer's `call_result` inference used: a span,
|
|
354
408
|
* or expression text near a line.
|
|
355
409
|
*/
|
|
356
|
-
export interface
|
|
410
|
+
export interface RetypeLocatorItem {
|
|
357
411
|
/** Caller key, echoed on the outcome. */
|
|
358
412
|
item_id: string;
|
|
359
413
|
/** Absolute path, or relative to the init'd root. */
|
|
@@ -363,6 +417,8 @@ export interface RetypeItem {
|
|
|
363
417
|
span_end?: number;
|
|
364
418
|
expression_text?: string;
|
|
365
419
|
expression_line?: number;
|
|
420
|
+
}
|
|
421
|
+
export interface RetypeItem extends RetypeLocatorItem {
|
|
366
422
|
/** The producer's response type as TypeScript text, fully inlined. */
|
|
367
423
|
producer_type: string;
|
|
368
424
|
/**
|
|
@@ -374,6 +430,37 @@ export interface RetypeItem {
|
|
|
374
430
|
/** Judge the form JSON puts on the wire (an `http` response). */
|
|
375
431
|
wire: boolean;
|
|
376
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Ask, without a producer type, which consumer calls the retype abstains for
|
|
435
|
+
* before any rewrite (carrick#3132). Needs `init`: it reads the consumer's
|
|
436
|
+
* real program, as `retype_check` does.
|
|
437
|
+
*/
|
|
438
|
+
export interface RetypePrescreenRequest extends BaseRequest {
|
|
439
|
+
action: 'retype_prescreen';
|
|
440
|
+
items: RetypeLocatorItem[];
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* One call's prescreen: `reason` when the retype abstains before any rewrite.
|
|
444
|
+
* `fresh_type_reason` (carrick#3158) is the retype's "does not reach" reason
|
|
445
|
+
* for any stated type that is a new object type: the type argument it fills
|
|
446
|
+
* appears in the result only as a conditional's selector. The caller applies
|
|
447
|
+
* it only when the producer's type is such a type; it is never set beside
|
|
448
|
+
* `reason`.
|
|
449
|
+
* `undefined_free_reason` (carrick#3165) is the same sentence for a call whose
|
|
450
|
+
* result is deferred: it holds for any stated type with no top-level
|
|
451
|
+
* `undefined`, and quotes the call's own result. Never set beside either.
|
|
452
|
+
*/
|
|
453
|
+
export interface RetypePrescreen {
|
|
454
|
+
item_id: string;
|
|
455
|
+
reason?: string;
|
|
456
|
+
fresh_type_reason?: string;
|
|
457
|
+
undefined_free_reason?: string;
|
|
458
|
+
}
|
|
459
|
+
export interface RetypePrescreenResponse extends BaseResponse {
|
|
460
|
+
/** One per item, in request order. */
|
|
461
|
+
prescreens?: RetypePrescreen[];
|
|
462
|
+
errors?: string[];
|
|
463
|
+
}
|
|
377
464
|
/**
|
|
378
465
|
* Retype consumer calls with the producer's response type and report what the
|
|
379
466
|
* consumer file's own type-check says about it. Needs `init`: it runs in the
|
|
@@ -740,7 +827,7 @@ export interface ListLibrarySurfaceRequest extends BaseRequest {
|
|
|
740
827
|
/**
|
|
741
828
|
* Union type for all possible sidecar requests
|
|
742
829
|
*/
|
|
743
|
-
export type SidecarRequest = RetypeCheckRequest | VerifyClientSemanticsRequest | VerifyLibraryClaimsRequest | ListLibrarySurfaceRequest | InitRequest | BundleRequest | CaptureV2Request | CheckV2Request | InferRequest | ResolveDefinitionsRequest | HealthRequest | ShutdownRequest | ListProgramFilesRequest | AddProgramFilesRequest | PositionRowsRequest | ImplementationsRequest;
|
|
830
|
+
export type SidecarRequest = RetypeCheckRequest | RetypePrescreenRequest | VerifyClientSemanticsRequest | VerifyLibraryClaimsRequest | ListLibrarySurfaceRequest | InitRequest | BundleRequest | CaptureV2Request | CheckV2Request | InferRequest | ResolveDefinitionsRequest | HealthRequest | ShutdownRequest | ListProgramFilesRequest | ReachGraphRequest | ReachRequest | AddProgramFilesRequest | PositionRowsRequest | ImplementationsRequest;
|
|
744
831
|
/**
|
|
745
832
|
* Request for a specific symbol to be bundled
|
|
746
833
|
*/
|
|
@@ -976,6 +1063,27 @@ export interface ListProgramFilesResponse extends BaseResponse {
|
|
|
976
1063
|
files?: string[];
|
|
977
1064
|
errors?: string[];
|
|
978
1065
|
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Response for reach_graph action
|
|
1068
|
+
*/
|
|
1069
|
+
export interface ReachGraphResponse extends BaseResponse {
|
|
1070
|
+
version?: 1;
|
|
1071
|
+
graph?: SerialGraph;
|
|
1072
|
+
errors?: string[];
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Response for reach action. `reached` is `'all'` for an installed file, a
|
|
1076
|
+
* file that is not source, or a `.json` file. `augmented` lists the changed
|
|
1077
|
+
* files that hold a script, global declaration or module augmentation, or read
|
|
1078
|
+
* a changed name of one: the caller widens each to every file of the programs
|
|
1079
|
+
* that hold it.
|
|
1080
|
+
*/
|
|
1081
|
+
export interface ReachResponse extends BaseResponse {
|
|
1082
|
+
reached?: string[] | 'all';
|
|
1083
|
+
augmented?: string[];
|
|
1084
|
+
exports_moved?: boolean;
|
|
1085
|
+
errors?: string[];
|
|
1086
|
+
}
|
|
979
1087
|
/**
|
|
980
1088
|
* Response for add_program_files action
|
|
981
1089
|
*/
|
|
@@ -1014,6 +1122,8 @@ export interface RetypeOutcome {
|
|
|
1014
1122
|
outcome: 'mismatch' | 'agrees' | 'wider' | 'abstain';
|
|
1015
1123
|
diagnostics: RetypeDiagnostic[];
|
|
1016
1124
|
reason?: string;
|
|
1125
|
+
/** Abstained because of how the run went (out of time, a judge that threw), not because of the call: the next run judges it again (carrick#3104). */
|
|
1126
|
+
run_failed?: boolean;
|
|
1017
1127
|
}
|
|
1018
1128
|
export interface RetypeCheckResponse extends BaseResponse {
|
|
1019
1129
|
outcomes?: RetypeOutcome[];
|
|
@@ -1272,7 +1382,7 @@ export interface ListLibrarySurfaceResponse extends BaseResponse {
|
|
|
1272
1382
|
/**
|
|
1273
1383
|
* Union type for all possible sidecar responses
|
|
1274
1384
|
*/
|
|
1275
|
-
export type SidecarResponse = RetypeCheckResponse | VerifyClientSemanticsResponse | VerifyLibraryClaimsResponse | ListLibrarySurfaceResponse | InitResponse | BundleResponse | CaptureV2Response | CheckV2Response | InferResponse | ResolveDefinitionsResponse | HealthResponse | ShutdownResponse | ListProgramFilesResponse | AddProgramFilesResponse | PositionRowsResponse | ImplementationsResponse | ErrorResponse;
|
|
1385
|
+
export type SidecarResponse = RetypeCheckResponse | RetypePrescreenResponse | VerifyClientSemanticsResponse | VerifyLibraryClaimsResponse | ListLibrarySurfaceResponse | InitResponse | BundleResponse | CaptureV2Response | CheckV2Response | InferResponse | ResolveDefinitionsResponse | HealthResponse | ShutdownResponse | ListProgramFilesResponse | ReachGraphResponse | ReachResponse | AddProgramFilesResponse | PositionRowsResponse | ImplementationsResponse | ErrorResponse;
|
|
1276
1386
|
/**
|
|
1277
1387
|
* An entry in the type manifest
|
|
1278
1388
|
*/
|