@descryy/adapter-go 0.5.0 → 0.5.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/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +83 -8
- package/dist/adapter.js.map +1 -1
- package/dist/extract.d.ts +53 -0
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +273 -5
- package/dist/extract.js.map +1 -1
- package/dist/go-types.d.ts +75 -0
- package/dist/go-types.d.ts.map +1 -0
- package/dist/go-types.js +198 -0
- package/dist/go-types.js.map +1 -0
- package/dist/grpc.d.ts +29 -0
- package/dist/grpc.d.ts.map +1 -1
- package/dist/grpc.js +21 -2
- package/dist/grpc.js.map +1 -1
- package/dist/parse.d.ts +10 -0
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +10 -2
- package/dist/parse.js.map +1 -1
- package/dist/routes.d.ts +18 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +156 -19
- package/dist/routes.js.map +1 -1
- package/goshapes/go.mod +17 -0
- package/goshapes/main.go +596 -0
- package/package.json +8 -7
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAML,KAAK,eAAe,EAGpB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAML,KAAK,eAAe,EAGpB,KAAK,eAAe,EAOrB,MAAM,aAAa,CAAC;AAErB,OAAO,EAA2C,cAAc,EAAwB,MAAM,yBAAyB,CAAC;AAKxH,OAAO,EAA0B,QAAQ,EAA4B,MAAM,cAAc,CAAC;AAG1F,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC;;;;;;kCAMkC;AAClC,eAAO,MAAM,eAAe,EAAE,MAErB,CAAC;AACV,eAAO,MAAM,gBAAgB,sBAAuB,CAAC;AAerD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,eAAe,CAAC;CAC1C;AAyBD,MAAM,WAAW,SAAU,SAAQ,eAAe;IAChD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAwSzE;AAED,2DAA2D;AAC3D,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAS7D;AAED,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/adapter.js
CHANGED
|
@@ -6,12 +6,13 @@ import { createHash } from "node:crypto";
|
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
8
|
import { join } from "node:path";
|
|
9
|
-
import { CLIENT_BASE_EXTRACTOR, CLIENT_CALL_EXTRACTOR, ORM_EXTRACTOR, ROUTE_EXTRACTOR, ROUTE_HANDLER_EXTRACTOR, } from "@descryy/ir";
|
|
10
|
-
import { discover, isolateFile, toRepoRelative } from "@descryy/adapter-common";
|
|
9
|
+
import { CLIENT_BASE_EXTRACTOR, CLIENT_CALL_EXTRACTOR, ORM_EXTRACTOR, ROUTE_EXTRACTOR, ROUTE_HANDLER_EXTRACTOR, SHAPE_DIRECTION_EXTRACTOR, } from "@descryy/ir";
|
|
10
|
+
import { discover, extractOrDegrade, isolateFile, toRepoRelative } from "@descryy/adapter-common";
|
|
11
11
|
import { parserFor, parseText } from "@descryy/adapter-treesitter";
|
|
12
12
|
import { buildConstraintOf, readFile as readGoFile } from "./parse.js";
|
|
13
13
|
import { goModules, importPathOf } from "./modules.js";
|
|
14
|
-
import { extract, LANGUAGE, REASONS } from "./extract.js";
|
|
14
|
+
import { degradedGraph, extract, LANGUAGE, REASONS } from "./extract.js";
|
|
15
|
+
import { goToolchainAvailable, runGoShapeExtractor } from "./go-types.js";
|
|
15
16
|
export const ADAPTER_ID = "adapter-go";
|
|
16
17
|
/** The installed package's own declared version — read directly from this
|
|
17
18
|
* package's own package.json rather than hardcoded, so the two can never
|
|
@@ -78,8 +79,24 @@ export function createGoAdapter(options = {}) {
|
|
|
78
79
|
capabilities() {
|
|
79
80
|
return {
|
|
80
81
|
maxResolution: ceiling,
|
|
81
|
-
nodeTypes: [
|
|
82
|
-
|
|
82
|
+
nodeTypes: [
|
|
83
|
+
"MODULE",
|
|
84
|
+
"CLASS",
|
|
85
|
+
"MODEL",
|
|
86
|
+
"FUNCTION",
|
|
87
|
+
"TEST_CASE",
|
|
88
|
+
"API_ROUTE",
|
|
89
|
+
"API_ENDPOINT",
|
|
90
|
+
// `DTO`: go/types-backed request/response shapes — real only when
|
|
91
|
+
// `maxResolution: 3` is requested (`go-types.ts`); an adapter
|
|
92
|
+
// instance that never asks for R3 never emits one, so it is
|
|
93
|
+
// listed only alongside that opt-in, not unconditionally.
|
|
94
|
+
...(ceiling >= 3 ? ["DTO"] : []),
|
|
95
|
+
],
|
|
96
|
+
// `IMPLEMENTS` absent: Go interface satisfaction is structural and
|
|
97
|
+
// this adapter does not attempt it. Embedding becomes `INHERITS`.
|
|
98
|
+
// (R3 exists now, opt-in, for `DTO` shape evidence — see `go-types.ts` —
|
|
99
|
+
// but that is a different claim from confirming interface satisfaction.)
|
|
83
100
|
edgeTypes: ["IMPORTS", "CALLS", "READS", "TESTS", "INHERITS", "USES_TYPE", "SERVES_API", "USES_API"],
|
|
84
101
|
hasCallHierarchy: false,
|
|
85
102
|
hasTypeHierarchy: false,
|
|
@@ -93,6 +110,8 @@ export function createGoAdapter(options = {}) {
|
|
|
93
110
|
"github.com/labstack/echo",
|
|
94
111
|
"github.com/gorilla/mux",
|
|
95
112
|
"google.golang.org/grpc",
|
|
113
|
+
"github.com/gofiber/fiber/v2",
|
|
114
|
+
"github.com/gofiber/fiber",
|
|
96
115
|
],
|
|
97
116
|
// Both HTTP boundary halves: route-extractor (pattern 04), client-call-extractor (real USES_API, `client.ts`).
|
|
98
117
|
// DEC-262: safe either way — never fails a golden pattern, passes genuinely or stays honestly skipped.
|
|
@@ -112,6 +131,10 @@ export function createGoAdapter(options = {}) {
|
|
|
112
131
|
CLIENT_CALL_EXTRACTOR,
|
|
113
132
|
CLIENT_BASE_EXTRACTOR,
|
|
114
133
|
ROUTE_HANDLER_EXTRACTOR,
|
|
134
|
+
// `attrs.roles` on the handler -> DTO `USES_TYPE` edge (`extract.ts`'s
|
|
135
|
+
// handler pass) — declared only alongside the same `maxResolution: 3`
|
|
136
|
+
// opt-in `DTO` itself needs, for the same reason.
|
|
137
|
+
...(ceiling >= 3 ? [SHAPE_DIRECTION_EXTRACTOR] : []),
|
|
115
138
|
],
|
|
116
139
|
};
|
|
117
140
|
},
|
|
@@ -163,7 +186,40 @@ export function createGoAdapter(options = {}) {
|
|
|
163
186
|
}
|
|
164
187
|
units.push({ ...unit, importPath, buildConstraint: buildConstraintOf(text) });
|
|
165
188
|
}
|
|
166
|
-
|
|
189
|
+
let reached = units.length === 0 ? 0 : ceiling;
|
|
190
|
+
// --- R3: go/types shape evidence, opt-in via `maxResolution: 3` -------
|
|
191
|
+
//
|
|
192
|
+
// Attempted only when a caller asked for it and there is something to
|
|
193
|
+
// analyse. **Honest degradation, not a silent cap**: every branch that
|
|
194
|
+
// fails to reach R3 records why, and `reached` drops back to R2 — this
|
|
195
|
+
// run never claims a resolution its own evidence does not support
|
|
196
|
+
// (rule 3). See `go-types.ts`'s header for the full contract and
|
|
197
|
+
// `DEC-NEXT-go-shapes-toolchain-unverified.md` for what remains
|
|
198
|
+
// unverified about this path in this environment.
|
|
199
|
+
let goShapes;
|
|
200
|
+
let goShapesUnavailableReason;
|
|
201
|
+
if (reached >= 3) {
|
|
202
|
+
if (!goToolchainAvailable()) {
|
|
203
|
+
goShapesUnavailableReason =
|
|
204
|
+
"the Go toolchain (`go`) is not installed or not on PATH — R3 shape evidence needs it to " +
|
|
205
|
+
"run go/types against this repository; staying at R2.";
|
|
206
|
+
reached = 2;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
const outcome = await runGoShapeExtractor({
|
|
210
|
+
repoRoot: ctx.root.absolutePath,
|
|
211
|
+
signal: ctx.signal,
|
|
212
|
+
timeoutMs: Math.max(ctx.prepareTimeoutMs, 60_000),
|
|
213
|
+
});
|
|
214
|
+
if (outcome.ok) {
|
|
215
|
+
goShapes = outcome.result;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
goShapesUnavailableReason = `go/types shape extraction did not complete: ${outcome.reason} — staying at R2.`;
|
|
219
|
+
reached = 2;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
167
223
|
session = {
|
|
168
224
|
root: ctx.root,
|
|
169
225
|
files,
|
|
@@ -173,6 +229,8 @@ export function createGoAdapter(options = {}) {
|
|
|
173
229
|
unfinished,
|
|
174
230
|
withoutModule,
|
|
175
231
|
ownModulePaths: modules.map((m) => m.path),
|
|
232
|
+
...(goShapes === undefined ? {} : { goShapes }),
|
|
233
|
+
...(goShapesUnavailableReason === undefined ? {} : { goShapesUnavailableReason }),
|
|
176
234
|
};
|
|
177
235
|
return reached;
|
|
178
236
|
},
|
|
@@ -225,14 +283,31 @@ export function createGoAdapter(options = {}) {
|
|
|
225
283
|
if (active === undefined || active.units.length === 0) {
|
|
226
284
|
return { nodes: [], edges: [], unresolved: [] };
|
|
227
285
|
}
|
|
228
|
-
|
|
286
|
+
// A throw here used to escape `emit()`/`extractNodes()`/`extractEdges()`
|
|
287
|
+
// and be reported by the caller as the whole language being not
|
|
288
|
+
// analysable — indistinguishable from this adapter being broken for
|
|
289
|
+
// every repository. `extractOrDegrade` (`@descryy/adapter-common`) turns
|
|
290
|
+
// the throw into a disclosed `MODULE`-per-file fallback instead
|
|
291
|
+
// (`degradedGraph`, in `./extract.ts`) — see that function's doc comment
|
|
292
|
+
// for why `MODULE` (keyed by the already-resolved import path), not
|
|
293
|
+
// `FILE`, is the right fallback for Go.
|
|
294
|
+
const degradedByThrow = (cause) => degradedGraph({
|
|
295
|
+
repo: active.root.repo,
|
|
296
|
+
workspace: active.root.workspace,
|
|
297
|
+
producedBy: PRODUCED_BY,
|
|
298
|
+
files: active.units,
|
|
299
|
+
cause,
|
|
300
|
+
});
|
|
301
|
+
return extractOrDegrade(() => extract({
|
|
229
302
|
repo: active.root.repo,
|
|
230
303
|
scope: { repo: active.root.repo, ...(active.root.workspace === undefined ? {} : { workspace: active.root.workspace }) },
|
|
231
304
|
producedBy: PRODUCED_BY,
|
|
232
305
|
reached: active.reached,
|
|
233
306
|
files: active.units,
|
|
234
307
|
ownModulePaths: active.ownModulePaths,
|
|
235
|
-
|
|
308
|
+
...(active.goShapes === undefined ? {} : { goShapes: active.goShapes }),
|
|
309
|
+
...(active.goShapesUnavailableReason === undefined ? {} : { goShapesUnavailableReason: active.goShapesUnavailableReason }),
|
|
310
|
+
}), degradedByThrow);
|
|
236
311
|
}
|
|
237
312
|
}
|
|
238
313
|
/** Content hash of a repo-relative file, for `FileRef`. */
|
package/dist/adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAUL,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,eAAe,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CAAC,CAAC,EAAE,yBAAyB,EAAE,MAAM,CAAC,yBAAyB,EAAE,CAAC;SAC3H,CAAC,EACJ,eAAe,CAChB,CAAC;IACJ,CAAC;AACH,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,MAAM,CAAC,IAAY,EAAE,QAAgB;IACnD,IAAI,CAAC;QACH,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACpG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,8EAA8E;QAC9E,6EAA6E;QAC7E,MAAM,IAAI,GAAG,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,MAAM,CAAE,KAA+B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACnH,OAAO,cAAc,IAAI,IAAI,QAAQ,EAAE,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/extract.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type IdentityScope, type IREdge, type IRNode, type ResolutionLevel, type UnresolvedRef } from "@descryy/ir";
|
|
7
7
|
import type { GoFile } from "./parse.ts";
|
|
8
|
+
import type { GoShapeResult } from "./go-types.ts";
|
|
8
9
|
export declare const LANGUAGE = "go";
|
|
9
10
|
declare const REASONS: {
|
|
10
11
|
readonly outside: string;
|
|
@@ -14,6 +15,8 @@ declare const REASONS: {
|
|
|
14
15
|
readonly noImportPath: string;
|
|
15
16
|
readonly unknownName: "no declaration for this name in the package, its imports, or the analysed set.";
|
|
16
17
|
readonly routeIdCollision: string;
|
|
18
|
+
readonly grpcImplUnreadable: string;
|
|
19
|
+
readonly grpcImplUntyped: string;
|
|
17
20
|
};
|
|
18
21
|
export interface ExtractInput {
|
|
19
22
|
readonly repo: string;
|
|
@@ -25,12 +28,62 @@ export interface ExtractInput {
|
|
|
25
28
|
* them is ours whether or not this run read it; treating it as a dependency
|
|
26
29
|
* is the error that never surfaces. Absent = no boundary attribution. */
|
|
27
30
|
readonly ownModulePaths?: readonly string[];
|
|
31
|
+
/**
|
|
32
|
+
* `go/types`-backed struct shapes and the handlers that decode/encode them —
|
|
33
|
+
* `go-types.ts`'s `runGoShapeExtractor`, or absent when this run never
|
|
34
|
+
* attempted it (the default) or the toolchain/helper was unavailable.
|
|
35
|
+
* **Only consumed when `reached >= 3`** — `adapter.ts` sets the two
|
|
36
|
+
* together, and this function re-checks it rather than trusting the caller,
|
|
37
|
+
* the same defence-in-depth every other resolution-gated pass here applies.
|
|
38
|
+
*/
|
|
39
|
+
readonly goShapes?: GoShapeResult;
|
|
40
|
+
/** Set when a caller asked for R3 (`maxResolution: 3`) and this run could not
|
|
41
|
+
* reach it — `adapter.ts`'s honest-degradation message, surfaced here as one
|
|
42
|
+
* disclosed row rather than swallowed. Never set alongside `goShapes`. */
|
|
43
|
+
readonly goShapesUnavailableReason?: string;
|
|
28
44
|
}
|
|
29
45
|
export interface Extraction {
|
|
30
46
|
readonly nodes: readonly IRNode[];
|
|
31
47
|
readonly edges: readonly IREdge[];
|
|
32
48
|
readonly unresolved: readonly UnresolvedRef[];
|
|
33
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* The fallback graph when `extract()` throws mid-run, per
|
|
52
|
+
* `DEC-NEXT-degraded-graph-shape-for-adapters-without-one.md`.
|
|
53
|
+
*
|
|
54
|
+
* `MODULE`, not `FILE` — unlike C#/Java (whose module identity is a
|
|
55
|
+
* declaration *inside* the file, exactly the machinery a mid-extraction
|
|
56
|
+
* throw means just failed), Go's import path is, in this adapter's own
|
|
57
|
+
* words, "declared, so `qsp` needs no anchor inference": it is resolved from
|
|
58
|
+
* `go.mod`'s `module` line plus the file's own directory (`modules.ts`'s
|
|
59
|
+
* `importPathOf`), never from parsing the file's content. `prepare()`
|
|
60
|
+
* already computed it, successfully, for every unit that reaches this
|
|
61
|
+
* function — `isolateFile` keeps a per-file parse/walk throw from ever
|
|
62
|
+
* populating `input.files` in the first place, so a throw here is
|
|
63
|
+
* necessarily further downstream (cross-file resolution, edge building), not
|
|
64
|
+
* a sign the identity below is unreliable. Minting `MODULE` with the exact
|
|
65
|
+
* id computation `extract()`'s own healthy path uses (`namespaceOf` +
|
|
66
|
+
* `symbolQsp`) means a degraded run's nodes merge with a later healthy run's
|
|
67
|
+
* for the same files, rather than forking against them the way a generic
|
|
68
|
+
* `FILE` node would.
|
|
69
|
+
*
|
|
70
|
+
* The per-file `try`/`catch` is defensive only: `namespaceOf` reads fields
|
|
71
|
+
* `prepare()` already resolved without error, so it should be unreachable in
|
|
72
|
+
* practice. If some future caller ever hands this function a unit whose
|
|
73
|
+
* fields are not what `prepare()` guarantees, falling back to the shared,
|
|
74
|
+
* language-blind `fileNode` (`@descryy/adapter-common`) for that one file
|
|
75
|
+
* keeps the fallback itself from becoming a second uncaught throw.
|
|
76
|
+
*
|
|
77
|
+
* One disclosure row, not one per file — the fact is about the run. Anchored
|
|
78
|
+
* to the first file's node because the ledger requires a `fromNodeId`.
|
|
79
|
+
*/
|
|
80
|
+
export declare function degradedGraph(input: {
|
|
81
|
+
readonly repo: string;
|
|
82
|
+
readonly workspace: string | undefined;
|
|
83
|
+
readonly producedBy: string;
|
|
84
|
+
readonly files: readonly GoFile[];
|
|
85
|
+
readonly cause: string;
|
|
86
|
+
}): Extraction;
|
|
34
87
|
export declare function extract(input: ExtractInput): Extraction;
|
|
35
88
|
export { REASONS };
|
|
36
89
|
//# sourceMappingURL=extract.d.ts.map
|
package/dist/extract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA;;;;G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;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,GAAG,UAAU,CA6Cb;AAkCD,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,CA+vCvD;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/extract.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* anchor inference (DEC-047). `IMPLEMENTS` never emitted — structural in Go.
|
|
5
5
|
*/
|
|
6
6
|
import { edgeId, endpointQsp, externalQsp, nodeId, normaliseEndpointPath, symbolQsp, testCaseQsp, } from "@descryy/ir";
|
|
7
|
+
import { fileNode } from "@descryy/adapter-common";
|
|
7
8
|
import { attributeExternal } from "./external.js";
|
|
8
9
|
import { isUniverse } from "./parse.js";
|
|
9
10
|
import { fieldReadsIn as gormFieldReadsIn, gormShapeOf, isGormModel } from "./gorm.js";
|
|
@@ -33,7 +34,87 @@ const REASONS = {
|
|
|
33
34
|
routeIdCollision: "this route's method and path are identical to one already emitted, so it collapsed onto " +
|
|
34
35
|
"the same API_ROUTE node and this declaration's own SERVES_API edge and location were " +
|
|
35
36
|
"dropped. The endpoint is real; this specific declaration is not the one the graph kept.",
|
|
37
|
+
grpcImplUnreadable: "the registration's implementation argument is not an inline `Type{}` (optionally `&Type{}`) value and " +
|
|
38
|
+
"not a plain name — a wrapper call, a selector expression, or a form this reader does not read. The " +
|
|
39
|
+
"route is real; the code implementing it is not established.",
|
|
40
|
+
grpcImplUntyped: "the registration's implementation argument names a value with no declared type this reader could " +
|
|
41
|
+
"trace to a composite literal — a function parameter, an interface-typed value with no concrete local " +
|
|
42
|
+
"binding, or a name declared outside the analysed set. The route is real; the code implementing it is " +
|
|
43
|
+
"not established.",
|
|
36
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* The fallback graph when `extract()` throws mid-run, per
|
|
47
|
+
* `DEC-NEXT-degraded-graph-shape-for-adapters-without-one.md`.
|
|
48
|
+
*
|
|
49
|
+
* `MODULE`, not `FILE` — unlike C#/Java (whose module identity is a
|
|
50
|
+
* declaration *inside* the file, exactly the machinery a mid-extraction
|
|
51
|
+
* throw means just failed), Go's import path is, in this adapter's own
|
|
52
|
+
* words, "declared, so `qsp` needs no anchor inference": it is resolved from
|
|
53
|
+
* `go.mod`'s `module` line plus the file's own directory (`modules.ts`'s
|
|
54
|
+
* `importPathOf`), never from parsing the file's content. `prepare()`
|
|
55
|
+
* already computed it, successfully, for every unit that reaches this
|
|
56
|
+
* function — `isolateFile` keeps a per-file parse/walk throw from ever
|
|
57
|
+
* populating `input.files` in the first place, so a throw here is
|
|
58
|
+
* necessarily further downstream (cross-file resolution, edge building), not
|
|
59
|
+
* a sign the identity below is unreliable. Minting `MODULE` with the exact
|
|
60
|
+
* id computation `extract()`'s own healthy path uses (`namespaceOf` +
|
|
61
|
+
* `symbolQsp`) means a degraded run's nodes merge with a later healthy run's
|
|
62
|
+
* for the same files, rather than forking against them the way a generic
|
|
63
|
+
* `FILE` node would.
|
|
64
|
+
*
|
|
65
|
+
* The per-file `try`/`catch` is defensive only: `namespaceOf` reads fields
|
|
66
|
+
* `prepare()` already resolved without error, so it should be unreachable in
|
|
67
|
+
* practice. If some future caller ever hands this function a unit whose
|
|
68
|
+
* fields are not what `prepare()` guarantees, falling back to the shared,
|
|
69
|
+
* language-blind `fileNode` (`@descryy/adapter-common`) for that one file
|
|
70
|
+
* keeps the fallback itself from becoming a second uncaught throw.
|
|
71
|
+
*
|
|
72
|
+
* One disclosure row, not one per file — the fact is about the run. Anchored
|
|
73
|
+
* to the first file's node because the ledger requires a `fromNodeId`.
|
|
74
|
+
*/
|
|
75
|
+
export function degradedGraph(input) {
|
|
76
|
+
const scope = { repo: input.repo, workspace: input.workspace };
|
|
77
|
+
const nodes = input.files.map((unit) => {
|
|
78
|
+
try {
|
|
79
|
+
const namespace = namespaceOf(unit);
|
|
80
|
+
const stem = unit.file.slice(unit.file.lastIndexOf("/") + 1).replace(/\.go$/, "");
|
|
81
|
+
return {
|
|
82
|
+
id: nodeId(scope, "MODULE", symbolQsp(namespace, [stem]), LANGUAGE),
|
|
83
|
+
type: "MODULE",
|
|
84
|
+
name: `${stem}.go`,
|
|
85
|
+
file: unit.file,
|
|
86
|
+
range: { startLine: 1, endLine: 1 },
|
|
87
|
+
language: LANGUAGE,
|
|
88
|
+
producedBy: input.producedBy,
|
|
89
|
+
resolution: 0,
|
|
90
|
+
attrs: { parsed: false },
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return fileNode(scope, unit.file, input.producedBy);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const anchor = nodes[0];
|
|
98
|
+
const unresolved = anchor === undefined
|
|
99
|
+
? []
|
|
100
|
+
: [
|
|
101
|
+
{
|
|
102
|
+
fromNodeId: anchor.id,
|
|
103
|
+
edgeType: "IMPORTS",
|
|
104
|
+
rawTarget: "(entire repository)",
|
|
105
|
+
file: anchor.file,
|
|
106
|
+
line: 1,
|
|
107
|
+
producedBy: input.producedBy,
|
|
108
|
+
reason: `NO GRAPH WAS PRODUCED for ${String(input.files.length)} Go file(s). ${input.cause}. ` +
|
|
109
|
+
"Modules are listed because their import paths are a fact about the filesystem " +
|
|
110
|
+
"(go.mod plus directory); their contents are absent. Every finding, coverage figure " +
|
|
111
|
+
"and 'not affected' statement over this repository is UNSUPPORTED — this is a failed " +
|
|
112
|
+
"analysis, not an empty repository.",
|
|
113
|
+
attrs: { refusalClass: "capability-gap" },
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
return { nodes, edges: [], unresolved };
|
|
117
|
+
}
|
|
37
118
|
/** How many hops of `var A = B; var B = C` to follow before giving up. */
|
|
38
119
|
const ALIAS_PASSES = 4;
|
|
39
120
|
/** Usually the import path, except Go's external test package (`package storage_test`) is distinct — collapsing them lost `contextDone`/`makeInt64Pointer` on prometheus. */
|
|
@@ -100,6 +181,26 @@ export function extract(input) {
|
|
|
100
181
|
const packages = new Map();
|
|
101
182
|
const moduleIdOf = new Map();
|
|
102
183
|
const ownModulePaths = input.ownModulePaths ?? [];
|
|
184
|
+
// --- Go/types shape evidence (R3) --------------------------------------
|
|
185
|
+
//
|
|
186
|
+
// `input.goShapes.structs` is already the "wanted" set — `goshapes/main.go`
|
|
187
|
+
// only ever records a struct a handler actually named as a request or
|
|
188
|
+
// response (`extractor.remember`, mirrored precision-over-recall stance to
|
|
189
|
+
// `adapter-python`'s DTO promotion never emitting an unreferenced class).
|
|
190
|
+
// Keyed by `${importPath}::${typeName}`, matching this file's own
|
|
191
|
+
// `${namespace}::${type.name}` key everywhere else a Go type is looked up.
|
|
192
|
+
const goStructsReady = input.reached >= 3 && input.goShapes !== undefined;
|
|
193
|
+
const goStructByKey = new Map();
|
|
194
|
+
if (goStructsReady) {
|
|
195
|
+
for (const s of input.goShapes.structs)
|
|
196
|
+
goStructByKey.set(`${s.importPath}::${s.name}`, s);
|
|
197
|
+
}
|
|
198
|
+
/** Populated only as each DTO node is actually minted below — the one
|
|
199
|
+
* source of truth for "does this id exist in `nodes`", so the handler ->
|
|
200
|
+
* DTO pass a bit further down can never point `USES_TYPE` at a node this
|
|
201
|
+
* run did not emit (a dangling edge is exactly the wrong-edge corruption
|
|
202
|
+
* rule 2 exists to prevent). */
|
|
203
|
+
const dtoIdByKey = new Map();
|
|
103
204
|
/**
|
|
104
205
|
* A boundary row, with the package behind it named when the file's own
|
|
105
206
|
* `import` block settles which one it is.
|
|
@@ -243,10 +344,19 @@ export function extract(input) {
|
|
|
243
344
|
});
|
|
244
345
|
for (const type of unit.types) {
|
|
245
346
|
// MODEL is a framework claim and the only evidence for it is a `gorm`
|
|
246
|
-
// struct tag — see `gorm.ts`.
|
|
247
|
-
//
|
|
347
|
+
// struct tag — see `gorm.ts`. DTO is the same kind of promotion, on
|
|
348
|
+
// go/types evidence instead: a struct is a DTO here iff the Go helper
|
|
349
|
+
// itself named it as some handler's decoded/encoded shape — never
|
|
350
|
+
// guessed from the struct's own name or fields. MODEL wins where both
|
|
351
|
+
// somehow apply (a type that is both persisted and decoded at a
|
|
352
|
+
// boundary is primarily the table, mirroring `adapter-python`'s own
|
|
353
|
+
// tie-break — a wrong `MODEL` claims a database, a wrong `DTO` claims a
|
|
354
|
+
// wire format). The node type is part of the hash (DEC-004), so it has
|
|
355
|
+
// to be decided before the id is minted.
|
|
248
356
|
const isModel = isGormModel(type);
|
|
249
|
-
const
|
|
357
|
+
const goShape = !isModel ? goStructByKey.get(`${namespace}::${type.name}`) : undefined;
|
|
358
|
+
const isDto = goShape !== undefined;
|
|
359
|
+
const id = nodeId(scope, isModel ? "MODEL" : isDto ? "DTO" : "CLASS", symbolQsp(namespace, [type.name]), LANGUAGE);
|
|
250
360
|
// Legal when behind mutually exclusive build constraints (`gin`'s `Binding`) — one node, alternatives disclosed.
|
|
251
361
|
const existing = pkg.types.get(type.name);
|
|
252
362
|
if (existing !== undefined) {
|
|
@@ -254,7 +364,32 @@ export function extract(input) {
|
|
|
254
364
|
continue;
|
|
255
365
|
}
|
|
256
366
|
pkg.types.set(type.name, { id, type, unit, isModel });
|
|
367
|
+
if (isDto)
|
|
368
|
+
dtoIdByKey.set(`${namespace}::${type.name}`, id);
|
|
257
369
|
const ormAttrs = {};
|
|
370
|
+
const dtoAttrs = {};
|
|
371
|
+
if (isDto && goShape !== undefined) {
|
|
372
|
+
// **R3, unconditionally** — `goStructsReady` already gated whether
|
|
373
|
+
// `goShape` could exist at all (`input.reached >= 3`), so every DTO
|
|
374
|
+
// this branch reaches is real go/types evidence, never a hint the
|
|
375
|
+
// run has to wait on the way `adapter-python`'s annotation-derived
|
|
376
|
+
// DTO does (DEC-062's tradeoff does not apply here: this shape was
|
|
377
|
+
// CHECKED, not merely written down).
|
|
378
|
+
//
|
|
379
|
+
// `fields` is names and `fieldDetail` is shapes — `adapter-openapi`'s
|
|
380
|
+
// convention, matched rather than reinvented (golden 05 compares a
|
|
381
|
+
// list of names; two producers describing the same construct two
|
|
382
|
+
// ways is the defect DEC-115 exists to prevent for endpoints).
|
|
383
|
+
dtoAttrs["schema"] = "go-types";
|
|
384
|
+
dtoAttrs["fields"] = goShape.fields.filter((f) => f.skip !== true).map((f) => f.name);
|
|
385
|
+
dtoAttrs["fieldDetail"] = goShape.fields.map((f) => ({
|
|
386
|
+
name: f.name,
|
|
387
|
+
type: f.type,
|
|
388
|
+
...(f.jsonName === undefined ? {} : { jsonName: f.jsonName }),
|
|
389
|
+
...(f.embedded === true ? { embedded: true } : {}),
|
|
390
|
+
...(f.skip === true ? { skip: true } : {}),
|
|
391
|
+
}));
|
|
392
|
+
}
|
|
258
393
|
if (isModel) {
|
|
259
394
|
const shape = gormShapeOf(type, methodsByType.get(`${namespace}::${type.name}`) ?? []);
|
|
260
395
|
ormAttrs["orm"] = "gorm";
|
|
@@ -277,14 +412,14 @@ export function extract(input) {
|
|
|
277
412
|
}
|
|
278
413
|
nodes.push({
|
|
279
414
|
id,
|
|
280
|
-
type: isModel ? "MODEL" : "CLASS",
|
|
415
|
+
type: isModel ? "MODEL" : isDto ? "DTO" : "CLASS",
|
|
281
416
|
name: type.name,
|
|
282
417
|
file: unit.file,
|
|
283
418
|
range: { startLine: type.startLine, endLine: type.endLine },
|
|
284
419
|
language: LANGUAGE,
|
|
285
420
|
producedBy: input.producedBy,
|
|
286
421
|
resolution: 0,
|
|
287
|
-
attrs: { declarationForm: type.form, ...ormAttrs },
|
|
422
|
+
attrs: { declarationForm: type.form, ...ormAttrs, ...dtoAttrs },
|
|
288
423
|
});
|
|
289
424
|
}
|
|
290
425
|
for (const fn of unit.funcs) {
|
|
@@ -331,6 +466,53 @@ export function extract(input) {
|
|
|
331
466
|
}
|
|
332
467
|
}
|
|
333
468
|
}
|
|
469
|
+
// --- USES_TYPE, handler -> its go/types-confirmed request/response DTO ---
|
|
470
|
+
//
|
|
471
|
+
// **R3, and the reason it can be:** unlike a route's own written contract
|
|
472
|
+
// (a Python `response_model=`, a Java annotation), nothing at a Go
|
|
473
|
+
// registration site names which struct a handler decodes or encodes —
|
|
474
|
+
// that fact lives inside the function body, in a `Decode`/`Bind`/`JSON`
|
|
475
|
+
// call, and finding it needs data flow through a type checker, not a name
|
|
476
|
+
// to resolve. That is a stronger claim than R2's reference resolution, and
|
|
477
|
+
// it is exactly what `goShapes` supplies.
|
|
478
|
+
//
|
|
479
|
+
// Correlated by `${importPath}::${receiver}.${funcName}` against `packages`'
|
|
480
|
+
// own `funcs` map — the SAME map `route.handlerRaw` resolution already
|
|
481
|
+
// trusts a few hundred lines up — and by `dtoIdByKey` for the DTO side, so
|
|
482
|
+
// an edge is only ever pushed at an id this run actually minted a node
|
|
483
|
+
// for. Anything that fails to correlate (the go/types pass named a
|
|
484
|
+
// package or struct this run's own tree-sitter pass never read, or the
|
|
485
|
+
// struct lived under a namespace the two readers computed differently)
|
|
486
|
+
// is silently not an edge — a disclosed recall gap between two readers of
|
|
487
|
+
// the same repository, never a guess at which node was meant.
|
|
488
|
+
if (goStructsReady) {
|
|
489
|
+
for (const found of input.goShapes.handlers) {
|
|
490
|
+
const pkg = packages.get(found.importPath);
|
|
491
|
+
if (pkg === undefined)
|
|
492
|
+
continue;
|
|
493
|
+
const key = found.receiver === undefined ? found.funcName : `${found.receiver}.${found.funcName}`;
|
|
494
|
+
const fn = pkg.funcs.get(key);
|
|
495
|
+
if (fn === undefined)
|
|
496
|
+
continue;
|
|
497
|
+
const rolesByDto = new Map();
|
|
498
|
+
const addRole = (ref, role) => {
|
|
499
|
+
if (ref === undefined)
|
|
500
|
+
return;
|
|
501
|
+
const dtoId = dtoIdByKey.get(`${ref.importPath}::${ref.name}`);
|
|
502
|
+
if (dtoId === undefined)
|
|
503
|
+
return;
|
|
504
|
+
const roles = rolesByDto.get(dtoId) ?? [];
|
|
505
|
+
if (!roles.includes(role))
|
|
506
|
+
roles.push(role);
|
|
507
|
+
rolesByDto.set(dtoId, roles);
|
|
508
|
+
};
|
|
509
|
+
addRole(found.request, "request");
|
|
510
|
+
addRole(found.response, "response");
|
|
511
|
+
for (const [dtoId, roles] of rolesByDto) {
|
|
512
|
+
push({ from: fn.id, to: dtoId, type: "USES_TYPE", attrs: { roles } }, 3);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
334
516
|
/** A written type name, split into its package qualifier and its own name. */
|
|
335
517
|
const split = (written) => {
|
|
336
518
|
const cut = written.indexOf(".");
|
|
@@ -972,6 +1154,52 @@ export function extract(input) {
|
|
|
972
1154
|
}
|
|
973
1155
|
}
|
|
974
1156
|
}
|
|
1157
|
+
/** The Go function whose body contains this line, innermost first — a registration inside a closure resolves against the closure's own locals, not its enclosing function's. */
|
|
1158
|
+
const enclosingFunc = (unit, line) => {
|
|
1159
|
+
let found;
|
|
1160
|
+
for (const fn of unit.funcs) {
|
|
1161
|
+
if (fn.startLine <= line && line <= fn.endLine) {
|
|
1162
|
+
if (found === undefined || fn.endLine - fn.startLine < found.endLine - found.startLine)
|
|
1163
|
+
found = fn;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
return found;
|
|
1167
|
+
};
|
|
1168
|
+
/**
|
|
1169
|
+
* `Register<Service>Server(server, impl)`'s `impl` argument, resolved to a
|
|
1170
|
+
* declared type the same way every other receiver in this file is: an
|
|
1171
|
+
* inline composite literal (`&orderServer{}`) names its type directly;
|
|
1172
|
+
* a bare name is looked up against its enclosing function's locals, a
|
|
1173
|
+
* pending call-result binding, then the package's own vars — the same
|
|
1174
|
+
* single-segment case `typeOfPath` already handles, read out here because
|
|
1175
|
+
* the registration site (`grpc.ts`) has no function scope of its own to
|
|
1176
|
+
* hand back.
|
|
1177
|
+
*
|
|
1178
|
+
* Never fails silently: every branch that cannot resolve returns a reason,
|
|
1179
|
+
* and the gRPC loop below discloses it once per route rather than dropping
|
|
1180
|
+
* the registration the way it silently did before (`DEC-NEXT-grpc-handler-
|
|
1181
|
+
* edge-silent-gap`).
|
|
1182
|
+
*/
|
|
1183
|
+
const resolveGrpcImplType = (unit, registration) => {
|
|
1184
|
+
const impl = registration.impl;
|
|
1185
|
+
if (impl === undefined)
|
|
1186
|
+
return { reason: REASONS.grpcImplUnreadable };
|
|
1187
|
+
if (impl.kind === "literal")
|
|
1188
|
+
return resolveType(unit, impl.typeWritten);
|
|
1189
|
+
const fn = enclosingFunc(unit, registration.line);
|
|
1190
|
+
const local = fn?.locals.get(impl.name);
|
|
1191
|
+
if (local !== undefined && local !== null)
|
|
1192
|
+
return resolveType(unit, local);
|
|
1193
|
+
if (fn !== undefined && fn.pending.has(impl.name)) {
|
|
1194
|
+
const fromCall = resultTypeOf(unit, fn, impl.name, 0);
|
|
1195
|
+
if (fromCall !== undefined)
|
|
1196
|
+
return fromCall;
|
|
1197
|
+
}
|
|
1198
|
+
const packageLevel = packageVarType(unit, impl.name);
|
|
1199
|
+
if (packageLevel !== undefined)
|
|
1200
|
+
return resolveType(unit, packageLevel);
|
|
1201
|
+
return { reason: REASONS.grpcImplUntyped };
|
|
1202
|
+
};
|
|
975
1203
|
// --- gRPC routes — see `grpc.ts`'s own header for the wire-path-is-read, not-
|
|
976
1204
|
// invented rationale and the `method: "RPC"` sentinel. Cross-file by nature:
|
|
977
1205
|
// a `_FullMethodName` const and the `Register<Service>Server(...)` call site
|
|
@@ -1008,6 +1236,9 @@ export function extract(input) {
|
|
|
1008
1236
|
const methods = targetNamespace === undefined ? undefined : grpcMethodsByNamespace.get(targetNamespace)?.get(registration.service);
|
|
1009
1237
|
if (methods === undefined || methods.length === 0)
|
|
1010
1238
|
continue;
|
|
1239
|
+
// Computed once per registration, not per method: every RPC this
|
|
1240
|
+
// registration serves is implemented by the SAME `impl` value.
|
|
1241
|
+
const implResolution = resolveGrpcImplType(unit, registration);
|
|
1011
1242
|
for (const method of methods) {
|
|
1012
1243
|
const template = normaliseEndpointPath(method.path);
|
|
1013
1244
|
const name = `RPC ${method.path}`;
|
|
@@ -1051,6 +1282,25 @@ export function extract(input) {
|
|
|
1051
1282
|
});
|
|
1052
1283
|
}
|
|
1053
1284
|
push({ from: routeId, to: endpointId, type: "SERVES_API" }, 2);
|
|
1285
|
+
// --- Which method implements it ------------------------------------
|
|
1286
|
+
//
|
|
1287
|
+
// Unlike an HTTP handler, a gRPC method is always named — the const
|
|
1288
|
+
// this route was minted from already names it. What was missing is
|
|
1289
|
+
// resolving `impl`'s type and finding that name on it. `SERVES_API`
|
|
1290
|
+
// stopping here and nothing else being said was the bug: every route
|
|
1291
|
+
// below gets either a CALLS edge or a disclosed reason, never neither.
|
|
1292
|
+
if ("declared" in implResolution) {
|
|
1293
|
+
const target = findMethod(implResolution.declared, method.method);
|
|
1294
|
+
if (target !== undefined) {
|
|
1295
|
+
push({ from: routeId, to: target.id, type: "CALLS" }, 2);
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
ledger(routeId, "CALLS", `${registration.service}.${method.method}`, unit, registration.line, REASONS.unmodelled);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
ledger(routeId, "CALLS", `${registration.service}.${method.method}`, unit, registration.line, implResolution.reason);
|
|
1303
|
+
}
|
|
1054
1304
|
}
|
|
1055
1305
|
}
|
|
1056
1306
|
}
|
|
@@ -1075,6 +1325,24 @@ export function extract(input) {
|
|
|
1075
1325
|
}
|
|
1076
1326
|
}
|
|
1077
1327
|
const withRoutes = [...disclosed, ...routeNodes.values(), ...endpointNodes.values()];
|
|
1328
|
+
// A caller that asked for R3 and did not get it hears why, the same way a
|
|
1329
|
+
// whole-run degradation does (`degradedGraph`, above) — just scoped to the
|
|
1330
|
+
// one capability that fell back, not the whole graph.
|
|
1331
|
+
if (input.goShapesUnavailableReason !== undefined) {
|
|
1332
|
+
const anchor = withRoutes[0];
|
|
1333
|
+
if (anchor !== undefined) {
|
|
1334
|
+
unresolved.push({
|
|
1335
|
+
fromNodeId: anchor.id,
|
|
1336
|
+
edgeType: "USES_TYPE",
|
|
1337
|
+
rawTarget: "(go/types shape extraction)",
|
|
1338
|
+
file: anchor.file,
|
|
1339
|
+
line: 1,
|
|
1340
|
+
producedBy: input.producedBy,
|
|
1341
|
+
reason: input.goShapesUnavailableReason,
|
|
1342
|
+
attrs: { refusalClass: "capability-gap" },
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1078
1346
|
return { nodes: withRoutes, edges, unresolved };
|
|
1079
1347
|
}
|
|
1080
1348
|
export { REASONS };
|