@colbymchenry/codegraph-win32-arm64 1.4.1 → 1.5.0
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/bin/codegraph.cmd +1 -1
- package/lib/dist/bin/codegraph.js +61 -15
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +41 -11
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/db/index.d.ts +142 -0
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +267 -6
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/queries.d.ts +74 -2
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +287 -20
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/sqlite-adapter.d.ts +3 -1
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/lib/dist/db/sqlite-adapter.js +22 -4
- package/lib/dist/db/sqlite-adapter.js.map +1 -1
- package/lib/dist/db/wal-valve.d.ts +15 -2
- package/lib/dist/db/wal-valve.d.ts.map +1 -1
- package/lib/dist/db/wal-valve.js +88 -6
- package/lib/dist/db/wal-valve.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +63 -0
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +32 -3
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +254 -61
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/kernel/decode.d.ts +9 -0
- package/lib/dist/extraction/kernel/decode.d.ts.map +1 -0
- package/lib/dist/extraction/kernel/decode.js +162 -0
- package/lib/dist/extraction/kernel/decode.js.map +1 -0
- package/lib/dist/extraction/kernel/index.d.ts +64 -0
- package/lib/dist/extraction/kernel/index.d.ts.map +1 -0
- package/lib/dist/extraction/kernel/index.js +279 -0
- package/lib/dist/extraction/kernel/index.js.map +1 -0
- package/lib/dist/extraction/kernel/layout.d.ts +101 -0
- package/lib/dist/extraction/kernel/layout.d.ts.map +1 -0
- package/lib/dist/extraction/kernel/layout.js +104 -0
- package/lib/dist/extraction/kernel/layout.js.map +1 -0
- package/lib/dist/extraction/kernel/loader.d.ts +103 -0
- package/lib/dist/extraction/kernel/loader.d.ts.map +1 -0
- package/lib/dist/extraction/kernel/loader.js +146 -0
- package/lib/dist/extraction/kernel/loader.js.map +1 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts +14 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +849 -12
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +8 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +15 -0
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +35 -1
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/store-worker.d.ts +24 -0
- package/lib/dist/extraction/store-worker.d.ts.map +1 -0
- package/lib/dist/extraction/store-worker.js +139 -0
- package/lib/dist/extraction/store-worker.js.map +1 -0
- package/lib/dist/extraction/store-writer.d.ts +63 -0
- package/lib/dist/extraction/store-writer.d.ts.map +1 -0
- package/lib/dist/extraction/store-writer.js +174 -0
- package/lib/dist/extraction/store-writer.js.map +1 -0
- package/lib/dist/extraction/tree-sitter.d.ts +22 -4
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +151 -6
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/lib/dist/extraction/wasm-runtime-flags.js +27 -3
- package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/lib/dist/index.d.ts +14 -2
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +188 -10
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/beta-signup.d.ts +54 -0
- package/lib/dist/installer/beta-signup.d.ts.map +1 -0
- package/lib/dist/installer/beta-signup.js +178 -0
- package/lib/dist/installer/beta-signup.js.map +1 -0
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +11 -0
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +27 -0
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +574 -132
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts +54 -10
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +249 -157
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cooperative-yield.d.ts +10 -2
- package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -1
- package/lib/dist/resolution/cooperative-yield.js +6 -4
- package/lib/dist/resolution/cooperative-yield.js.map +1 -1
- package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/go.js +29 -6
- package/lib/dist/resolution/frameworks/go.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +2 -3
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +166 -7
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +87 -2
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +716 -130
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/memory-budget.d.ts +48 -0
- package/lib/dist/resolution/memory-budget.d.ts.map +1 -0
- package/lib/dist/resolution/memory-budget.js +162 -0
- package/lib/dist/resolution/memory-budget.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +12 -1
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +387 -95
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/resolver-pool.d.ts +106 -0
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -0
- package/lib/dist/resolution/resolver-pool.js +344 -0
- package/lib/dist/resolution/resolver-pool.js.map +1 -0
- package/lib/dist/resolution/resolver-worker.d.ts +17 -0
- package/lib/dist/resolution/resolver-worker.d.ts.map +1 -0
- package/lib/dist/resolution/resolver-worker.js +141 -0
- package/lib/dist/resolution/resolver-worker.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +3 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/sync/watcher.d.ts +25 -1
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +76 -3
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/types.d.ts +41 -2
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +26 -1
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/ui/color.d.ts +21 -0
- package/lib/dist/ui/color.d.ts.map +1 -0
- package/lib/dist/ui/color.js +42 -0
- package/lib/dist/ui/color.js.map +1 -0
- package/lib/dist/ui/glyphs.d.ts +35 -10
- package/lib/dist/ui/glyphs.d.ts.map +1 -1
- package/lib/dist/ui/glyphs.js +59 -12
- package/lib/dist/ui/glyphs.js.map +1 -1
- package/lib/dist/ui/shimmer-progress.d.ts.map +1 -1
- package/lib/dist/ui/shimmer-progress.js +78 -4
- package/lib/dist/ui/shimmer-progress.js.map +1 -1
- package/lib/dist/ui/shimmer-worker.js +25 -17
- package/lib/dist/ui/shimmer-worker.js.map +1 -1
- package/lib/dist/ui/types.d.ts +0 -2
- package/lib/dist/ui/types.d.ts.map +1 -1
- package/lib/dist/upgrade/index.d.ts +7 -0
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +18 -5
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/kernel/codegraph-kernel.node +0 -0
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +6 -1
- package/package.json +6 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SYNTH_PROGRESS_STEPS = exports.SYNTH_PASSES = void 0;
|
|
3
4
|
exports.synthesizeCallbackEdges = synthesizeCallbackEdges;
|
|
4
5
|
const generated_detection_1 = require("../extraction/generated-detection");
|
|
5
6
|
const strip_comments_1 = require("./strip-comments");
|
|
@@ -411,9 +412,28 @@ async function reactRenderEdges(queries, ctx, onYield) {
|
|
|
411
412
|
let scanned255 = 0;
|
|
412
413
|
const edges = [];
|
|
413
414
|
const seen = new Set();
|
|
415
|
+
// A class can only emit here if it CONTAINS a method named `render` — so one
|
|
416
|
+
// indexed name lookup bounds the candidate set up front, and the class scan
|
|
417
|
+
// below skips everything else before its per-class edge/node queries. On a
|
|
418
|
+
// repo with few/no render methods (any non-React codebase) this collapses
|
|
419
|
+
// the pass from every-class fan-out to ~zero DB work, with identical output:
|
|
420
|
+
// the skipped classes fail the same `render` check today, just after paying
|
|
421
|
+
// for their children. (Not a language gate: `render` + `this.setState(` in
|
|
422
|
+
// Java — e.g. Litho — legitimately matches today and still does.)
|
|
423
|
+
const renderOwners = new Set();
|
|
424
|
+
for (const n of ctx.getNodesByName('render')) {
|
|
425
|
+
if (n.kind !== 'method')
|
|
426
|
+
continue;
|
|
427
|
+
for (const e of queries.getIncomingEdges(n.id, ['contains']))
|
|
428
|
+
renderOwners.add(e.source);
|
|
429
|
+
}
|
|
430
|
+
if (renderOwners.size === 0)
|
|
431
|
+
return edges;
|
|
414
432
|
for (const cls of queries.iterateNodesByKind('class')) {
|
|
415
433
|
if ((++scanned255 & 63) === 0)
|
|
416
434
|
await onYield();
|
|
435
|
+
if (!renderOwners.has(cls.id))
|
|
436
|
+
continue;
|
|
417
437
|
const children = queries.getOutgoingEdges(cls.id, ['contains'])
|
|
418
438
|
.map((e) => queries.getNodeById(e.target))
|
|
419
439
|
.filter((n) => !!n && n.kind === 'method');
|
|
@@ -1071,10 +1091,21 @@ async function interfaceOverrideEdges(queries, onYield) {
|
|
|
1071
1091
|
let scanned255 = 0;
|
|
1072
1092
|
const edges = [];
|
|
1073
1093
|
const seen = new Set();
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1094
|
+
// Memoized: a popular base interface's method list is otherwise re-fetched
|
|
1095
|
+
// once per implementer (dubbo-style hub interfaces have hundreds), and the
|
|
1096
|
+
// memo only ever serves reads. Same rows, same order — byte-identical.
|
|
1097
|
+
const methodsMemo = new Map();
|
|
1098
|
+
const methodsOf = (classId) => {
|
|
1099
|
+
const hit = methodsMemo.get(classId);
|
|
1100
|
+
if (hit)
|
|
1101
|
+
return hit;
|
|
1102
|
+
const methods = queries
|
|
1103
|
+
.getOutgoingEdges(classId, ['contains'])
|
|
1104
|
+
.map((e) => queries.getNodeById(e.target))
|
|
1105
|
+
.filter((n) => !!n && n.kind === 'method');
|
|
1106
|
+
methodsMemo.set(classId, methods);
|
|
1107
|
+
return methods;
|
|
1108
|
+
};
|
|
1078
1109
|
// Concrete-side kinds vary by language: `class` covers Java / Kotlin /
|
|
1079
1110
|
// C# / TS / Swift-classes / Scala-classes; `struct` covers Swift value
|
|
1080
1111
|
// types that conform to protocols. Iterate both.
|
|
@@ -1083,10 +1114,16 @@ async function interfaceOverrideEdges(queries, onYield) {
|
|
|
1083
1114
|
for (const cls of queries.iterateNodesByKind(kind)) {
|
|
1084
1115
|
if ((++scanned255 & 63) === 0)
|
|
1085
1116
|
await onYield();
|
|
1117
|
+
// A class can only emit here if it HAS a supertype edge — check that
|
|
1118
|
+
// (one edge query) before materializing its methods: most classes in a
|
|
1119
|
+
// typical graph extend/implement nothing and skip in one hop.
|
|
1120
|
+
const sups = queries.getOutgoingEdges(cls.id, ['implements', 'extends']);
|
|
1121
|
+
if (sups.length === 0)
|
|
1122
|
+
continue;
|
|
1086
1123
|
const implMethods = methodsOf(cls.id).filter((n) => IFACE_OVERRIDE_LANGS.has(n.language));
|
|
1087
1124
|
if (implMethods.length === 0)
|
|
1088
1125
|
continue;
|
|
1089
|
-
for (const sup of
|
|
1126
|
+
for (const sup of sups) {
|
|
1090
1127
|
const base = queries.getNodeById(sup.target);
|
|
1091
1128
|
if (!base || !IFACE_OVERRIDE_LANGS.has(base.language) || base.id === cls.id)
|
|
1092
1129
|
continue;
|
|
@@ -1876,6 +1913,20 @@ async function mybatisJavaXmlEdges(queries, onYield) {
|
|
|
1876
1913
|
let scanned255 = 0;
|
|
1877
1914
|
const edges = [];
|
|
1878
1915
|
const seen = new Set();
|
|
1916
|
+
// Collect the XML side FIRST (mapper `<select id=…>` statements extracted as
|
|
1917
|
+
// xml-language method nodes): if the project has none — every Java+XML repo
|
|
1918
|
+
// that doesn't use MyBatis — return before paying the full java-method
|
|
1919
|
+
// stream below. Same rowid stream order as matching inline, so the edge
|
|
1920
|
+
// output is byte-identical when mappers do exist.
|
|
1921
|
+
const xmlMethods = [];
|
|
1922
|
+
for (const m of queries.iterateNodesByKind('method')) {
|
|
1923
|
+
if ((++scanned255 & 63) === 0)
|
|
1924
|
+
await onYield();
|
|
1925
|
+
if (m.language === 'xml')
|
|
1926
|
+
xmlMethods.push(m);
|
|
1927
|
+
}
|
|
1928
|
+
if (xmlMethods.length === 0)
|
|
1929
|
+
return edges;
|
|
1879
1930
|
// Index Java methods by `<ClassName>::<methodName>` for O(1) lookup.
|
|
1880
1931
|
const javaIndex = new Map();
|
|
1881
1932
|
for (const m of queries.iterateNodesByKind('method')) {
|
|
@@ -1895,11 +1946,9 @@ async function mybatisJavaXmlEdges(queries, onYield) {
|
|
|
1895
1946
|
else
|
|
1896
1947
|
javaIndex.set(key, [m]);
|
|
1897
1948
|
}
|
|
1898
|
-
for (const xml of
|
|
1949
|
+
for (const xml of xmlMethods) {
|
|
1899
1950
|
if ((++scanned255 & 63) === 0)
|
|
1900
1951
|
await onYield();
|
|
1901
|
-
if (xml.language !== 'xml')
|
|
1902
|
-
continue;
|
|
1903
1952
|
// Qualified name: `<namespace>::<id>`. Extract the simple class name.
|
|
1904
1953
|
const colonIdx = xml.qualifiedName.lastIndexOf('::');
|
|
1905
1954
|
if (colonIdx < 0)
|
|
@@ -3715,7 +3764,96 @@ async function laravelEventEdges(ctx, onYield) {
|
|
|
3715
3764
|
* Sidekiq Worker.perform_async → #perform + Laravel event(new X) → listener handle).
|
|
3716
3765
|
* Returns the count added. Never throws into indexing — callers wrap in try/catch.
|
|
3717
3766
|
*/
|
|
3718
|
-
|
|
3767
|
+
/**
|
|
3768
|
+
* Number of progress steps synthesizeCallbackEdges reports: one per `__mark()`
|
|
3769
|
+
* call (every synthesis pass, plus the dedupe-merge and edge-insert steps).
|
|
3770
|
+
* Cosmetic only — drift just makes the progress bar end early or jump — and a
|
|
3771
|
+
* test pins it to the actual step count (registry passes + the fixed
|
|
3772
|
+
* pre/post marks) so adding a pass without bumping this fails loudly instead
|
|
3773
|
+
* of silently skewing the bar.
|
|
3774
|
+
*/
|
|
3775
|
+
const JS_FAMILY = ['typescript', 'javascript', 'tsx', 'jsx'];
|
|
3776
|
+
const ALWAYS = () => true;
|
|
3777
|
+
/**
|
|
3778
|
+
* The independent passes, in MERGE ORDER — the first-seen dedup in
|
|
3779
|
+
* synthesizeCallbackEdges follows this array, so reordering entries changes
|
|
3780
|
+
* which duplicate edge wins. The two Go pre-passes (cross-file method
|
|
3781
|
+
* `contains`, implicit `implements`) are NOT here: they persist before these
|
|
3782
|
+
* run because interfaceOverrideEdges reads their edges from the DB.
|
|
3783
|
+
*/
|
|
3784
|
+
exports.SYNTH_PASSES = [
|
|
3785
|
+
{ name: 'fieldEdges', gate: ALWAYS, run: (q, c, y) => fieldChannelEdges(q, c, y) },
|
|
3786
|
+
{ name: 'closureCollEdges', gate: ALWAYS, run: (q, c, y) => closureCollectionEdges(q, c, y) },
|
|
3787
|
+
{ name: 'emitterEdges', gate: ALWAYS, run: (_q, c, y) => eventEmitterEdges(c, y) },
|
|
3788
|
+
{ name: 'renderEdges', gate: ALWAYS, run: (q, c, y) => reactRenderEdges(q, c, y) },
|
|
3789
|
+
{ name: 'jsxEdges', gate: ALWAYS, run: (_q, c, y) => reactJsxChildEdges(c, y) },
|
|
3790
|
+
{ name: 'vueEdges', gate: (has) => has('vue'), run: (_q, c, y) => vueTemplateEdges(c, y) },
|
|
3791
|
+
{ name: 'svelteKitEdges', gate: (has) => has('svelte'), run: (_q, c, y) => svelteKitLoadEdges(c, y) },
|
|
3792
|
+
{ name: 'pascalEdges', gate: ALWAYS, run: (_q, c, y) => pascalFormEdges(c, y) },
|
|
3793
|
+
{ name: 'flutterEdges', gate: (has) => has('dart'), run: (q, c, y) => flutterBuildEdges(q, c, y) },
|
|
3794
|
+
{ name: 'arkuiStateEdges', gate: (has) => has('arkts'), run: (q, c, y) => arkuiStateBuildEdges(q, c, y) },
|
|
3795
|
+
{ name: 'arkuiEmitter', gate: (has) => has('arkts'), run: (_q, c, y) => arkuiEmitterEdges(c, y) },
|
|
3796
|
+
{ name: 'arkuiRoutes', gate: (has) => has('arkts'), run: (_q, c, y) => arkuiRouterEdges(c, y) },
|
|
3797
|
+
{ name: 'cppEdges', gate: (has) => has('cpp'), run: (q, _c, y) => cppOverrideEdges(q, y) },
|
|
3798
|
+
{
|
|
3799
|
+
name: 'ifaceEdges',
|
|
3800
|
+
gate: (has) => has('java', 'kotlin', 'csharp', 'swift', 'scala', 'go', 'rust', 'arkts', ...JS_FAMILY),
|
|
3801
|
+
run: (q, _c, y) => interfaceOverrideEdges(q, y),
|
|
3802
|
+
},
|
|
3803
|
+
{ name: 'kotlinExpectActual', gate: (has) => has('kotlin'), run: (q, _c, y) => kotlinExpectActualEdges(q, y) },
|
|
3804
|
+
{ name: 'goGrpcEdges', gate: (has) => has('go'), run: (q, _c, y) => goGrpcStubImplEdges(q, y) },
|
|
3805
|
+
{ name: 'rnEventEdgesList', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => rnEventEdges(c, y) },
|
|
3806
|
+
{ name: 'fabricNativeEdges', gate: ALWAYS, run: (_q, c, y) => fabricNativeImplEdges(c, y) },
|
|
3807
|
+
// Expo module nodes (`expo-module:` ids) are emitted only from .swift/.kt
|
|
3808
|
+
// files, and a pair needs BOTH platforms — so without both languages the
|
|
3809
|
+
// pass's only collection loop is provably empty (it was streaming every
|
|
3810
|
+
// method row on pure-Java repos to find nothing).
|
|
3811
|
+
{ name: 'expoXPlatEdges', gate: (has) => has('swift') && has('kotlin'), run: (q, _c, y) => expoCrossPlatformEdges(q, y) },
|
|
3812
|
+
// An RN cross-platform edge requires a JS-language caller on the native
|
|
3813
|
+
// method (`isBridge`) — no JS-family files means no JS-language nodes, so
|
|
3814
|
+
// the result is provably empty.
|
|
3815
|
+
{ name: 'rnXPlatEdges', gate: (has) => has(...JS_FAMILY), run: (q, _c, y) => rnCrossPlatformEdges(q, y) },
|
|
3816
|
+
{
|
|
3817
|
+
name: 'mybatisEdges',
|
|
3818
|
+
gate: (has) => has('java', 'kotlin') && has('xml'),
|
|
3819
|
+
run: (q, _c, y) => mybatisJavaXmlEdges(q, y),
|
|
3820
|
+
},
|
|
3821
|
+
{ name: 'ginEdges', gate: (has) => has('go'), run: (q, c, y) => ginMiddlewareChainEdges(q, c, y) },
|
|
3822
|
+
{ name: 'thunkEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => reduxThunkEdges(q, c, y) },
|
|
3823
|
+
{ name: 'registryEdges', gate: ALWAYS, run: (_q, c, y) => objectRegistryEdges(c, y) },
|
|
3824
|
+
{ name: 'rtkEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => rtkQueryEdges(q, c, y) },
|
|
3825
|
+
{ name: 'piniaEdges', gate: (has) => has('vue', ...JS_FAMILY), run: (_q, c, y) => piniaStoreEdges(c, y) },
|
|
3826
|
+
{ name: 'vuexEdges', gate: (has) => has('vue', ...JS_FAMILY), run: (_q, c, y) => vuexDispatchEdges(c, y) },
|
|
3827
|
+
{ name: 'celeryEdges', gate: (has) => has('python'), run: (_q, c, y) => celeryDispatchEdges(c, y) },
|
|
3828
|
+
{ name: 'springEdges', gate: (has) => has('java'), run: (_q, c, y) => springEventEdges(c, y) },
|
|
3829
|
+
{ name: 'mediatrEdges', gate: (has) => has('csharp'), run: (_q, c, y) => mediatrDispatchEdges(c, y) },
|
|
3830
|
+
{ name: 'sidekiqEdges', gate: (has) => has('ruby'), run: (_q, c, y) => sidekiqDispatchEdges(c, y) },
|
|
3831
|
+
{
|
|
3832
|
+
name: 'erlangBehaviourEdges',
|
|
3833
|
+
gate: (has) => has('erlang'),
|
|
3834
|
+
run: (q, c, y) => erlangBehaviourDispatchEdges(q, c, y),
|
|
3835
|
+
},
|
|
3836
|
+
{ name: 'laravelEdges', gate: (has) => has('php'), run: (_q, c, y) => laravelEventEdges(c, y) },
|
|
3837
|
+
{
|
|
3838
|
+
name: 'cFnPtrEdges',
|
|
3839
|
+
gate: (has) => has('c', 'cpp'),
|
|
3840
|
+
run: (q, c, y, sub) => (0, c_fnptr_synthesizer_1.cFnPointerDispatchEdges)(q, c, y, sub),
|
|
3841
|
+
},
|
|
3842
|
+
{ name: 'goframeEdges', gate: (has) => has('go'), run: (_q, c, y) => (0, goframe_synthesizer_1.goframeRouteEdges)(c, y) },
|
|
3843
|
+
{ name: 'nixOptionEdges', gate: (has) => has('nix'), run: (q, _c, y) => nixOptionPathEdges(q, y) },
|
|
3844
|
+
];
|
|
3845
|
+
/** Fixed non-registry steps: goMethodContains, goImplements, dedupe-merge, insertMergedEdges. */
|
|
3846
|
+
const FIXED_SYNTH_STEPS = 4;
|
|
3847
|
+
exports.SYNTH_PROGRESS_STEPS = exports.SYNTH_PASSES.length + FIXED_SYNTH_STEPS;
|
|
3848
|
+
async function synthesizeCallbackEdges(queries, ctx, onProgress,
|
|
3849
|
+
// A live resolver pool to fan the independent passes across (structural type
|
|
3850
|
+
// so this file never imports the pool — resolver-worker imports THIS file).
|
|
3851
|
+
// Null/omitted → the sequential path, byte-identical to the pool path.
|
|
3852
|
+
pool,
|
|
3853
|
+
// WAL-valve writer backstop (WalCheckpointValve.backpressure), called at
|
|
3854
|
+
// pool-idle points in the edge-insert loops below — the passes themselves
|
|
3855
|
+
// only read; every write in this function happens with the pool idle.
|
|
3856
|
+
backpressure) {
|
|
3719
3857
|
// Each sub-pass below is a whole-graph scan, and there are ~30 of them, all
|
|
3720
3858
|
// running synchronously on the indexer's main thread. Their AGGREGATE can run
|
|
3721
3859
|
// for well over a minute on a large repo — long enough for the #850 liveness
|
|
@@ -3724,6 +3862,30 @@ async function synthesizeCallbackEdges(queries, ctx) {
|
|
|
3724
3862
|
// that itself hangs (a real wedge) never reaches the next yield, so the
|
|
3725
3863
|
// watchdog still catches that. See ./cooperative-yield.
|
|
3726
3864
|
const yieldToLoop = (0, cooperative_yield_1.createYielder)();
|
|
3865
|
+
// Synthesis runs AFTER the resolution progress bar reaches 100%, so without
|
|
3866
|
+
// its own progress the UI freezes at "Resolving refs 100%" for the whole
|
|
3867
|
+
// tail — long enough on big repos that users conclude the index hung and
|
|
3868
|
+
// kill it. Report each completed pass; the caller surfaces it as its own
|
|
3869
|
+
// progress phase. Emit 0/total up front so the phase flips immediately.
|
|
3870
|
+
// Emissions are throttled to whole-percent movement (each consumes a UI
|
|
3871
|
+
// message); values may be fractional steps from within-pass reporting.
|
|
3872
|
+
let passesDone = 0;
|
|
3873
|
+
let lastPct = -1;
|
|
3874
|
+
const emit = (value) => {
|
|
3875
|
+
if (!onProgress)
|
|
3876
|
+
return;
|
|
3877
|
+
const v = Math.min(value, exports.SYNTH_PROGRESS_STEPS);
|
|
3878
|
+
const pct = Math.floor((v / exports.SYNTH_PROGRESS_STEPS) * 100);
|
|
3879
|
+
if (pct === lastPct)
|
|
3880
|
+
return;
|
|
3881
|
+
lastPct = pct;
|
|
3882
|
+
onProgress(v, exports.SYNTH_PROGRESS_STEPS);
|
|
3883
|
+
};
|
|
3884
|
+
// A single long pass otherwise parks the bar between steps; a pass that
|
|
3885
|
+
// takes this callback reports a 0..1 fraction of its own work, surfaced
|
|
3886
|
+
// here as fractional progress within its step.
|
|
3887
|
+
const subProgress = (fraction) => emit(passesDone + Math.max(0, Math.min(fraction, 1)));
|
|
3888
|
+
emit(0);
|
|
3727
3889
|
// Per-pass wall-clock timing to stderr, opt-in via CODEGRAPH_SYNTH_TIMINGS
|
|
3728
3890
|
// (=1: passes over 250ms; =all: every pass). This is the diagnostic that
|
|
3729
3891
|
// located both the #1091/#1122 watchdog stalls and the #1212 OOM — keep it.
|
|
@@ -3735,6 +3897,8 @@ async function synthesizeCallbackEdges(queries, ctx) {
|
|
|
3735
3897
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS && (dt > 250 || process.env.CODEGRAPH_SYNTH_TIMINGS === 'all')) {
|
|
3736
3898
|
console.error(`[synth-timing] ${label}: ${dt}ms`);
|
|
3737
3899
|
}
|
|
3900
|
+
passesDone++;
|
|
3901
|
+
emit(passesDone);
|
|
3738
3902
|
};
|
|
3739
3903
|
// Language gating: one indexed DISTINCT over the files table lets a pass
|
|
3740
3904
|
// whose own filters reference a specific language/extension be skipped
|
|
@@ -3744,17 +3908,24 @@ async function synthesizeCallbackEdges(queries, ctx) {
|
|
|
3744
3908
|
// Passes without an explicit language filter always run.
|
|
3745
3909
|
const langs = queries.getDistinctFileLanguages();
|
|
3746
3910
|
const has = (...ls) => ls.some((l) => langs.has(l));
|
|
3747
|
-
const JS_FAMILY = ['typescript', 'javascript', 'tsx', 'jsx'];
|
|
3748
3911
|
const NONE = [];
|
|
3749
3912
|
// Cross-file Go method→type `contains` edges must be synthesized AND persisted
|
|
3750
3913
|
// FIRST: a method declared in a different file from its receiver type is
|
|
3751
3914
|
// otherwise orphaned from the struct, and goImplementsEdges (next) derives a
|
|
3752
3915
|
// struct's method set from its `contains` edges — so without this it would
|
|
3753
3916
|
// under-count the interfaces a cross-file struct satisfies. (#583)
|
|
3917
|
+
// Writer-side WAL backstop for the insert loops here (see the param doc):
|
|
3918
|
+
// one fstat when under the valve's hard cap, a parked full backfill past it.
|
|
3919
|
+
const foldIfOver = async () => {
|
|
3920
|
+
const bp = backpressure?.();
|
|
3921
|
+
if (bp)
|
|
3922
|
+
await bp;
|
|
3923
|
+
};
|
|
3754
3924
|
const goMethodContains = has('go') ? await goCrossFileMethodContainsEdges(queries, yieldToLoop) : NONE;
|
|
3755
3925
|
for (let i = 0; i < goMethodContains.length; i += 2000) {
|
|
3756
3926
|
queries.insertEdges(goMethodContains.slice(i, i + 2000));
|
|
3757
3927
|
await yieldToLoop();
|
|
3928
|
+
await foldIfOver();
|
|
3758
3929
|
}
|
|
3759
3930
|
await yieldToLoop();
|
|
3760
3931
|
__mark('goMethodContains');
|
|
@@ -3766,158 +3937,78 @@ async function synthesizeCallbackEdges(queries, ctx) {
|
|
|
3766
3937
|
for (let i = 0; i < goImpl.length; i += 2000) {
|
|
3767
3938
|
queries.insertEdges(goImpl.slice(i, i + 2000));
|
|
3768
3939
|
await yieldToLoop();
|
|
3940
|
+
await foldIfOver();
|
|
3769
3941
|
}
|
|
3770
3942
|
await yieldToLoop();
|
|
3771
3943
|
__mark('goImplements');
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
const
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
const
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
await yieldToLoop();
|
|
3838
|
-
__mark('ginEdges');
|
|
3839
|
-
const thunkEdges = has(...JS_FAMILY) ? await reduxThunkEdges(queries, ctx, yieldToLoop) : NONE;
|
|
3840
|
-
await yieldToLoop();
|
|
3841
|
-
__mark('thunkEdges');
|
|
3842
|
-
const registryEdges = await objectRegistryEdges(ctx, yieldToLoop);
|
|
3843
|
-
await yieldToLoop();
|
|
3844
|
-
__mark('registryEdges');
|
|
3845
|
-
const rtkEdges = has(...JS_FAMILY) ? await rtkQueryEdges(queries, ctx, yieldToLoop) : NONE;
|
|
3846
|
-
await yieldToLoop();
|
|
3847
|
-
__mark('rtkEdges');
|
|
3848
|
-
const piniaEdges = has('vue', ...JS_FAMILY) ? await piniaStoreEdges(ctx, yieldToLoop) : NONE;
|
|
3849
|
-
await yieldToLoop();
|
|
3850
|
-
__mark('piniaEdges');
|
|
3851
|
-
const vuexEdges = has('vue', ...JS_FAMILY) ? await vuexDispatchEdges(ctx, yieldToLoop) : NONE;
|
|
3852
|
-
await yieldToLoop();
|
|
3853
|
-
__mark('vuexEdges');
|
|
3854
|
-
const celeryEdges = has('python') ? await celeryDispatchEdges(ctx, yieldToLoop) : NONE;
|
|
3855
|
-
await yieldToLoop();
|
|
3856
|
-
__mark('celeryEdges');
|
|
3857
|
-
const springEdges = has('java') ? await springEventEdges(ctx, yieldToLoop) : NONE;
|
|
3858
|
-
await yieldToLoop();
|
|
3859
|
-
__mark('springEdges');
|
|
3860
|
-
const mediatrEdges = has('csharp') ? await mediatrDispatchEdges(ctx, yieldToLoop) : NONE;
|
|
3861
|
-
await yieldToLoop();
|
|
3862
|
-
__mark('mediatrEdges');
|
|
3863
|
-
const sidekiqEdges = has('ruby') ? await sidekiqDispatchEdges(ctx, yieldToLoop) : NONE;
|
|
3864
|
-
await yieldToLoop();
|
|
3865
|
-
__mark('sidekiqEdges');
|
|
3866
|
-
const erlangBehaviourEdges = has('erlang') ? await erlangBehaviourDispatchEdges(queries, ctx, yieldToLoop) : NONE;
|
|
3867
|
-
await yieldToLoop();
|
|
3868
|
-
__mark('erlangBehaviourEdges');
|
|
3869
|
-
const laravelEdges = has('php') ? await laravelEventEdges(ctx, yieldToLoop) : NONE;
|
|
3870
|
-
await yieldToLoop();
|
|
3871
|
-
__mark('laravelEdges');
|
|
3872
|
-
const cFnPtrEdges = has('c', 'cpp') ? await (0, c_fnptr_synthesizer_1.cFnPointerDispatchEdges)(queries, ctx, yieldToLoop) : NONE;
|
|
3873
|
-
await yieldToLoop();
|
|
3874
|
-
__mark('cFnPtrEdges');
|
|
3875
|
-
const goframeEdges = has('go') ? await (0, goframe_synthesizer_1.goframeRouteEdges)(ctx, yieldToLoop) : NONE;
|
|
3876
|
-
await yieldToLoop();
|
|
3877
|
-
__mark('goframeEdges');
|
|
3878
|
-
const nixOptionEdges = has('nix') ? await nixOptionPathEdges(queries, yieldToLoop) : NONE;
|
|
3879
|
-
await yieldToLoop();
|
|
3880
|
-
__mark('nixOptionEdges');
|
|
3944
|
+
// Run the independent passes (see SYNTH_PASSES). Their results are merged in
|
|
3945
|
+
// REGISTRY ORDER below regardless of execution order, and none of their edges
|
|
3946
|
+
// persist until that merge — so every pass sees the same committed
|
|
3947
|
+
// post-resolution DB state whether it runs sequentially here or on a resolver
|
|
3948
|
+
// pool worker. With a live pool (already booted on ≥150k-ref repos), passes
|
|
3949
|
+
// fan out across its read-only workers and the per-pass wall-clock comes from
|
|
3950
|
+
// the worker; a pass that fails on a worker falls back to running on the main
|
|
3951
|
+
// thread, so a worker crash isolates to a retry instead of failing synthesis.
|
|
3952
|
+
const passEdges = new Array(exports.SYNTH_PASSES.length).fill(NONE);
|
|
3953
|
+
const markPass = (label, dt) => {
|
|
3954
|
+
if (process.env.CODEGRAPH_SYNTH_TIMINGS && (dt > 250 || process.env.CODEGRAPH_SYNTH_TIMINGS === 'all')) {
|
|
3955
|
+
console.error(`[synth-timing] ${label}: ${dt}ms`);
|
|
3956
|
+
}
|
|
3957
|
+
passesDone++;
|
|
3958
|
+
emit(passesDone);
|
|
3959
|
+
};
|
|
3960
|
+
const runPassOnMain = async (i) => {
|
|
3961
|
+
const pass = exports.SYNTH_PASSES[i];
|
|
3962
|
+
const t0 = Date.now();
|
|
3963
|
+
passEdges[i] = await pass.run(queries, ctx, yieldToLoop, subProgress);
|
|
3964
|
+
await yieldToLoop();
|
|
3965
|
+
markPass(pass.name, Date.now() - t0);
|
|
3966
|
+
};
|
|
3967
|
+
const gatedIn = [];
|
|
3968
|
+
for (let i = 0; i < exports.SYNTH_PASSES.length; i++) {
|
|
3969
|
+
if (exports.SYNTH_PASSES[i].gate(has))
|
|
3970
|
+
gatedIn.push(i);
|
|
3971
|
+
else
|
|
3972
|
+
markPass(exports.SYNTH_PASSES[i].name, 0);
|
|
3973
|
+
}
|
|
3974
|
+
// Above this node count, a pass that OOM-killed its worker must NOT be
|
|
3975
|
+
// retried on the main thread — the retry would OOM the whole process and
|
|
3976
|
+
// take the index with it (the #1212 failure class). Below it, a worker
|
|
3977
|
+
// failure is more likely a transient crash than a memory ceiling, and the
|
|
3978
|
+
// main-thread retry keeps coverage. Skipping loses only that pass's
|
|
3979
|
+
// synthesized edges; the index still completes.
|
|
3980
|
+
const MAIN_RETRY_MAX_NODES = 1_500_000;
|
|
3981
|
+
const graphNodes = queries.getNodeAndEdgeCount().nodes;
|
|
3982
|
+
if (pool && gatedIn.length > 1) {
|
|
3983
|
+
await Promise.all(gatedIn.map(async (i) => {
|
|
3984
|
+
const pass = exports.SYNTH_PASSES[i];
|
|
3985
|
+
try {
|
|
3986
|
+
const out = await pool.runSynthPass(pass.name);
|
|
3987
|
+
passEdges[i] = out.edges;
|
|
3988
|
+
markPass(pass.name, out.ms);
|
|
3989
|
+
}
|
|
3990
|
+
catch (err) {
|
|
3991
|
+
if (graphNodes > MAIN_RETRY_MAX_NODES) {
|
|
3992
|
+
// Worker died at a scale where the main-thread retry is a process
|
|
3993
|
+
// OOM risk: skip the pass, keep the index alive, and say so.
|
|
3994
|
+
console.error(`[synthesis] pass '${pass.name}' failed on a worker at ${graphNodes} nodes — skipped (edges from this pass are absent): ${err instanceof Error ? err.message : String(err)}`);
|
|
3995
|
+
markPass(`${pass.name} (skipped at scale)`, 0);
|
|
3996
|
+
return;
|
|
3997
|
+
}
|
|
3998
|
+
// Worker-side failure (crash, OOM, unknown pass after a version
|
|
3999
|
+
// mismatch): retry this one pass on the main thread.
|
|
4000
|
+
await runPassOnMain(i);
|
|
4001
|
+
}
|
|
4002
|
+
}));
|
|
4003
|
+
}
|
|
4004
|
+
else {
|
|
4005
|
+
for (const i of gatedIn) {
|
|
4006
|
+
await runPassOnMain(i);
|
|
4007
|
+
}
|
|
4008
|
+
}
|
|
3881
4009
|
const merged = [];
|
|
3882
4010
|
const seen = new Set();
|
|
3883
|
-
for (const e of
|
|
3884
|
-
...fieldEdges,
|
|
3885
|
-
...closureCollEdges,
|
|
3886
|
-
...emitterEdges,
|
|
3887
|
-
...renderEdges,
|
|
3888
|
-
...jsxEdges,
|
|
3889
|
-
...vueEdges,
|
|
3890
|
-
...svelteKitEdges,
|
|
3891
|
-
...pascalEdges,
|
|
3892
|
-
...flutterEdges,
|
|
3893
|
-
...arkuiStateEdges,
|
|
3894
|
-
...arkuiEmitter,
|
|
3895
|
-
...arkuiRoutes,
|
|
3896
|
-
...cppEdges,
|
|
3897
|
-
...ifaceEdges,
|
|
3898
|
-
...kotlinExpectActual,
|
|
3899
|
-
...goGrpcEdges,
|
|
3900
|
-
...rnEventEdgesList,
|
|
3901
|
-
...fabricNativeEdges,
|
|
3902
|
-
...expoXPlatEdges,
|
|
3903
|
-
...rnXPlatEdges,
|
|
3904
|
-
...mybatisEdges,
|
|
3905
|
-
...ginEdges,
|
|
3906
|
-
...thunkEdges,
|
|
3907
|
-
...registryEdges,
|
|
3908
|
-
...rtkEdges,
|
|
3909
|
-
...piniaEdges,
|
|
3910
|
-
...vuexEdges,
|
|
3911
|
-
...celeryEdges,
|
|
3912
|
-
...springEdges,
|
|
3913
|
-
...mediatrEdges,
|
|
3914
|
-
...sidekiqEdges,
|
|
3915
|
-
...erlangBehaviourEdges,
|
|
3916
|
-
...laravelEdges,
|
|
3917
|
-
...cFnPtrEdges,
|
|
3918
|
-
...goframeEdges,
|
|
3919
|
-
...nixOptionEdges,
|
|
3920
|
-
]) {
|
|
4011
|
+
for (const e of passEdges.flat()) {
|
|
3921
4012
|
const key = `${e.source}>${e.target}`;
|
|
3922
4013
|
if (seen.has(key))
|
|
3923
4014
|
continue;
|
|
@@ -3931,6 +4022,7 @@ async function synthesizeCallbackEdges(queries, ctx) {
|
|
|
3931
4022
|
for (let i = 0; i < merged.length; i += 2000) {
|
|
3932
4023
|
queries.insertEdges(merged.slice(i, i + 2000));
|
|
3933
4024
|
await yieldToLoop();
|
|
4025
|
+
await foldIfOver();
|
|
3934
4026
|
}
|
|
3935
4027
|
__mark('insertMergedEdges');
|
|
3936
4028
|
return merged.length + goImpl.length + goMethodContains.length;
|