carrick 0.3.156 → 0.3.158

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.
Files changed (166) hide show
  1. package/dist/cli.d.ts +7 -0
  2. package/dist/cli.js +4 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/contract.d.ts +8 -1
  5. package/dist/contract.js.map +1 -1
  6. package/dist/engine-ask.d.ts +21 -0
  7. package/dist/engine-ask.js +50 -0
  8. package/dist/engine-ask.js.map +1 -0
  9. package/dist/facts/diff.d.ts +14 -1
  10. package/dist/facts/diff.js +21 -8
  11. package/dist/facts/diff.js.map +1 -1
  12. package/dist/facts/enabled.d.ts +6 -0
  13. package/dist/facts/enabled.js +8 -0
  14. package/dist/facts/enabled.js.map +1 -1
  15. package/dist/facts/fetch.d.ts +7 -0
  16. package/dist/facts/fetch.js +24 -2
  17. package/dist/facts/fetch.js.map +1 -1
  18. package/dist/facts/lines.d.ts +22 -4
  19. package/dist/facts/lines.js +31 -9
  20. package/dist/facts/lines.js.map +1 -1
  21. package/dist/facts/peers.d.ts +13 -4
  22. package/dist/facts/peers.js +17 -15
  23. package/dist/facts/peers.js.map +1 -1
  24. package/dist/facts/rules/packages.js +3 -1
  25. package/dist/facts/rules/packages.js.map +1 -1
  26. package/dist/facts/rules/same-name.js +1 -1
  27. package/dist/facts/rules/same-name.js.map +1 -1
  28. package/dist/facts/store.d.ts +15 -0
  29. package/dist/facts/store.js +30 -0
  30. package/dist/facts/store.js.map +1 -1
  31. package/dist/held/backoff.d.ts +8 -0
  32. package/dist/held/backoff.js +43 -0
  33. package/dist/held/backoff.js.map +1 -0
  34. package/dist/held/build.d.ts +17 -0
  35. package/dist/held/build.js +62 -0
  36. package/dist/held/build.js.map +1 -0
  37. package/dist/held/client.d.ts +43 -0
  38. package/dist/held/client.js +200 -0
  39. package/dist/held/client.js.map +1 -0
  40. package/dist/held/daemon.d.ts +151 -0
  41. package/dist/held/daemon.js +399 -0
  42. package/dist/held/daemon.js.map +1 -0
  43. package/dist/held/early.d.ts +28 -0
  44. package/dist/held/early.js +115 -0
  45. package/dist/held/early.js.map +1 -0
  46. package/dist/held/engine.d.ts +50 -0
  47. package/dist/held/engine.js +166 -0
  48. package/dist/held/engine.js.map +1 -0
  49. package/dist/held/paths.d.ts +15 -0
  50. package/dist/held/paths.js +44 -0
  51. package/dist/held/paths.js.map +1 -0
  52. package/dist/held/place.d.ts +130 -0
  53. package/dist/held/place.js +236 -0
  54. package/dist/held/place.js.map +1 -0
  55. package/dist/held/registry.d.ts +22 -0
  56. package/dist/held/registry.js +72 -0
  57. package/dist/held/registry.js.map +1 -0
  58. package/dist/held/run.d.ts +2 -0
  59. package/dist/held/run.js +78 -0
  60. package/dist/held/run.js.map +1 -0
  61. package/dist/held/runtime.d.ts +22 -0
  62. package/dist/held/runtime.js +612 -0
  63. package/dist/held/runtime.js.map +1 -0
  64. package/dist/held/shadow.d.ts +33 -0
  65. package/dist/held/shadow.js +68 -0
  66. package/dist/held/shadow.js.map +1 -0
  67. package/dist/held/steps.d.ts +11 -0
  68. package/dist/held/steps.js +29 -0
  69. package/dist/held/steps.js.map +1 -0
  70. package/dist/hook/bash-targets.d.ts +7 -2
  71. package/dist/hook/bash-targets.js +82 -27
  72. package/dist/hook/bash-targets.js.map +1 -1
  73. package/dist/hook/confirm.d.ts +79 -0
  74. package/dist/hook/confirm.js +220 -0
  75. package/dist/hook/confirm.js.map +1 -0
  76. package/dist/hook/edit-flow.d.ts +14 -3
  77. package/dist/hook/edit-flow.js +113 -33
  78. package/dist/hook/edit-flow.js.map +1 -1
  79. package/dist/hook/generation.d.ts +19 -0
  80. package/dist/hook/generation.js +75 -0
  81. package/dist/hook/generation.js.map +1 -0
  82. package/dist/hook/late.d.ts +50 -9
  83. package/dist/hook/late.js +104 -24
  84. package/dist/hook/late.js.map +1 -1
  85. package/dist/hook/lock.d.ts +26 -0
  86. package/dist/hook/lock.js +122 -0
  87. package/dist/hook/lock.js.map +1 -0
  88. package/dist/hook/post-bash.js +17 -8
  89. package/dist/hook/post-bash.js.map +1 -1
  90. package/dist/hook/post-edit.js +2 -2
  91. package/dist/hook/post-edit.js.map +1 -1
  92. package/dist/hook/post-read.js +25 -3
  93. package/dist/hook/post-read.js.map +1 -1
  94. package/dist/hook/post-search.js +1 -1
  95. package/dist/hook/post-search.js.map +1 -1
  96. package/dist/hook/probe.js +1 -0
  97. package/dist/hook/probe.js.map +1 -1
  98. package/dist/hook/read-answer.d.ts +5 -0
  99. package/dist/hook/read-answer.js +8 -4
  100. package/dist/hook/read-answer.js.map +1 -1
  101. package/dist/hook/rechecks.d.ts +59 -2
  102. package/dist/hook/rechecks.js +129 -119
  103. package/dist/hook/rechecks.js.map +1 -1
  104. package/dist/hook/session-start.d.ts +1 -1
  105. package/dist/hook/session-start.js +19 -5
  106. package/dist/hook/session-start.js.map +1 -1
  107. package/dist/hook/similar.d.ts +1 -1
  108. package/dist/hook/similar.js +21 -8
  109. package/dist/hook/similar.js.map +1 -1
  110. package/dist/hook/stop-wait.js +35 -16
  111. package/dist/hook/stop-wait.js.map +1 -1
  112. package/dist/hook/timings.d.ts +30 -2
  113. package/dist/hook/timings.js +8 -2
  114. package/dist/hook/timings.js.map +1 -1
  115. package/dist/hook/user-prompt.js +2 -2
  116. package/dist/hook/user-prompt.js.map +1 -1
  117. package/dist/hosted-snapshot.d.ts +27 -0
  118. package/dist/hosted-snapshot.js +32 -0
  119. package/dist/hosted-snapshot.js.map +1 -1
  120. package/dist/init/hosted.js +2 -9
  121. package/dist/init/hosted.js.map +1 -1
  122. package/dist/lsp-frame.d.ts +20 -0
  123. package/dist/lsp-frame.js +47 -0
  124. package/dist/lsp-frame.js.map +1 -0
  125. package/dist/render.d.ts +15 -1
  126. package/dist/render.js +50 -4
  127. package/dist/render.js.map +1 -1
  128. package/dist/server.js +5 -29
  129. package/dist/server.js.map +1 -1
  130. package/package.json +6 -6
  131. package/plugin/.claude-plugin/plugin.json +1 -1
  132. package/sidecar/dist/src/capture/anchors.d.ts +8 -0
  133. package/sidecar/dist/src/capture/anchors.js +3 -2
  134. package/sidecar/dist/src/capture/api.d.ts +98 -1
  135. package/sidecar/dist/src/capture/check-classify.d.ts +7 -0
  136. package/sidecar/dist/src/capture/check-classify.js +24 -0
  137. package/sidecar/dist/src/capture/check-probe.d.ts +86 -11
  138. package/sidecar/dist/src/capture/check-probe.js +175 -22
  139. package/sidecar/dist/src/capture/check.js +13 -1
  140. package/sidecar/dist/src/capture/graphql-leaves.d.ts +46 -0
  141. package/sidecar/dist/src/capture/graphql-leaves.js +142 -0
  142. package/sidecar/dist/src/capture/index.d.ts +12 -3
  143. package/sidecar/dist/src/capture/index.js +11 -2
  144. package/sidecar/dist/src/capture/result-label.js +3 -1
  145. package/sidecar/dist/src/capture/type-reasons.json +78 -0
  146. package/sidecar/dist/src/definition-resolver.d.ts +6 -5
  147. package/sidecar/dist/src/definition-resolver.js +20 -15
  148. package/sidecar/dist/src/engine-stamp.json +1 -0
  149. package/sidecar/dist/src/held-shadow.d.ts +70 -0
  150. package/sidecar/dist/src/held-shadow.js +222 -0
  151. package/sidecar/dist/src/index.js +65 -2
  152. package/sidecar/dist/src/library-claims.d.ts +3 -1
  153. package/sidecar/dist/src/library-claims.js +105 -6
  154. package/sidecar/dist/src/retype.d.ts +47 -0
  155. package/sidecar/dist/src/retype.js +274 -18
  156. package/sidecar/dist/src/site-find.d.ts +27 -0
  157. package/sidecar/dist/src/site-find.js +109 -0
  158. package/sidecar/dist/src/type-home.d.ts +12 -0
  159. package/sidecar/dist/src/type-home.js +41 -1
  160. package/sidecar/dist/src/type-inferrer.d.ts +13 -3
  161. package/sidecar/dist/src/type-inferrer.js +44 -22
  162. package/sidecar/dist/src/type-structural-expander.d.ts +11 -11
  163. package/sidecar/dist/src/type-structural-expander.js +73 -4
  164. package/sidecar/dist/src/types.d.ts +91 -5
  165. package/sidecar/dist/src/validators.d.ts +621 -254
  166. package/sidecar/dist/src/validators.js +37 -0
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The SDL side of a GraphQL producer response (carrick#4403): what type each
3
+ * field of the response is declared as, read from the service's one type
4
+ * table (`GraphqlTypes`) from the root field down.
5
+ *
6
+ * A GraphQL server sends each leaf through its scalar's `serialize`. The
7
+ * built-in scalars are fixed by the spec (`GRAPHQL_SCALAR_SENT`); a custom
8
+ * scalar's `serialize` is not read, so it keeps the JSON form, and so does an
9
+ * enum. Both the judge's probe and the stored type text read the table only
10
+ * through `graphqlFieldLeaf`, the one lookup.
11
+ *
12
+ * Seam: this bundle only.
13
+ */
14
+ import type { GraphqlLeaf, GraphqlRoot, GraphqlTypes } from './api.js';
15
+ /**
16
+ * The type each built-in scalar sends, by the GraphQL spec: `String` and `ID`
17
+ * serialise to a string, `Int` and `Float` to a number, `Boolean` to a
18
+ * boolean. Every other scalar keeps the JSON form.
19
+ */
20
+ export declare const GRAPHQL_SCALAR_SENT: Readonly<Record<string, 'string' | 'number' | 'boolean'>>;
21
+ /** The type a built-in scalar sends, or `undefined` for any other scalar. */
22
+ export declare function graphqlScalarSent(name: string): 'string' | 'number' | 'boolean' | undefined;
23
+ /** `leaf` with its non-null wrappers removed; a list is kept. */
24
+ export declare function withoutNonNull(leaf: GraphqlLeaf): GraphqlLeaf;
25
+ /**
26
+ * The declared output type of `field` on `typeName`, or `undefined` when the
27
+ * table does not say. An object or interface answers from its fields. A union
28
+ * answers only for a field every member declares with the same type; a
29
+ * member that is itself a union is read the same way, and a union met again
30
+ * on the way answers nothing, so a cyclic table ends.
31
+ */
32
+ export declare function graphqlFieldLeaf(types: GraphqlTypes, typeName: string, field: string, visiting?: ReadonlySet<string>): GraphqlLeaf | undefined;
33
+ /**
34
+ * Whether the table holds `typeName`. A type no schema file of the service
35
+ * declares (an undeclared custom scalar) is a reference with no entry: a
36
+ * leaf that names it is read as unknown, in the JSON form.
37
+ */
38
+ export declare function graphqlDeclaresType(types: GraphqlTypes, typeName: string): boolean;
39
+ /** The leaf the root field is declared as, or `undefined` when the table has none. */
40
+ export declare function graphqlRootLeaf(types: GraphqlTypes, root: GraphqlRoot): GraphqlLeaf | undefined;
41
+ /**
42
+ * The table a probe needs for one response: every type reachable from
43
+ * `leaf`, each as the fields `graphqlFieldLeaf` answers for it (a union's
44
+ * shared fields), keyed and ordered by name so the probe text is stable.
45
+ */
46
+ export declare function graphqlReachableFields(types: GraphqlTypes, leaf: GraphqlLeaf): Record<string, Record<string, GraphqlLeaf>>;
@@ -0,0 +1,142 @@
1
+ /**
2
+ * The SDL side of a GraphQL producer response (carrick#4403): what type each
3
+ * field of the response is declared as, read from the service's one type
4
+ * table (`GraphqlTypes`) from the root field down.
5
+ *
6
+ * A GraphQL server sends each leaf through its scalar's `serialize`. The
7
+ * built-in scalars are fixed by the spec (`GRAPHQL_SCALAR_SENT`); a custom
8
+ * scalar's `serialize` is not read, so it keeps the JSON form, and so does an
9
+ * enum. Both the judge's probe and the stored type text read the table only
10
+ * through `graphqlFieldLeaf`, the one lookup.
11
+ *
12
+ * Seam: this bundle only.
13
+ */
14
+ /**
15
+ * The type each built-in scalar sends, by the GraphQL spec: `String` and `ID`
16
+ * serialise to a string, `Int` and `Float` to a number, `Boolean` to a
17
+ * boolean. Every other scalar keeps the JSON form.
18
+ */
19
+ export const GRAPHQL_SCALAR_SENT = Object.freeze({
20
+ String: 'string',
21
+ ID: 'string',
22
+ Int: 'number',
23
+ Float: 'number',
24
+ Boolean: 'boolean',
25
+ });
26
+ /** The type a built-in scalar sends, or `undefined` for any other scalar. */
27
+ export function graphqlScalarSent(name) {
28
+ return Object.prototype.hasOwnProperty.call(GRAPHQL_SCALAR_SENT, name)
29
+ ? GRAPHQL_SCALAR_SENT[name]
30
+ : undefined;
31
+ }
32
+ /** `leaf` with its non-null wrappers removed; a list is kept. */
33
+ export function withoutNonNull(leaf) {
34
+ let current = leaf;
35
+ while ('non_null' in current)
36
+ current = current.non_null;
37
+ return current;
38
+ }
39
+ function leavesEqual(a, b) {
40
+ return JSON.stringify(a) === JSON.stringify(b);
41
+ }
42
+ /**
43
+ * The declared output type of `field` on `typeName`, or `undefined` when the
44
+ * table does not say. An object or interface answers from its fields. A union
45
+ * answers only for a field every member declares with the same type; a
46
+ * member that is itself a union is read the same way, and a union met again
47
+ * on the way answers nothing, so a cyclic table ends.
48
+ */
49
+ export function graphqlFieldLeaf(types, typeName, field, visiting = new Set()) {
50
+ if (visiting.has(typeName))
51
+ return undefined;
52
+ if (!Object.prototype.hasOwnProperty.call(types, typeName))
53
+ return undefined;
54
+ const def = types[typeName];
55
+ if ('fields' in def) {
56
+ return Object.prototype.hasOwnProperty.call(def.fields, field)
57
+ ? def.fields[field]
58
+ : undefined;
59
+ }
60
+ if (def.members.length === 0)
61
+ return undefined;
62
+ const inner = new Set(visiting).add(typeName);
63
+ let shared;
64
+ for (const member of def.members) {
65
+ const leaf = graphqlFieldLeaf(types, member, field, inner);
66
+ if (leaf === undefined)
67
+ return undefined;
68
+ if (shared === undefined)
69
+ shared = leaf;
70
+ else if (!leavesEqual(shared, leaf))
71
+ return undefined;
72
+ }
73
+ return shared;
74
+ }
75
+ /** The fields `typeName` answers for, as `graphqlFieldLeaf` reads them. */
76
+ function graphqlFieldsOf(types, typeName, visiting = new Set()) {
77
+ if (visiting.has(typeName))
78
+ return [];
79
+ if (!Object.prototype.hasOwnProperty.call(types, typeName))
80
+ return [];
81
+ const def = types[typeName];
82
+ if ('fields' in def)
83
+ return Object.keys(def.fields);
84
+ const inner = new Set(visiting).add(typeName);
85
+ const names = new Set();
86
+ for (const member of def.members) {
87
+ for (const name of graphqlFieldsOf(types, member, inner))
88
+ names.add(name);
89
+ }
90
+ return [...names].filter((name) => graphqlFieldLeaf(types, typeName, name) !== undefined);
91
+ }
92
+ /**
93
+ * Whether the table holds `typeName`. A type no schema file of the service
94
+ * declares (an undeclared custom scalar) is a reference with no entry: a
95
+ * leaf that names it is read as unknown, in the JSON form.
96
+ */
97
+ export function graphqlDeclaresType(types, typeName) {
98
+ return Object.prototype.hasOwnProperty.call(types, typeName);
99
+ }
100
+ /** The leaf the root field is declared as, or `undefined` when the table has none. */
101
+ export function graphqlRootLeaf(types, root) {
102
+ return graphqlFieldLeaf(types, root.type, root.field);
103
+ }
104
+ /** The named type a leaf refers to through its wrappers, if it refers to one. */
105
+ function referencedType(leaf) {
106
+ let current = leaf;
107
+ while ('non_null' in current || 'list' in current) {
108
+ current = 'non_null' in current ? current.non_null : current.list;
109
+ }
110
+ return 'type' in current ? current.type : undefined;
111
+ }
112
+ /**
113
+ * The table a probe needs for one response: every type reachable from
114
+ * `leaf`, each as the fields `graphqlFieldLeaf` answers for it (a union's
115
+ * shared fields), keyed and ordered by name so the probe text is stable.
116
+ */
117
+ export function graphqlReachableFields(types, leaf) {
118
+ const out = {};
119
+ const pending = [];
120
+ const first = referencedType(leaf);
121
+ if (first !== undefined)
122
+ pending.push(first);
123
+ const seen = new Set();
124
+ while (pending.length > 0) {
125
+ const name = pending.pop();
126
+ if (seen.has(name))
127
+ continue;
128
+ seen.add(name);
129
+ if (!graphqlDeclaresType(types, name))
130
+ continue;
131
+ const fields = {};
132
+ for (const field of graphqlFieldsOf(types, name).sort()) {
133
+ const fieldLeaf = graphqlFieldLeaf(types, name, field);
134
+ fields[field] = fieldLeaf;
135
+ const next = referencedType(fieldLeaf);
136
+ if (next !== undefined && !seen.has(next))
137
+ pending.push(next);
138
+ }
139
+ out[name] = fields;
140
+ }
141
+ return Object.fromEntries(Object.keys(out).sort().map((name) => [name, out[name]]));
142
+ }
@@ -27,9 +27,16 @@
27
27
  * node builtins and `typescript`; the rest of the sidecar reaches it only
28
28
  * through ./api.js types and this file's `captureStub`.
29
29
  */
30
- import type { CaptureStubOptions, CaptureStubResult } from './api.js';
30
+ import type { CaptureStubOptions, CaptureStubResult, TypeProvenanceReason, TypeReason } from './api.js';
31
31
  import { WriteGuard } from './guarded-fs.js';
32
32
  export type { CaptureStubOptions, CaptureStubResult } from './api.js';
33
+ /**
34
+ * The one list of type reasons (carrick#4231), keyed by word. The Rust driver
35
+ * embeds the same file; `test/type-reasons-one-source.test.ts` checks every
36
+ * row's `decided` is one of the three values the cast states.
37
+ */
38
+ export declare const TYPE_REASONS: Readonly<Record<TypeProvenanceReason, TypeReason>>;
39
+ export type { GraphqlLeaf, GraphqlRoot, GraphqlTypes } from './api.js';
33
40
  export { DenoProject, findDenoConfig } from './deno-project.js';
34
41
  export { sidecarCompilerOptions } from './compiler-options.js';
35
42
  export { withStubResolution, type StubModuleResolver } from './stub-resolution.js';
@@ -46,9 +53,11 @@ export { toPosix } from './installed-package.js';
46
53
  export { constituentsOf } from './result-label.js';
47
54
  export { moduleExport } from './anchors.js';
48
55
  export { callNamedBy, callResultNamesNoCall, isFrameworkMachinery, nodeByLocatorText, normalizeLocatorText, symbolDeclaredOutside, typeIsOrContainsMachinery, wrapsValueTransparently, type DeclaredOutside, } from './site-node.js';
49
- export { runCheck } from './check.js';
56
+ export { runCheck, judgeTscPath } from './check.js';
50
57
  export type { CheckProgress } from './check.js';
51
- export { jsonWireDeclarations, sentInJsonWireForm } from './check-probe.js';
58
+ export { jsonWireDeclarations, jsonWireRule, judgeTolerances, wireFormFor, type JudgeTolerances } from './check-probe.js';
59
+ export { nodeByExpressionText, isPreferredTarget } from './anchors.js';
60
+ export { graphqlDeclaresType, graphqlFieldLeaf, graphqlRootLeaf, graphqlScalarSent, withoutNonNull, } from './graphql-leaves.js';
52
61
  export { findDisqualifyingTopTypes } from './deep-walk.js';
53
62
  /**
54
63
  * The name of THIS capture's surface entry, without an extension
@@ -49,7 +49,14 @@ import { findServiceTsconfig } from './service-config.js';
49
49
  import { placeEmittedTree, surfaceModuleInTree } from './outside-root.js';
50
50
  import { WriteGuard } from './guarded-fs.js';
51
51
  import { sidecarCompilerOptions } from './compiler-options.js';
52
+ import typeReasons from './type-reasons.json' with { type: 'json' };
52
53
  import { boundedCompilerHost, boundedSys, isInsideCheckout, untrustedReadBound } from './checkout.js';
54
+ /**
55
+ * The one list of type reasons (carrick#4231), keyed by word. The Rust driver
56
+ * embeds the same file; `test/type-reasons-one-source.test.ts` checks every
57
+ * row's `decided` is one of the three values the cast states.
58
+ */
59
+ export const TYPE_REASONS = typeReasons;
53
60
  export { DenoProject, findDenoConfig } from './deno-project.js';
54
61
  export { sidecarCompilerOptions } from './compiler-options.js';
55
62
  export { withStubResolution } from './stub-resolution.js';
@@ -71,8 +78,10 @@ export { moduleExport } from './anchors.js';
71
78
  export { callNamedBy, callResultNamesNoCall, isFrameworkMachinery, nodeByLocatorText, normalizeLocatorText, symbolDeclaredOutside, typeIsOrContainsMachinery, wrapsValueTransparently, } from './site-node.js';
72
79
  // v2 check core ("tsc as the judge"). Same bundle, same seam: the sidecar
73
80
  // reaches it only through this door (index.js).
74
- export { runCheck } from './check.js';
75
- export { jsonWireDeclarations, sentInJsonWireForm } from './check-probe.js';
81
+ export { runCheck, judgeTscPath } from './check.js';
82
+ export { jsonWireDeclarations, jsonWireRule, judgeTolerances, wireFormFor } from './check-probe.js';
83
+ export { nodeByExpressionText, isPreferredTarget } from './anchors.js';
84
+ export { graphqlDeclaresType, graphqlFieldLeaf, graphqlRootLeaf, graphqlScalarSent, withoutNonNull, } from './graphql-leaves.js';
76
85
  export { findDisqualifyingTopTypes } from './deep-walk.js';
77
86
  const SURFACE_ENTRY_BASENAME = '__carrick_surface__';
78
87
  /** Captures made by this process, so each one's entry file has a name of its
@@ -24,8 +24,10 @@ const NULLISH = ts.TypeFlags.Undefined | ts.TypeFlags.Null | ts.TypeFlags.Void;
24
24
  export function constituentsOf(type) {
25
25
  return type.isUnion() ? type.types : [type];
26
26
  }
27
+ /** The abstain's word, checked against the one list of reasons. */
28
+ const RESULT_MEMBER_MISSING = 'result_member_missing';
27
29
  function missing(what) {
28
- return { abstain: `result_member_missing: ${what}` };
30
+ return { abstain: `${RESULT_MEMBER_MISSING}: ${what}` };
29
31
  }
30
32
  /**
31
33
  * Read `label` off a call's type. `raw` is the type as the call returns it and
@@ -0,0 +1,78 @@
1
+ {
2
+ "declared": {
3
+ "sentence": "declared that way in the code or in a library it calls",
4
+ "decided": "never"
5
+ },
6
+ "unresolved_import": {
7
+ "sentence": "a dependency or generated module could not be resolved on the scanned checkout",
8
+ "decided": "never"
9
+ },
10
+ "budget_exhausted": {
11
+ "sentence": "the type walk hit its budget before resolving this",
12
+ "decided": "never"
13
+ },
14
+ "no_payload_evidence": {
15
+ "sentence": "nothing in the handler states what it returns",
16
+ "decided": "never"
17
+ },
18
+ "machinery_envelope": {
19
+ "sentence": "the value sits inside framework machinery the walk does not read through",
20
+ "decided": "at_call_result"
21
+ },
22
+ "coerced_input": {
23
+ "sentence": "the request schema takes this position untyped and coerces it to the type printed here, so the finding is what a caller may send rather than the printed member",
24
+ "decided": "never"
25
+ },
26
+ "no_success_payload": {
27
+ "sentence": "every response the route sends is an error or a redirect, so the scan found no success body and compared nothing at this site",
28
+ "decided": "always"
29
+ },
30
+ "no_request_body": {
31
+ "sentence": "the request read located here is a path parameter or a query the route validates rather than a body, so the scan compared nothing at this site",
32
+ "decided": "always"
33
+ },
34
+ "projected_value_only": {
35
+ "sentence": "every read of the call's result takes a member out of it, so the site states part of a payload rather than a whole one and the scan compared nothing here",
36
+ "decided": "always"
37
+ },
38
+ "serialised_body_unread": {
39
+ "sentence": "the handler returns a status and a body it serialised to a string, and the scan could not see what it serialised, so nothing was compared at this site. Read the handler for the body's shape rather than this type",
40
+ "decided": "always"
41
+ },
42
+ "body_built_by_callee": {
43
+ "sentence": "the call hands its argument to a function that builds the request body from it in a way the scan could not type, so the argument is not the body and nothing was compared at this site. Read the called function for the body's shape",
44
+ "decided": "always"
45
+ },
46
+ "bound_by_callers": {
47
+ "sentence": "the type here is still an open type parameter of a generic function, which only that function's callers set, so this site states no type of its own and nothing was compared here. Read the callers of the function that declares the parameter (the detail names it) for the type",
48
+ "decided": "always"
49
+ },
50
+ "body_member_undecided": {
51
+ "sentence": "the call's result is an object that holds the transport response beside other members, and the called function's code does not settle which member holds the parsed body, so the site states no contract and nothing was compared here. Read the called function's returns for the member that holds the body",
52
+ "decided": "always"
53
+ },
54
+ "result_member_missing": {
55
+ "sentence": "the library this call uses says which part of its result holds the response body, and the type at this call has no such part, so the site states no contract and nothing was compared here",
56
+ "decided": "always"
57
+ },
58
+ "reshaped_by_callback": {
59
+ "sentence": "the call's result is handed unread to a callback in its chain that builds a new value from it, and nothing in the chain states the body, so the site states no contract and nothing was compared here",
60
+ "decided": "always"
61
+ },
62
+ "not_located": {
63
+ "sentence": "the scan found no value in the code for this payload, so no type was read at this site",
64
+ "decided": "never"
65
+ },
66
+ "site_unreadable": {
67
+ "sentence": "the scan located the site and the compiler engine could not read a type there",
68
+ "decided": "never"
69
+ },
70
+ "unplaced_top_type": {
71
+ "sentence": "at a member the scan could not identify",
72
+ "decided": "never"
73
+ },
74
+ "not_recorded": {
75
+ "sentence": "the layer that produced it recorded no cause",
76
+ "decided": "never"
77
+ }
78
+ }
@@ -11,10 +11,10 @@
11
11
  * line itself is the as-written form.
12
12
  * - `expanded`: the fully *structural* form, with every named member type
13
13
  * inlined to its member structure, recursively. The sending side of an
14
- * `http` payload prints in JSON wire form (a `Date` as `string`), by the
15
- * rule the judge compares it under (`sentInJsonWireForm`,
16
- * carrick-cloud#3503): the stored text says what travels. `definition`
17
- * stays as written.
14
+ * `http` payload and a GraphQL producer response print in JSON wire form
15
+ * (a `Date` as `string`), by the rule the judge compares them under
16
+ * (`wireFormFor`, carrick-cloud#3503, carrick#4275): the stored text says
17
+ * what travels. `definition` stays as written.
18
18
  *
19
19
  * An alias whose own type did not resolve produces neither: the tree is read
20
20
  * as its self-check read it, so a reference that leaves it and that the
@@ -41,6 +41,7 @@
41
41
  * (carrick#3995 T5).
42
42
  */
43
43
  import type { DefinitionAlias } from './types.js';
44
+ import type { GraphqlTypes } from './capture/index.js';
44
45
  export interface ResolvedDefinition {
45
46
  type_alias: string;
46
47
  /** Original declaration text as written (preserves named types) */
@@ -60,7 +61,7 @@ export declare class DefinitionResolver {
60
61
  * both extensionless and `.js`-suffixed specifiers — the same policy the
61
62
  * check-phase workspace uses.
62
63
  */
63
- resolveFromStub(stubDir: string, aliases: DefinitionAlias[]): ResolvedDefinition[];
64
+ resolveFromStub(stubDir: string, aliases: DefinitionAlias[], graphqlTypes?: GraphqlTypes): ResolvedDefinition[];
64
65
  /**
65
66
  * Resolve a single alias: the original text and the structural form.
66
67
  */
@@ -11,10 +11,10 @@
11
11
  * line itself is the as-written form.
12
12
  * - `expanded`: the fully *structural* form, with every named member type
13
13
  * inlined to its member structure, recursively. The sending side of an
14
- * `http` payload prints in JSON wire form (a `Date` as `string`), by the
15
- * rule the judge compares it under (`sentInJsonWireForm`,
16
- * carrick-cloud#3503): the stored text says what travels. `definition`
17
- * stays as written.
14
+ * `http` payload and a GraphQL producer response print in JSON wire form
15
+ * (a `Date` as `string`), by the rule the judge compares them under
16
+ * (`wireFormFor`, carrick-cloud#3503, carrick#4275): the stored text says
17
+ * what travels. `definition` stays as written.
18
18
  *
19
19
  * An alias whose own type did not resolve produces neither: the tree is read
20
20
  * as its self-check read it, so a reference that leaves it and that the
@@ -43,7 +43,7 @@
43
43
  import * as path from 'node:path';
44
44
  import * as fs from 'node:fs';
45
45
  import { Project, Node } from 'ts-morph';
46
- import { sentInJsonWireForm, sidecarCompilerOptions, withStubResolution } from './capture/index.js';
46
+ import { wireFormFor, sidecarCompilerOptions, withStubResolution } from './capture/index.js';
47
47
  import { defaultLibraryOptions } from './default-library.js';
48
48
  import { expandTypeStructural, } from './type-structural-expander.js';
49
49
  export class DefinitionResolver {
@@ -58,7 +58,7 @@ export class DefinitionResolver {
58
58
  * both extensionless and `.js`-suffixed specifiers — the same policy the
59
59
  * check-phase workspace uses.
60
60
  */
61
- resolveFromStub(stubDir, aliases) {
61
+ resolveFromStub(stubDir, aliases, graphqlTypes) {
62
62
  const typesDir = path.join(stubDir, 'types');
63
63
  const surfacePath = path.join(typesDir, 'surface.d.ts');
64
64
  if (!fs.existsSync(surfacePath)) {
@@ -98,7 +98,7 @@ export class DefinitionResolver {
98
98
  const result = this.resolveAlias(surface, alias, {
99
99
  program: stubProject.getProgram().compilerObject,
100
100
  repoRoot: stubDir,
101
- });
101
+ }, graphqlTypes);
102
102
  if (result) {
103
103
  results.push(result);
104
104
  }
@@ -117,7 +117,7 @@ export class DefinitionResolver {
117
117
  /**
118
118
  * Resolve a single alias: the original text and the structural form.
119
119
  */
120
- resolveAlias(sourceFile, payload, origin) {
120
+ resolveAlias(sourceFile, payload, origin, graphqlTypes) {
121
121
  const alias = payload.alias;
122
122
  const decl = sourceFile.getTypeAlias(alias) ??
123
123
  sourceFile.getInterface(alias) ??
@@ -154,13 +154,18 @@ export class DefinitionResolver {
154
154
  }
155
155
  // Structural form — every named member inlined to its shape, in the
156
156
  // form the payload travels in where the judge compares that form. An
157
- // RPC procedure fails closed to the declared form: its router's
158
- // transformer, not JSON, decides what travels (carrick#4275).
159
- const wire = !payload.procedure &&
160
- sentInJsonWireForm(payload.protocol, payload.type_kind, payload.side)
161
- ? 'json'
162
- : 'declared';
163
- const expanded = expandTypeStructural(type, origin, { wire });
157
+ // An RPC procedure's form is unknown, which prints as declared
158
+ // (carrick#4402). A GraphQL producer response prints each built-in
159
+ // scalar leaf in the type its scalar sends, read from the service's
160
+ // SDL types (carrick#4403).
161
+ const graphql = graphqlTypes !== undefined && payload.graphql_root !== undefined
162
+ ? { types: graphqlTypes, root: payload.graphql_root }
163
+ : undefined;
164
+ const wire = wireFormFor(payload.protocol, payload.type_kind, payload.side, {
165
+ procedure: payload.procedure,
166
+ graphql,
167
+ });
168
+ const expanded = expandTypeStructural(type, origin, { wire, graphql });
164
169
  return { type_alias: alias, definition, expanded };
165
170
  }
166
171
  catch (err) {
@@ -0,0 +1 @@
1
+ {"inputs_sha256":"3fc9f213dacc4a7d63e6080c37215e872e71359eb337c6f47ebc84c0833301d0"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * The shadow tree a held-open compiler reads: a copy of one service's program
3
+ * that lives outside the checkout and loads on TypeScript 7.
4
+ *
5
+ * The scan's loader builds the program on TypeScript 6 (repo tsconfig, Deno
6
+ * graph, workspace links). TypeScript 7's command line refuses options the
7
+ * repo may set (`baseUrl`, `moduleResolution: node`, `target: es5`,
8
+ * `esModuleInterop: false`), and a config outside the repo cannot govern files
9
+ * inside it, so the held compiler never reads the repo's own config or files.
10
+ * It reads this tree instead:
11
+ *
12
+ * - `w/<repo-relative path>`: byte copies of the service's own files;
13
+ * - `v/<absolute path>`: every other program file (installed packages,
14
+ * runtime types), with each import, export, import type, augmentation and
15
+ * `types` reference pinned to the copy of the file TypeScript 6 resolved it
16
+ * to, so one package name that resolves to two versions stays two files;
17
+ * - `w/tsconfig.json`: generated, `moduleResolution: bundler`, exact `paths`
18
+ * for the bare specifiers the own files use, every non-library program file
19
+ * named in `files` (so `@types` the loader included on its own are
20
+ * explicit), and the library files TypeScript 6 loaded named in `lib`.
21
+ *
22
+ * Own = under the scanned repo, not under a `node_modules` segment, not under
23
+ * `.carrick/`. A bare import added later is not in `paths` (it needs a new
24
+ * shadow).
25
+ */
26
+ import type { ProjectLoader } from './project-loader.js';
27
+ import { type JudgeTolerances } from './capture/index.js';
28
+ /** What `write_shadow` answers. */
29
+ export interface ShadowResult {
30
+ /** Absolute path of the generated `w/tsconfig.json`. */
31
+ tsconfig: string;
32
+ /** The service's own files, repo-relative (to the scan root), sorted. */
33
+ own_files: string[];
34
+ /** Program files copied to `v/`. */
35
+ vendored: number;
36
+ /** Specifiers and references rewritten inside those copies. */
37
+ rewritten: number;
38
+ /** Specifiers TypeScript 6 left unresolved or resolved outside the program. */
39
+ unresolved: number;
40
+ /** A bare specifier two own files resolve to different files: reported, not solved. */
41
+ path_conflicts: Array<{
42
+ spec: string;
43
+ a: string;
44
+ b: string;
45
+ from: string;
46
+ }>;
47
+ /** The bare specifiers the own files use, as written to `paths`. */
48
+ bare_specifiers: string[];
49
+ /**
50
+ * The judge's JSON wire form as declarations a caller appends to a file:
51
+ * `jsonWireDeclarations('__carrick_')` and `type __carrick_Wire<S, E>`, the
52
+ * judge's own rule (`jsonWireRule`). One writer, so a held check and the
53
+ * scan's judge answer "what travels" the same way.
54
+ */
55
+ wire: string[];
56
+ /** The judge's three tolerances, read from its own code (`judgeTolerances('__carrick_')`): declarations to append beside `wire`. */
57
+ tolerances: JudgeTolerances;
58
+ /** The native TypeScript 7 executable, or null when only TypeScript 6's tsc is installed. */
59
+ native_tsc: string | null;
60
+ }
61
+ /** `judgeTscPath()` when it is the native executable, else null (no held compiler). */
62
+ export declare function nativeTscPath(tscPath?: string): string | null;
63
+ /**
64
+ * Write the shadow tree of the loader's default program under `outDir` (which
65
+ * must be outside the scan root). Reads the program; changes nothing in the
66
+ * checkout.
67
+ */
68
+ export declare function writeShadow(loader: ProjectLoader, outDir: string): ShadowResult;
69
+ /** The wire declarations and the one rule type a held check appends (prefix `__carrick_`). */
70
+ export declare function heldWire(): string[];