@descryy/adapter-java 0.2.0 → 0.3.1
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/LICENSE +8 -0
- package/dist/adapter.d.ts +5 -7
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +80 -95
- package/dist/adapter.js.map +1 -1
- package/dist/client.d.ts +65 -119
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +121 -222
- package/dist/client.js.map +1 -1
- package/dist/extract.d.ts +13 -22
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +189 -288
- package/dist/extract.js.map +1 -1
- package/dist/jpa.d.ts +32 -73
- package/dist/jpa.d.ts.map +1 -1
- package/dist/jpa.js +72 -166
- package/dist/jpa.js.map +1 -1
- package/dist/parse.d.ts +83 -152
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +101 -183
- package/dist/parse.js.map +1 -1
- package/dist/spring.d.ts +24 -58
- package/dist/spring.d.ts.map +1 -1
- package/dist/spring.js +80 -209
- package/dist/spring.js.map +1 -1
- package/package.json +16 -7
package/dist/client.js
CHANGED
|
@@ -1,114 +1,74 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The caller's half of the HTTP boundary: `USES_API`, golden pattern 08.
|
|
3
3
|
*
|
|
4
|
-
* `SERVES_API` is minted in `extract.ts` from a route's annotations
|
|
5
|
-
* the other end — an outbound call with a statically knowable path —
|
|
6
|
-
* the **same** `API_ENDPOINT` node from the same `endpointQsp`, so
|
|
7
|
-
* without either side knowing the other ran
|
|
8
|
-
* producers that mint different ids do not conflict, they silently fail to join.
|
|
4
|
+
* `SERVES_API` is minted in `extract.ts` from a route's annotations; this
|
|
5
|
+
* reads the other end — an outbound call with a statically knowable path —
|
|
6
|
+
* and mints the **same** `API_ENDPOINT` node from the same `endpointQsp`, so
|
|
7
|
+
* the two join without either side knowing the other ran (DEC-115).
|
|
9
8
|
*
|
|
10
9
|
* FUNCTION ──USES_API──▶ API_ENDPOINT ◀──SERVES_API── API_ROUTE
|
|
11
10
|
*
|
|
12
|
-
* ## What these edges
|
|
11
|
+
* ## What these edges mean
|
|
13
12
|
*
|
|
14
|
-
* Measured
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* is the **Verification status** axis (AI layer §20, §42), a separate axis from
|
|
24
|
-
* the confidence label. It is **not** service-to-service coupling, and a
|
|
25
|
-
* consumer reading it as "this service calls that service" would be wrong.
|
|
26
|
-
*
|
|
27
|
-
* The distinction therefore travels **in the edge**, as `attrs.callerKind`, not
|
|
28
|
-
* in a comment here. A count in a decision record is invisible to a consumer;
|
|
29
|
-
* `attrs` is what the edge carries. (`attrs` is not read above the IR — which is
|
|
30
|
-
* exactly why the same fact is also stated in the disclosure below, where a
|
|
31
|
-
* reader will see it.)
|
|
13
|
+
* Measured (`bench/client-call-census.mjs`, DEC-189): across `shopizer`,
|
|
14
|
+
* `mall`, `morphia`, `okhttp`, `spring-petclinic` there are 16 client call
|
|
15
|
+
* sites with a repo-relative literal path — 12 in test files, 4 on a mock
|
|
16
|
+
* transport, none production. So these edges are almost entirely
|
|
17
|
+
* `TEST_CASE`-shaped: integration tests driving `TestRestTemplate` at the
|
|
18
|
+
* app's own routes, useful for *Verification status* (which routes have
|
|
19
|
+
* integration coverage) — **not** service-to-service coupling. This travels
|
|
20
|
+
* in the edge as `attrs.callerKind`, since `attrs` (not comments) is what a
|
|
21
|
+
* consumer above the IR actually reads.
|
|
32
22
|
*
|
|
33
23
|
* ## Why the receiver's type is required
|
|
34
24
|
*
|
|
35
|
-
* `execute
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* The cost is disclosed rather than hidden: a chained builder
|
|
44
|
-
* (`new Request.Builder().url("/")`) has no receiver with a written type and is
|
|
45
|
-
* refused. All four such sites in the corpora are `mockWebServer`, so nothing
|
|
46
|
-
* real is lost today — but the refusal is a rule, not a measurement, and it will
|
|
47
|
-
* cost real call sites in a codebase that chains.
|
|
25
|
+
* `execute`/`put`/`delete`/`uri` are ordinary method names; admitting a call
|
|
26
|
+
* by name alone would wrongly emit `USES_API` for `list.put("/tmp/x")`. A
|
|
27
|
+
* call is admitted only when its receiver's **declared type** is a known
|
|
28
|
+
* client — R2 evidence, same as the rest of this adapter's receiver reads.
|
|
29
|
+
* Cost: a chained builder (`new Request.Builder().url("/")`) has no receiver
|
|
30
|
+
* with a written type and is refused — all 4 such sites in the corpora are
|
|
31
|
+
* `mockWebServer`, so nothing real is lost today, but a chaining codebase
|
|
32
|
+
* would lose real call sites to this rule.
|
|
48
33
|
*
|
|
49
34
|
* ## Ledger row D-FIX-3: a known client this reader does not extract
|
|
50
35
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* single `refuse(...)` call. **Zero edges and zero ledger rows is the same
|
|
57
|
-
* output a repository with no HTTP calls at all produces.** Sherpa's
|
|
58
|
-
* TypeScript diagnosis found the identical shape — 26 wrapped-`axios` call
|
|
59
|
-
* sites across 14 files, none reaching the refusal ledger — and it is the
|
|
60
|
-
* reason this row exists rather than being filed as ordinary recall.
|
|
61
|
-
*
|
|
62
|
-
* {@link BUILDER_CLIENT_TYPES} closes it for the two client families measured
|
|
63
|
-
* on the reference corpora (`bench/client-call-census.mjs`'s `CLIENTS.java`
|
|
64
|
-
* list, `okhttp3.OkHttpClient` and `java.net.http.HttpClient`) — **not by
|
|
65
|
-
* reading their calls**, but by recognising the receiver type and filing a
|
|
66
|
-
* refusal for every call through it. Both clients pass the outbound request as
|
|
67
|
-
* a **separately constructed object** (`Request`, `HttpRequest`) rather than a
|
|
68
|
-
* literal argument on the call itself, so building real extraction for them is
|
|
69
|
-
* a different, larger row — a second `firstStringArgument`-shaped read through
|
|
70
|
-
* a builder chain — and is out of scope here. What is in scope is closing the
|
|
71
|
-
* silence: **every** call through a receiver whose declared type names one of
|
|
72
|
-
* these clients is now accounted for, either as an edge (impossible for these
|
|
73
|
-
* two, by construction) or as a ledger row.
|
|
74
|
-
*
|
|
75
|
-
* ### Why the trigger is receiver-type resolution, not a file-level import scan
|
|
36
|
+
* A call through a client this adapter doesn't recognise fell out of the loop
|
|
37
|
+
* via `continue` before any `refuse(...)` — zero edges and zero ledger rows,
|
|
38
|
+
* indistinguishable from a repo with no HTTP calls at all (the same shape
|
|
39
|
+
* Sherpa's TypeScript diagnosis found: 26 wrapped-`axios` sites across 14
|
|
40
|
+
* files, none reaching the refusal ledger).
|
|
76
41
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* this reader can point at. Reusing it means the new population is *provably*
|
|
85
|
-
* bounded to calls whose receiver is declared as one of these types — no
|
|
86
|
-
* broader — and it costs nothing new: `writtenReceiverType` in `extract.ts`
|
|
87
|
-
* already resolves an arbitrary type name syntactically, whether or not this
|
|
88
|
-
* adapter goes on to model it, so `OkHttpClient` and `HttpClient` resolve
|
|
89
|
-
* exactly as `RestTemplate` does today.
|
|
42
|
+
* {@link BUILDER_CLIENT_TYPES} closes it for `okhttp3.OkHttpClient` and
|
|
43
|
+
* `java.net.http.HttpClient` (`bench/client-call-census.mjs`'s `CLIENTS.java`)
|
|
44
|
+
* — not by reading their calls (both pass the request as a separately
|
|
45
|
+
* constructed object, a different and larger extraction row, out of scope
|
|
46
|
+
* here), but by recognising the receiver type and filing a refusal for every
|
|
47
|
+
* call through it. Every call through one of these clients is now an edge or
|
|
48
|
+
* a ledger row, never neither.
|
|
90
49
|
*
|
|
91
|
-
*
|
|
50
|
+
* The trigger is receiver-type resolution (`typeOfReceiver`, R2 evidence),
|
|
51
|
+
* not a file-level import scan — a scan would fire on every call in a file
|
|
52
|
+
* that merely imports the client anywhere. Reusing `typeOfReceiver` bounds
|
|
53
|
+
* the population provably to calls whose receiver is declared as one of
|
|
54
|
+
* these types, at no extra cost: `writtenReceiverType` in `extract.ts`
|
|
55
|
+
* already resolves these names syntactically.
|
|
92
56
|
*
|
|
93
|
-
* `candidateClientRefs` (below) recomputes, independently of
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* narrow what counts as a candidate without the test that calls both noticing.
|
|
57
|
+
* `candidateClientRefs` (below) recomputes, independently of {@link
|
|
58
|
+
* clientCalls}'s loop, which references are candidates at all — factored out
|
|
59
|
+
* so a future edit to the loop can't silently narrow candidacy unnoticed.
|
|
97
60
|
* `test/client.test.ts` asserts `calls.length + refusals.length ===
|
|
98
|
-
* candidateClientRefs(method).length` on every fixture
|
|
99
|
-
*
|
|
100
|
-
* sites with no edge, no row, and no failing test.
|
|
61
|
+
* candidateClientRefs(method).length` on every fixture — DEC-098 found this
|
|
62
|
+
* missing the hard way, a guard that dropped 113 of 140 call sites silently.
|
|
101
63
|
*/
|
|
102
64
|
import { endpointQsp, nodeId } from "@descryy/ir";
|
|
103
65
|
/**
|
|
104
66
|
* Client types whose methods name an outbound HTTP call.
|
|
105
67
|
*
|
|
106
|
-
* `TestRestTemplate` is here deliberately
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* census that split on the file path reported two `mockWebServer` calls as
|
|
111
|
-
* production code.
|
|
68
|
+
* `TestRestTemplate` is here deliberately — Spring's integration-test client
|
|
69
|
+
* drives real HTTP at the app's real routes, so transport decides route
|
|
70
|
+
* relevance, not file location. A file-path split once misfiled two
|
|
71
|
+
* `mockWebServer` calls as production code.
|
|
112
72
|
*/
|
|
113
73
|
const CLIENT_TYPES = new Set([
|
|
114
74
|
"RestTemplate",
|
|
@@ -118,11 +78,9 @@ const CLIENT_TYPES = new Set([
|
|
|
118
78
|
"AsyncRestTemplate",
|
|
119
79
|
]);
|
|
120
80
|
/**
|
|
121
|
-
* Methods that take a URL or path as their first argument.
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* `WebClient`'s fluent builder step. Every one is admitted only in combination
|
|
125
|
-
* with a receiver of a {@link CLIENT_TYPES} type.
|
|
81
|
+
* Methods that take a URL or path as their first argument. `exchange`/`execute`
|
|
82
|
+
* are `RestTemplate`'s general forms; `uri` is `WebClient`'s fluent builder
|
|
83
|
+
* step. Admitted only with a {@link CLIENT_TYPES} receiver.
|
|
126
84
|
*/
|
|
127
85
|
const URL_FIRST = new Set([
|
|
128
86
|
"getForObject",
|
|
@@ -138,33 +96,24 @@ const URL_FIRST = new Set([
|
|
|
138
96
|
"uri",
|
|
139
97
|
]);
|
|
140
98
|
/**
|
|
141
|
-
* Known HTTP clients
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* arguments — there is nothing for `firstStringArgument` to read.
|
|
147
|
-
*
|
|
148
|
-
* `java.net.http.HttpClient`'s simple name is `HttpClient`, distinct from
|
|
149
|
-
* Spring's `WebClient` — no collision with {@link CLIENT_TYPES}.
|
|
99
|
+
* Known HTTP clients recognised by declared type but not extracted — see
|
|
100
|
+
* "Ledger row D-FIX-3" above. Keyed by type name, valued by the methods that
|
|
101
|
+
* initiate a request; every such call is unconditionally refused, since the
|
|
102
|
+
* URL and verb live in a request object built separately, not in this call's
|
|
103
|
+
* own arguments. `HttpClient`'s simple name doesn't collide with `WebClient`.
|
|
150
104
|
*/
|
|
151
105
|
const BUILDER_CLIENT_TYPES = {
|
|
152
106
|
OkHttpClient: new Set(["newCall"]),
|
|
153
107
|
HttpClient: new Set(["send", "sendAsync"]),
|
|
154
108
|
};
|
|
155
109
|
/**
|
|
156
|
-
* `WebClient`/`RestClient`'s
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* verb-bearing `.get()`/`.post()` call is a separate statement, gone by the
|
|
164
|
-
* time `spec`'s declared type is the only thing left to read), so every call
|
|
165
|
-
* through one of these is refused rather than silently dropped — the same
|
|
166
|
-
* "account for it as an edge or a ledger row, never nothing" standard
|
|
167
|
-
* {@link BUILDER_CLIENT_TYPES} already holds OkHttp/`HttpClient` to.
|
|
110
|
+
* `WebClient`/`RestClient`'s intermediate builder-step interfaces, referred
|
|
111
|
+
* to by simple name. Reached when the chain is split across a local variable
|
|
112
|
+
* (`var spec = client.get(); spec.uri("/x");`) instead of written inline —
|
|
113
|
+
* the other half of ledger row D-FIX-3. No initializer-tracing here (the
|
|
114
|
+
* verb-bearing `.get()`/`.post()` is a separate statement, gone by the time
|
|
115
|
+
* `spec`'s type is all that's left), so every such call is refused rather
|
|
116
|
+
* than silently dropped — same standard {@link BUILDER_CLIENT_TYPES} holds.
|
|
168
117
|
*/
|
|
169
118
|
const WEBCLIENT_SPLIT_BUILDER_TYPES = new Set([
|
|
170
119
|
"RequestHeadersUriSpec",
|
|
@@ -174,16 +123,11 @@ const WEBCLIENT_SPLIT_BUILDER_TYPES = new Set([
|
|
|
174
123
|
]);
|
|
175
124
|
/**
|
|
176
125
|
* `WebClient`/`RestClient`'s fluent verb-starters — the call that opens the
|
|
177
|
-
* chain
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* D-FIX-3 in the file header.
|
|
183
|
-
*
|
|
184
|
-
* `head`/`options` are real `WebClientRequestSpec`/`RestClient` entry points
|
|
185
|
-
* with no `VERB`-string precedent elsewhere in this file, so they are spelled
|
|
186
|
-
* out here rather than derived.
|
|
126
|
+
* chain (`client.get().uri("/x")...`), not the client's declared type. Why
|
|
127
|
+
* {@link URL_FIRST}'s `uri` entry alone was never enough: `uri` carries no
|
|
128
|
+
* verb, it sits one call earlier in the chain (ledger row D-FIX-3).
|
|
129
|
+
* `head`/`options` are real entry points with no `VERB` precedent elsewhere,
|
|
130
|
+
* spelled out here rather than derived.
|
|
187
131
|
*/
|
|
188
132
|
const BUILDER_VERB = {
|
|
189
133
|
get: "GET",
|
|
@@ -194,21 +138,15 @@ const BUILDER_VERB = {
|
|
|
194
138
|
head: "HEAD",
|
|
195
139
|
options: "OPTIONS",
|
|
196
140
|
};
|
|
197
|
-
/**
|
|
198
|
-
*
|
|
199
|
-
* object: `<base>.<name>()`. The literal `()` is a label, not a copy of the
|
|
200
|
-
* call's real arguments — see that function's doc.
|
|
201
|
-
*/
|
|
141
|
+
/** Matches `parse.ts`'s `receiverName` chain encoding: `<base>.<name>()` —
|
|
142
|
+
* literal `()` is a label, not a copy of the real arguments. */
|
|
202
143
|
const CHAIN_PATTERN = /^(.+)\.([A-Za-z_$][A-Za-z0-9_$]*)\(\)$/;
|
|
203
144
|
/** Every method name either extraction path or the builder-client path acts on. */
|
|
204
145
|
const TRACKED_METHODS = new Set([...URL_FIRST, ...Object.values(BUILDER_CLIENT_TYPES).flatMap((s) => [...s])]);
|
|
205
146
|
/**
|
|
206
|
-
* The HTTP verb a method name implies.
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* enum reference, not a literal — so they cannot be read here and are refused
|
|
210
|
-
* rather than defaulted to `GET`. A wrong verb produces an `endpointQsp` that
|
|
211
|
-
* joins nothing, which is a silent miss, or worse joins the wrong route.
|
|
147
|
+
* The HTTP verb a method name implies. `exchange`/`execute`/`uri` take the
|
|
148
|
+
* verb as a separate enum argument, unreadable here, so they're refused
|
|
149
|
+
* rather than defaulted to `GET` — a wrong verb joins the wrong route or none.
|
|
212
150
|
*/
|
|
213
151
|
const VERB = {
|
|
214
152
|
getForObject: "GET",
|
|
@@ -238,11 +176,8 @@ function argumentKindOf(text) {
|
|
|
238
176
|
return "field";
|
|
239
177
|
return "other";
|
|
240
178
|
}
|
|
241
|
-
/**
|
|
242
|
-
*
|
|
243
|
-
* path — mirrors `firstArgumentTextOf`'s own reach: a bare identifier, a
|
|
244
|
-
* known environment-read call, or something this reader does not trace.
|
|
245
|
-
*/
|
|
179
|
+
/** Why a client call's first argument couldn't be read as a literal path:
|
|
180
|
+
* a bare identifier, a known environment-read call, or untraced. */
|
|
246
181
|
function diagnoseArgument(text, parameterNames) {
|
|
247
182
|
if (text === undefined)
|
|
248
183
|
return CAPABILITY_GAP;
|
|
@@ -261,54 +196,39 @@ function relativePath(value) {
|
|
|
261
196
|
// `//host/path` is protocol-relative and names another origin.
|
|
262
197
|
if (value.startsWith("//"))
|
|
263
198
|
return undefined;
|
|
264
|
-
// A query string
|
|
265
|
-
//
|
|
266
|
-
// guarantee the join fails.
|
|
199
|
+
// A query string isn't part of the route template — `SERVES_API` never
|
|
200
|
+
// mints one, so keeping it would guarantee the join fails.
|
|
267
201
|
const cut = value.indexOf("?");
|
|
268
202
|
return cut === -1 ? value : value.slice(0, cut);
|
|
269
203
|
}
|
|
270
204
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* (
|
|
274
|
-
* relative path with no leading slash, e.g. `"orders/5"`) is NOT covered by
|
|
275
|
-
* this check and must not be reported through it.
|
|
205
|
+
* Names a *different* origin unambiguously: an explicit scheme (`http://...`)
|
|
206
|
+
* or protocol-relative (`//host/...`). A bare relative path with no leading
|
|
207
|
+
* slash (`"orders/5"`) fails {@link relativePath} but is NOT covered here.
|
|
276
208
|
*
|
|
277
|
-
* Split out after DEC-260's C#
|
|
278
|
-
*
|
|
279
|
-
* `/`
|
|
280
|
-
* `
|
|
281
|
-
* `
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
* identical latent defect — confirmed synthetically
|
|
286
|
-
* (`restTemplate.getForObject("orders/5", String.class)` was filed as
|
|
287
|
-
* "another origin" before this fix). **Not observed in either admitted
|
|
288
|
-
* corpus** (`spring-petclinic`, `shopizer` — all 3 real `USES_API` refusals
|
|
289
|
-
* naming another origin are unambiguous `http://` URLs, unaffected by this
|
|
290
|
-
* change), so this closes a rule that was correct only because nothing had
|
|
291
|
-
* tested it yet, not a live regression.
|
|
209
|
+
* Split out after DEC-260's C# row found the same bug in `adapter-csharp`
|
|
210
|
+
* (treating "no leading `/`" as another origin, misfiring on real
|
|
211
|
+
* `jellyfin`/`eShopOnWeb` paths that resolve against `HttpClient.BaseAddress`
|
|
212
|
+
* at runtime). Spring's `RestTemplate`/`WebClient` support the identical
|
|
213
|
+
* pattern (`RootUriTemplateHandler`, `baseUrl(...)`), so the same latent
|
|
214
|
+
* defect existed here — confirmed synthetically, not observed in either
|
|
215
|
+
* admitted corpus (`spring-petclinic`, `shopizer`: all 3 real `USES_API`
|
|
216
|
+
* other-origin refusals are unambiguous `http://` URLs, unaffected).
|
|
292
217
|
*/
|
|
293
218
|
function namesAnotherOrigin(value) {
|
|
294
219
|
return /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(value) || value.startsWith("//");
|
|
295
220
|
}
|
|
296
221
|
/**
|
|
297
|
-
* Every reference
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
* loop's own filter without touching this function fails the test instead of
|
|
303
|
-
* silently dropping call sites the way DEC-098's `containerOf` guard did.
|
|
222
|
+
* Every reference {@link clientCalls} will act on — an edge, a refusal, or a
|
|
223
|
+
* true silence past this point. Factored out so `test/client.test.ts`'s
|
|
224
|
+
* reconciliation assertion recomputes candidacy independently of the loop —
|
|
225
|
+
* a future edit that narrows the loop's filter fails the test instead of
|
|
226
|
+
* silently dropping sites, as DEC-098's `containerOf` guard once did.
|
|
304
227
|
*
|
|
305
|
-
* Receiver-type resolution is deliberately
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* one gap this reconciliation cannot close, and it is the same gap every
|
|
310
|
-
* other refusal ledger in this project discloses rather than guesses past:
|
|
311
|
-
* an unresolved receiver is not evidence the call is or is not a client.
|
|
228
|
+
* Receiver-type resolution is deliberately not done here (needs `extract.ts`'s
|
|
229
|
+
* scope tables) — a candidate may still be a true silence in
|
|
230
|
+
* {@link clientCalls} if `typeOfReceiver` returns `undefined`. An unresolved
|
|
231
|
+
* receiver is not evidence the call is or isn't a client.
|
|
312
232
|
*/
|
|
313
233
|
export function candidateClientRefs(method) {
|
|
314
234
|
return method.refs.filter((ref) => ref.kind === "call" &&
|
|
@@ -317,22 +237,15 @@ export function candidateClientRefs(method) {
|
|
|
317
237
|
ref.receiver !== "this");
|
|
318
238
|
}
|
|
319
239
|
/**
|
|
320
|
-
* Read one method's calls for outbound HTTP.
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
* and is supplied by the caller, because the scope rules for that live in
|
|
324
|
-
* `extract.ts` and a second copy of them would drift — the failure that
|
|
325
|
-
* `scopesFor`'s own header records.
|
|
240
|
+
* Read one method's calls for outbound HTTP. `typeOfReceiver` resolves a
|
|
241
|
+
* receiver to its declared type's simple name and is supplied by the caller
|
|
242
|
+
* — the scope rules live in `extract.ts`, and a second copy would drift.
|
|
326
243
|
*/
|
|
327
244
|
export function clientCalls(method, fromId, typeOfReceiver, inTestSourceSet) {
|
|
328
245
|
const calls = [];
|
|
329
246
|
const refusals = [];
|
|
330
|
-
/**
|
|
331
|
-
*
|
|
332
|
-
* refusal — the shared tail every admitted verb reaches, whether the verb
|
|
333
|
-
* came from `VERB[ref.name]` directly or from a builder-chain's opening
|
|
334
|
-
* call via {@link BUILDER_VERB}.
|
|
335
|
-
*/
|
|
247
|
+
/** Read `ref`'s first argument as a path and push a `ClientCall` or refusal
|
|
248
|
+
* — the shared tail for a verb from `VERB` or from {@link BUILDER_VERB}. */
|
|
336
249
|
const readPathAndEmit = (receiverType, ref, verb, refuse) => {
|
|
337
250
|
if (ref.firstStringArgument === undefined) {
|
|
338
251
|
refuse(`an HTTP call through ${receiverType}, but its path is not a bare string literal — a ` +
|
|
@@ -348,16 +261,12 @@ export function clientCalls(method, fromId, typeOfReceiver, inTestSourceSet) {
|
|
|
348
261
|
`another origin rather than a path in this repository. A scope boundary, not a gap.`, { blockedBy: null, refusalClass: "out-of-scope" });
|
|
349
262
|
return;
|
|
350
263
|
}
|
|
351
|
-
// A bare relative path
|
|
352
|
-
//
|
|
353
|
-
//
|
|
354
|
-
//
|
|
355
|
-
//
|
|
356
|
-
//
|
|
357
|
-
// classification rather than an edge. Not a per-call value and not a
|
|
358
|
-
// named blocking expression either, so `capability-gap` rather than
|
|
359
|
-
// `varies-per-call`: nothing here is caller-supplied, this reader just
|
|
360
|
-
// cannot see the base configuration.
|
|
264
|
+
// A bare relative path, no leading slash, no scheme — structurally like
|
|
265
|
+
// C#'s `HttpClient.BaseAddress` case. May resolve against a configured
|
|
266
|
+
// root URI (`RootUriTemplateHandler`, `baseUrl(...)`) this reader can't
|
|
267
|
+
// see, so neither an edge nor an out-of-scope claim is honest (rule 2).
|
|
268
|
+
// `capability-gap`, not `varies-per-call` — nothing here is caller-
|
|
269
|
+
// supplied, the base configuration is just invisible.
|
|
361
270
|
refuse(`an HTTP call through ${receiverType} to \`${ref.firstStringArgument}\`, a relative path ` +
|
|
362
271
|
`with no leading slash. This reader cannot tell whether it resolves inside this repository ` +
|
|
363
272
|
`— against a configured base URI this call site does not state — or elsewhere, so neither ` +
|
|
@@ -370,28 +279,23 @@ export function clientCalls(method, fromId, typeOfReceiver, inTestSourceSet) {
|
|
|
370
279
|
template,
|
|
371
280
|
verb,
|
|
372
281
|
line: ref.line,
|
|
373
|
-
//
|
|
374
|
-
//
|
|
375
|
-
// `TestRestTemplate` from an unannotated helper —
|
|
376
|
-
//
|
|
377
|
-
// `src/test/java`.
|
|
378
|
-
// inferring it from the annotation asks a narrower question than the one
|
|
379
|
-
// being answered. If the framework will tell you, never infer it.
|
|
282
|
+
// Source set, not just the annotation: `method.isTest` reads `@Test`,
|
|
283
|
+
// but shopizer's `ServicesTestSupport.getHeader` drives
|
|
284
|
+
// `TestRestTemplate` from an unannotated helper — annotation alone
|
|
285
|
+
// mislabelled two of nine edges `production` despite sitting in
|
|
286
|
+
// `src/test/java`. If the framework will tell you, never infer it.
|
|
380
287
|
callerKind: method.isTest || inTestSourceSet ? "test" : "production",
|
|
381
288
|
});
|
|
382
289
|
};
|
|
383
290
|
for (const ref of candidateClientRefs(method)) {
|
|
384
291
|
// WebClient/RestClient's fluent chain: `client.get().uri("/x")`. The
|
|
385
|
-
// receiver
|
|
386
|
-
//
|
|
387
|
-
//
|
|
388
|
-
// the chain, not from `uri` itself. See ledger row D-FIX-3 and
|
|
389
|
-
// {@link BUILDER_VERB}'s doc.
|
|
292
|
+
// receiver for `uri` is the *opening* call as text (`client.get()`), not
|
|
293
|
+
// a name to look up directly — the base is resolved instead, and the
|
|
294
|
+
// verb comes from the chain (ledger row D-FIX-3, {@link BUILDER_VERB}).
|
|
390
295
|
const chain = ref.name === "uri" ? CHAIN_PATTERN.exec(ref.receiver) : null;
|
|
391
296
|
if (chain !== null) {
|
|
392
|
-
// Both groups
|
|
393
|
-
//
|
|
394
|
-
// the pattern alone.
|
|
297
|
+
// Both groups guaranteed by `CHAIN_PATTERN` once `exec` succeeds —
|
|
298
|
+
// `noUncheckedIndexedAccess` can't see that from the pattern alone.
|
|
395
299
|
const base = chain[1];
|
|
396
300
|
const opener = chain[2];
|
|
397
301
|
const receiverType = typeOfReceiver(base);
|
|
@@ -447,13 +351,8 @@ export function clientCalls(method, fromId, typeOfReceiver, inTestSourceSet) {
|
|
|
447
351
|
}
|
|
448
352
|
return { calls, refusals };
|
|
449
353
|
}
|
|
450
|
-
/**
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
* Shares `endpointQsp` with `extract.ts`'s `SERVES_API` block rather than
|
|
454
|
-
* recomputing the id, because the two must agree exactly and the failure when
|
|
455
|
-
* they do not is silent.
|
|
456
|
-
*/
|
|
354
|
+
/** The `API_ENDPOINT` a call joins to — minted identically to the route side,
|
|
355
|
+
* sharing `endpointQsp` with `extract.ts` since a mismatch fails silently. */
|
|
457
356
|
export function endpointFor(scope, call, producedBy, normalise) {
|
|
458
357
|
const template = normalise(call.template);
|
|
459
358
|
return {
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAmC,MAAM,aAAa,CAAC;AAInF;;;;;;;GAOG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,cAAc;IACd,kBAAkB;IAClB,WAAW;IACX,YAAY;IACZ,mBAAmB;CACpB,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,cAAc;IACd,cAAc;IACd,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,KAAK;IACL,QAAQ;IACR,UAAU;IACV,SAAS;IACT,KAAK;CACN,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,oBAAoB,GAAkD;IAC1E,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;IAClC,UAAU,EAAE,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,6BAA6B,GAAG,IAAI,GAAG,CAAC;IAC5C,uBAAuB;IACvB,oBAAoB;IACpB,oBAAoB;IACpB,iBAAiB;CAClB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,YAAY,GAAqC;IACrD,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;CACnB,CAAC;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,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Java units to Canonical IR.
|
|
3
3
|
*
|
|
4
|
-
* ## Why a breadth adapter reaches further in Java than in most languages
|
|
5
|
-
*
|
|
6
4
|
* Every import is explicit and fully qualified, every field and parameter
|
|
7
|
-
* carries a written type,
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* through a receiver, which in TypeScript needed R3.
|
|
11
|
-
*
|
|
12
|
-
* That is read as **R2 evidence, and never R3**. R2 is a reference resolved to a
|
|
13
|
-
* specific definition, which is exactly what happens here — the level names the
|
|
14
|
-
* evidence, not the machinery, and Java hands over the same evidence an LSP
|
|
15
|
-
* would without one being run. R3 is a *checked shape*, and a written annotation
|
|
16
|
-
* is not one: it can be shadowed, it can be generic, and nothing here verifies
|
|
17
|
-
* which overload the compiler would select. Claiming R3 for a name-level fact is
|
|
18
|
-
* the confusion DEC-058 was written about, where 83% of an adapter's edges
|
|
19
|
-
* claimed a level they had not earned.
|
|
20
|
-
*
|
|
21
|
-
* `IMPORTS` stays at R1. An import is module resolution and nothing more.
|
|
5
|
+
* carries a written type, so `repo.findById(id)` resolves from the declaration
|
|
6
|
+
* `private final OwnerRepository repo` alone — a call through a receiver,
|
|
7
|
+
* which in TypeScript needed R3.
|
|
22
8
|
*
|
|
23
|
-
*
|
|
9
|
+
* That is **R2 evidence, never R3**: a reference resolved to a specific
|
|
10
|
+
* definition. R3 is a *checked shape*, and a written annotation is not one —
|
|
11
|
+
* it can be shadowed, be generic, and nothing here verifies overload
|
|
12
|
+
* selection. Claiming R3 for a name-level fact is the confusion DEC-058 was
|
|
13
|
+
* written about (83% of an adapter's edges once claimed an unearned level).
|
|
14
|
+
* `IMPORTS` stays at R1 — module resolution, nothing more.
|
|
24
15
|
*
|
|
25
|
-
* `var` declarations, chained calls whose receiver is
|
|
26
|
-
* variables, and
|
|
27
|
-
*
|
|
28
|
-
* missing edge is a disclosed gap
|
|
16
|
+
* Deliberately unresolved: `var` declarations, chained calls whose receiver is
|
|
17
|
+
* another call, generic type variables, and names reachable only through an
|
|
18
|
+
* ambiguous wildcard import. Each goes to the ledger with its reason — a
|
|
19
|
+
* missing edge is a disclosed gap, a guessed one corrupts every layer above.
|
|
29
20
|
*/
|
|
30
21
|
import { type IdentityScope, type IREdge, type IRNode, type ResolutionLevel, type UnresolvedRef } from "@descryy/ir";
|
|
31
22
|
import type { JavaUnit } from "./parse.ts";
|
package/dist/extract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAiC,QAAQ,EAAE,MAAM,YAAY,CAAC;AAK1E,eAAO,MAAM,QAAQ,SAAS,CAAC;AAK/B;qCACqC;AACrC,eAAO,MAAM,eAAe,cAAc,CAAC;AAqC3C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;CAC/C;AA6ID,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,CAgrBvD"}
|