@colbymchenry/codegraph-win32-arm64 1.4.1 → 1.6.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.
Files changed (314) hide show
  1. package/bin/codegraph.cmd +1 -1
  2. package/lib/dist/bin/codegraph.js +206 -44
  3. package/lib/dist/bin/codegraph.js.map +1 -1
  4. package/lib/dist/context/formatter.d.ts +7 -1
  5. package/lib/dist/context/formatter.d.ts.map +1 -1
  6. package/lib/dist/context/formatter.js +12 -6
  7. package/lib/dist/context/formatter.js.map +1 -1
  8. package/lib/dist/context/index.d.ts +12 -0
  9. package/lib/dist/context/index.d.ts.map +1 -1
  10. package/lib/dist/context/index.js +101 -25
  11. package/lib/dist/context/index.js.map +1 -1
  12. package/lib/dist/db/index.d.ts +179 -0
  13. package/lib/dist/db/index.d.ts.map +1 -1
  14. package/lib/dist/db/index.js +368 -7
  15. package/lib/dist/db/index.js.map +1 -1
  16. package/lib/dist/db/migrations.d.ts +1 -1
  17. package/lib/dist/db/migrations.d.ts.map +1 -1
  18. package/lib/dist/db/migrations.js +25 -1
  19. package/lib/dist/db/migrations.js.map +1 -1
  20. package/lib/dist/db/queries.d.ts +234 -5
  21. package/lib/dist/db/queries.d.ts.map +1 -1
  22. package/lib/dist/db/queries.js +687 -53
  23. package/lib/dist/db/queries.js.map +1 -1
  24. package/lib/dist/db/schema.sql +16 -3
  25. package/lib/dist/db/sqlite-adapter.d.ts +3 -1
  26. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  27. package/lib/dist/db/sqlite-adapter.js +22 -4
  28. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  29. package/lib/dist/db/wal-valve.d.ts +15 -2
  30. package/lib/dist/db/wal-valve.d.ts.map +1 -1
  31. package/lib/dist/db/wal-valve.js +88 -6
  32. package/lib/dist/db/wal-valve.js.map +1 -1
  33. package/lib/dist/directory.d.ts +29 -0
  34. package/lib/dist/directory.d.ts.map +1 -1
  35. package/lib/dist/directory.js +52 -0
  36. package/lib/dist/directory.js.map +1 -1
  37. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  38. package/lib/dist/extraction/extraction-version.js +1 -1
  39. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  40. package/lib/dist/extraction/function-ref.js +6 -0
  41. package/lib/dist/extraction/function-ref.js.map +1 -1
  42. package/lib/dist/extraction/generated-detection.d.ts +48 -12
  43. package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
  44. package/lib/dist/extraction/generated-detection.js +176 -11
  45. package/lib/dist/extraction/generated-detection.js.map +1 -1
  46. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  47. package/lib/dist/extraction/grammars.js +101 -2
  48. package/lib/dist/extraction/grammars.js.map +1 -1
  49. package/lib/dist/extraction/index.d.ts +138 -3
  50. package/lib/dist/extraction/index.d.ts.map +1 -1
  51. package/lib/dist/extraction/index.js +518 -94
  52. package/lib/dist/extraction/index.js.map +1 -1
  53. package/lib/dist/extraction/kernel/decode.d.ts +9 -0
  54. package/lib/dist/extraction/kernel/decode.d.ts.map +1 -0
  55. package/lib/dist/extraction/kernel/decode.js +162 -0
  56. package/lib/dist/extraction/kernel/decode.js.map +1 -0
  57. package/lib/dist/extraction/kernel/index.d.ts +64 -0
  58. package/lib/dist/extraction/kernel/index.d.ts.map +1 -0
  59. package/lib/dist/extraction/kernel/index.js +279 -0
  60. package/lib/dist/extraction/kernel/index.js.map +1 -0
  61. package/lib/dist/extraction/kernel/layout.d.ts +101 -0
  62. package/lib/dist/extraction/kernel/layout.d.ts.map +1 -0
  63. package/lib/dist/extraction/kernel/layout.js +104 -0
  64. package/lib/dist/extraction/kernel/layout.js.map +1 -0
  65. package/lib/dist/extraction/kernel/loader.d.ts +103 -0
  66. package/lib/dist/extraction/kernel/loader.d.ts.map +1 -0
  67. package/lib/dist/extraction/kernel/loader.js +146 -0
  68. package/lib/dist/extraction/kernel/loader.js.map +1 -0
  69. package/lib/dist/extraction/languages/c-cpp.d.ts +14 -0
  70. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  71. package/lib/dist/extraction/languages/c-cpp.js +868 -16
  72. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  73. package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
  74. package/lib/dist/extraction/languages/erlang.js +58 -22
  75. package/lib/dist/extraction/languages/erlang.js.map +1 -1
  76. package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
  77. package/lib/dist/extraction/languages/objc.js +4 -0
  78. package/lib/dist/extraction/languages/objc.js.map +1 -1
  79. package/lib/dist/extraction/languages/rust.d.ts +20 -0
  80. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  81. package/lib/dist/extraction/languages/rust.js +47 -20
  82. package/lib/dist/extraction/languages/rust.js.map +1 -1
  83. package/lib/dist/extraction/parse-pool.d.ts +15 -0
  84. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  85. package/lib/dist/extraction/parse-pool.js +35 -1
  86. package/lib/dist/extraction/parse-pool.js.map +1 -1
  87. package/lib/dist/extraction/parse-worker.js +35 -1
  88. package/lib/dist/extraction/parse-worker.js.map +1 -1
  89. package/lib/dist/extraction/store-worker.d.ts +24 -0
  90. package/lib/dist/extraction/store-worker.d.ts.map +1 -0
  91. package/lib/dist/extraction/store-worker.js +139 -0
  92. package/lib/dist/extraction/store-worker.js.map +1 -0
  93. package/lib/dist/extraction/store-writer.d.ts +63 -0
  94. package/lib/dist/extraction/store-writer.d.ts.map +1 -0
  95. package/lib/dist/extraction/store-writer.js +174 -0
  96. package/lib/dist/extraction/store-writer.js.map +1 -0
  97. package/lib/dist/extraction/tree-sitter-types.d.ts +2 -0
  98. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  99. package/lib/dist/extraction/tree-sitter.d.ts +27 -5
  100. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  101. package/lib/dist/extraction/tree-sitter.js +257 -56
  102. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  103. package/lib/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  104. package/lib/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  105. package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  106. package/lib/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  107. package/lib/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  108. package/lib/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  109. package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  110. package/lib/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  111. package/lib/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  112. package/lib/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  113. package/lib/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  114. package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  115. package/lib/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  116. package/lib/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  117. package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
  118. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  119. package/lib/dist/extraction/wasm-runtime-flags.js +27 -3
  120. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  121. package/lib/dist/graph/queries.d.ts.map +1 -1
  122. package/lib/dist/graph/queries.js +2 -0
  123. package/lib/dist/graph/queries.js.map +1 -1
  124. package/lib/dist/graph/traversal.js +1 -1
  125. package/lib/dist/graph/traversal.js.map +1 -1
  126. package/lib/dist/index.d.ts +36 -2
  127. package/lib/dist/index.d.ts.map +1 -1
  128. package/lib/dist/index.js +305 -11
  129. package/lib/dist/index.js.map +1 -1
  130. package/lib/dist/installer/beta-signup.d.ts +54 -0
  131. package/lib/dist/installer/beta-signup.d.ts.map +1 -0
  132. package/lib/dist/installer/beta-signup.js +178 -0
  133. package/lib/dist/installer/beta-signup.js.map +1 -0
  134. package/lib/dist/installer/index.d.ts +4 -3
  135. package/lib/dist/installer/index.d.ts.map +1 -1
  136. package/lib/dist/installer/index.js +19 -6
  137. package/lib/dist/installer/index.js.map +1 -1
  138. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  139. package/lib/dist/installer/targets/claude.js +37 -5
  140. package/lib/dist/installer/targets/claude.js.map +1 -1
  141. package/lib/dist/installer/targets/codex.d.ts +22 -8
  142. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  143. package/lib/dist/installer/targets/codex.js +65 -48
  144. package/lib/dist/installer/targets/codex.js.map +1 -1
  145. package/lib/dist/installer/targets/copilot-cli.d.ts +32 -0
  146. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -0
  147. package/lib/dist/installer/targets/copilot-cli.js +209 -0
  148. package/lib/dist/installer/targets/copilot-cli.js.map +1 -0
  149. package/lib/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
  150. package/lib/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
  151. package/lib/dist/installer/targets/copilot-jetbrains.js +238 -0
  152. package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -0
  153. package/lib/dist/installer/targets/copilot-vscode.d.ts +47 -0
  154. package/lib/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
  155. package/lib/dist/installer/targets/copilot-vscode.js +219 -0
  156. package/lib/dist/installer/targets/copilot-vscode.js.map +1 -0
  157. package/lib/dist/installer/targets/registry.d.ts.map +1 -1
  158. package/lib/dist/installer/targets/registry.js +6 -0
  159. package/lib/dist/installer/targets/registry.js.map +1 -1
  160. package/lib/dist/installer/targets/toml.d.ts +6 -5
  161. package/lib/dist/installer/targets/toml.d.ts.map +1 -1
  162. package/lib/dist/installer/targets/toml.js +99 -20
  163. package/lib/dist/installer/targets/toml.js.map +1 -1
  164. package/lib/dist/installer/targets/types.d.ts +5 -5
  165. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  166. package/lib/dist/mcp/daemon-manager.d.ts +1 -1
  167. package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
  168. package/lib/dist/mcp/daemon-manager.js +1 -1
  169. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  170. package/lib/dist/mcp/daemon-paths.d.ts +6 -0
  171. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  172. package/lib/dist/mcp/daemon-paths.js +54 -0
  173. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  174. package/lib/dist/mcp/daemon-registry.d.ts +10 -0
  175. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  176. package/lib/dist/mcp/daemon-registry.js +51 -3
  177. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  178. package/lib/dist/mcp/daemon.d.ts +9 -6
  179. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  180. package/lib/dist/mcp/daemon.js +10 -8
  181. package/lib/dist/mcp/daemon.js.map +1 -1
  182. package/lib/dist/mcp/engine.d.ts +3 -0
  183. package/lib/dist/mcp/engine.d.ts.map +1 -1
  184. package/lib/dist/mcp/engine.js +45 -3
  185. package/lib/dist/mcp/engine.js.map +1 -1
  186. package/lib/dist/mcp/explore-dedup.d.ts +137 -0
  187. package/lib/dist/mcp/explore-dedup.d.ts.map +1 -0
  188. package/lib/dist/mcp/explore-dedup.js +236 -0
  189. package/lib/dist/mcp/explore-dedup.js.map +1 -0
  190. package/lib/dist/mcp/explore-diagnostics.d.ts +289 -0
  191. package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -0
  192. package/lib/dist/mcp/explore-diagnostics.js +558 -0
  193. package/lib/dist/mcp/explore-diagnostics.js.map +1 -0
  194. package/lib/dist/mcp/explore-session-state.d.ts +217 -0
  195. package/lib/dist/mcp/explore-session-state.d.ts.map +1 -0
  196. package/lib/dist/mcp/explore-session-state.js +322 -0
  197. package/lib/dist/mcp/explore-session-state.js.map +1 -0
  198. package/lib/dist/mcp/index.d.ts +24 -0
  199. package/lib/dist/mcp/index.d.ts.map +1 -1
  200. package/lib/dist/mcp/index.js +67 -6
  201. package/lib/dist/mcp/index.js.map +1 -1
  202. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  203. package/lib/dist/mcp/liveness-watchdog.js +3 -1
  204. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  205. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  206. package/lib/dist/mcp/proxy.js +6 -1
  207. package/lib/dist/mcp/proxy.js.map +1 -1
  208. package/lib/dist/mcp/server-instructions.d.ts +2 -2
  209. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  210. package/lib/dist/mcp/server-instructions.js +8 -3
  211. package/lib/dist/mcp/server-instructions.js.map +1 -1
  212. package/lib/dist/mcp/session.d.ts +16 -0
  213. package/lib/dist/mcp/session.d.ts.map +1 -1
  214. package/lib/dist/mcp/session.js +36 -13
  215. package/lib/dist/mcp/session.js.map +1 -1
  216. package/lib/dist/mcp/tools.d.ts +276 -10
  217. package/lib/dist/mcp/tools.d.ts.map +1 -1
  218. package/lib/dist/mcp/tools.js +2425 -237
  219. package/lib/dist/mcp/tools.js.map +1 -1
  220. package/lib/dist/project-config.d.ts +23 -0
  221. package/lib/dist/project-config.d.ts.map +1 -1
  222. package/lib/dist/project-config.js +39 -2
  223. package/lib/dist/project-config.js.map +1 -1
  224. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +1 -1
  225. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  226. package/lib/dist/resolution/c-fnptr-synthesizer.js +582 -138
  227. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  228. package/lib/dist/resolution/callback-synthesizer.d.ts +54 -10
  229. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  230. package/lib/dist/resolution/callback-synthesizer.js +287 -167
  231. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  232. package/lib/dist/resolution/cooperative-yield.d.ts +10 -2
  233. package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -1
  234. package/lib/dist/resolution/cooperative-yield.js +6 -4
  235. package/lib/dist/resolution/cooperative-yield.js.map +1 -1
  236. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  237. package/lib/dist/resolution/frameworks/go.js +29 -6
  238. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  239. package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
  240. package/lib/dist/resolution/frameworks/swift.js +11 -1
  241. package/lib/dist/resolution/frameworks/swift.js.map +1 -1
  242. package/lib/dist/resolution/import-resolver.d.ts +2 -3
  243. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  244. package/lib/dist/resolution/import-resolver.js +184 -9
  245. package/lib/dist/resolution/import-resolver.js.map +1 -1
  246. package/lib/dist/resolution/index.d.ts +87 -2
  247. package/lib/dist/resolution/index.d.ts.map +1 -1
  248. package/lib/dist/resolution/index.js +731 -134
  249. package/lib/dist/resolution/index.js.map +1 -1
  250. package/lib/dist/resolution/memory-budget.d.ts +48 -0
  251. package/lib/dist/resolution/memory-budget.d.ts.map +1 -0
  252. package/lib/dist/resolution/memory-budget.js +162 -0
  253. package/lib/dist/resolution/memory-budget.js.map +1 -0
  254. package/lib/dist/resolution/name-matcher.d.ts +42 -1
  255. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  256. package/lib/dist/resolution/name-matcher.js +681 -99
  257. package/lib/dist/resolution/name-matcher.js.map +1 -1
  258. package/lib/dist/resolution/path-aliases.d.ts +6 -4
  259. package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
  260. package/lib/dist/resolution/path-aliases.js +125 -17
  261. package/lib/dist/resolution/path-aliases.js.map +1 -1
  262. package/lib/dist/resolution/resolver-pool.d.ts +106 -0
  263. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -0
  264. package/lib/dist/resolution/resolver-pool.js +344 -0
  265. package/lib/dist/resolution/resolver-pool.js.map +1 -0
  266. package/lib/dist/resolution/resolver-worker.d.ts +17 -0
  267. package/lib/dist/resolution/resolver-worker.d.ts.map +1 -0
  268. package/lib/dist/resolution/resolver-worker.js +141 -0
  269. package/lib/dist/resolution/resolver-worker.js.map +1 -0
  270. package/lib/dist/resolution/types.d.ts +3 -0
  271. package/lib/dist/resolution/types.d.ts.map +1 -1
  272. package/lib/dist/search/identifier-segments.d.ts +10 -0
  273. package/lib/dist/search/identifier-segments.d.ts.map +1 -1
  274. package/lib/dist/search/identifier-segments.js +29 -0
  275. package/lib/dist/search/identifier-segments.js.map +1 -1
  276. package/lib/dist/search/query-paths.d.ts +57 -0
  277. package/lib/dist/search/query-paths.d.ts.map +1 -0
  278. package/lib/dist/search/query-paths.js +298 -0
  279. package/lib/dist/search/query-paths.js.map +1 -0
  280. package/lib/dist/search/query-utils.d.ts +1 -1
  281. package/lib/dist/search/query-utils.d.ts.map +1 -1
  282. package/lib/dist/search/query-utils.js +13 -3
  283. package/lib/dist/search/query-utils.js.map +1 -1
  284. package/lib/dist/sync/watcher.d.ts +47 -1
  285. package/lib/dist/sync/watcher.d.ts.map +1 -1
  286. package/lib/dist/sync/watcher.js +127 -8
  287. package/lib/dist/sync/watcher.js.map +1 -1
  288. package/lib/dist/types.d.ts +61 -3
  289. package/lib/dist/types.d.ts.map +1 -1
  290. package/lib/dist/types.js +27 -1
  291. package/lib/dist/types.js.map +1 -1
  292. package/lib/dist/ui/color.d.ts +21 -0
  293. package/lib/dist/ui/color.d.ts.map +1 -0
  294. package/lib/dist/ui/color.js +42 -0
  295. package/lib/dist/ui/color.js.map +1 -0
  296. package/lib/dist/ui/glyphs.d.ts +35 -10
  297. package/lib/dist/ui/glyphs.d.ts.map +1 -1
  298. package/lib/dist/ui/glyphs.js +59 -12
  299. package/lib/dist/ui/glyphs.js.map +1 -1
  300. package/lib/dist/ui/shimmer-progress.d.ts.map +1 -1
  301. package/lib/dist/ui/shimmer-progress.js +78 -4
  302. package/lib/dist/ui/shimmer-progress.js.map +1 -1
  303. package/lib/dist/ui/shimmer-worker.js +25 -17
  304. package/lib/dist/ui/shimmer-worker.js.map +1 -1
  305. package/lib/dist/ui/types.d.ts +0 -2
  306. package/lib/dist/ui/types.d.ts.map +1 -1
  307. package/lib/dist/upgrade/index.d.ts +7 -0
  308. package/lib/dist/upgrade/index.d.ts.map +1 -1
  309. package/lib/dist/upgrade/index.js +18 -5
  310. package/lib/dist/upgrade/index.js.map +1 -1
  311. package/lib/kernel/codegraph-kernel.node +0 -0
  312. package/lib/node_modules/.package-lock.json +1 -1
  313. package/lib/package.json +6 -1
  314. 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,22 +1091,39 @@ async function interfaceOverrideEdges(queries, onYield) {
1071
1091
  let scanned255 = 0;
1072
1092
  const edges = [];
1073
1093
  const seen = new Set();
1074
- const methodsOf = (classId) => queries
1075
- .getOutgoingEdges(classId, ['contains'])
1076
- .map((e) => queries.getNodeById(e.target))
1077
- .filter((n) => !!n && n.kind === 'method');
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.
1081
- const concreteKinds = ['class', 'struct'];
1112
+ const concreteKinds = ['class', 'struct', 'union'];
1082
1113
  for (const kind of concreteKinds) {
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 queries.getOutgoingEdges(cls.id, ['implements', 'extends'])) {
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;
@@ -1268,7 +1305,11 @@ async function reactJsxChildEdges(ctx, onYield) {
1268
1305
  const content = ctx.readFile(file);
1269
1306
  if (!content || (!content.includes('</') && !content.includes('/>')))
1270
1307
  continue; // JSX-file gate
1271
- const parents = ctx.getNodesInFile(file).filter((n) => PARENT_KINDS.has(n.kind));
1308
+ // File-level language gate, not merely a project-level one: mixed C/JS
1309
+ // monorepos must not interpret `"<Foo/>"` inside C as JSX (#1560).
1310
+ const parents = ctx.getNodesInFile(file).filter((n) => PARENT_KINDS.has(n.kind) && JS_FAMILY.includes(n.language));
1311
+ if (parents.length === 0)
1312
+ continue;
1272
1313
  for (const parent of parents) {
1273
1314
  const src = sliceLines(content, parent.startLine, parent.endLine);
1274
1315
  if (!src || (!src.includes('</') && !src.includes('/>')))
@@ -1876,6 +1917,20 @@ async function mybatisJavaXmlEdges(queries, onYield) {
1876
1917
  let scanned255 = 0;
1877
1918
  const edges = [];
1878
1919
  const seen = new Set();
1920
+ // Collect the XML side FIRST (mapper `<select id=…>` statements extracted as
1921
+ // xml-language method nodes): if the project has none — every Java+XML repo
1922
+ // that doesn't use MyBatis — return before paying the full java-method
1923
+ // stream below. Same rowid stream order as matching inline, so the edge
1924
+ // output is byte-identical when mappers do exist.
1925
+ const xmlMethods = [];
1926
+ for (const m of queries.iterateNodesByKind('method')) {
1927
+ if ((++scanned255 & 63) === 0)
1928
+ await onYield();
1929
+ if (m.language === 'xml')
1930
+ xmlMethods.push(m);
1931
+ }
1932
+ if (xmlMethods.length === 0)
1933
+ return edges;
1879
1934
  // Index Java methods by `<ClassName>::<methodName>` for O(1) lookup.
1880
1935
  const javaIndex = new Map();
1881
1936
  for (const m of queries.iterateNodesByKind('method')) {
@@ -1895,11 +1950,9 @@ async function mybatisJavaXmlEdges(queries, onYield) {
1895
1950
  else
1896
1951
  javaIndex.set(key, [m]);
1897
1952
  }
1898
- for (const xml of queries.iterateNodesByKind('method')) {
1953
+ for (const xml of xmlMethods) {
1899
1954
  if ((++scanned255 & 63) === 0)
1900
1955
  await onYield();
1901
- if (xml.language !== 'xml')
1902
- continue;
1903
1956
  // Qualified name: `<namespace>::<id>`. Extract the simple class name.
1904
1957
  const colonIdx = xml.qualifiedName.lastIndexOf('::');
1905
1958
  if (colonIdx < 0)
@@ -3181,6 +3234,10 @@ const ERLANG_BEHAVIOUR_FANOUT_CAP = 24;
3181
3234
  */
3182
3235
  function erlangArityAt(src, openIdx) {
3183
3236
  let depth = 1;
3237
+ // `<<1,2,3>>` binary literals: commas inside are element separators, not
3238
+ // argument separators. Tracked separately from bracket depth because the
3239
+ // single-char `<`/`>` comparison operators must stay inert (#1358).
3240
+ let binDepth = 0;
3184
3241
  let commas = 0;
3185
3242
  let sawArg = false;
3186
3243
  const limit = Math.min(src.length, openIdx + 4000);
@@ -3203,6 +3260,17 @@ function erlangArityAt(src, openIdx) {
3203
3260
  sawArg = true;
3204
3261
  continue;
3205
3262
  }
3263
+ if (ch === '<' && src[i + 1] === '<') {
3264
+ binDepth++;
3265
+ i++;
3266
+ sawArg = true;
3267
+ continue;
3268
+ }
3269
+ if (ch === '>' && src[i + 1] === '>' && binDepth > 0) {
3270
+ binDepth--;
3271
+ i++;
3272
+ continue;
3273
+ }
3206
3274
  if (ch === '(' || ch === '[' || ch === '{') {
3207
3275
  depth++;
3208
3276
  sawArg = true;
@@ -3214,7 +3282,7 @@ function erlangArityAt(src, openIdx) {
3214
3282
  return sawArg ? commas + 1 : 0;
3215
3283
  continue;
3216
3284
  }
3217
- if (ch === ',' && depth === 1) {
3285
+ if (ch === ',' && depth === 1 && binDepth === 0) {
3218
3286
  commas++;
3219
3287
  continue;
3220
3288
  }
@@ -3470,12 +3538,18 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3470
3538
  }
3471
3539
  if (declaringBehaviours.size === 0)
3472
3540
  return [];
3473
- // Implementer target lookup, lazy per (behaviour, fn): implementers come
3474
- // from the `implements` edges extraction resolved, and the target is the
3475
- // implementer module's own exported `fn` function node.
3541
+ // Implementer target lookup, lazy per (behaviour, fn, arity): implementers
3542
+ // come from the `implements` edges extraction resolved, and the target is
3543
+ // the implementer module's own exported `fn` node OF THE SITE'S ARITY —
3544
+ // function qualifiedNames carry arity (`mod::fn/2`, #1610), so the arity the
3545
+ // dispatch site used selects among same-named definitions.
3476
3546
  const targetCache = new Map();
3477
- const targetsOf = (behaviour, fn) => {
3478
- const cacheKey = `${behaviour.id}#${fn}`;
3547
+ const qnArity = (qn) => {
3548
+ const m = /\/(\d{1,3})$/.exec(qn);
3549
+ return m ? Number(m[1]) : -1;
3550
+ };
3551
+ const targetsOf = (behaviour, fn, arity) => {
3552
+ const cacheKey = `${behaviour.id}#${fn}/${arity}`;
3479
3553
  let targets = targetCache.get(cacheKey);
3480
3554
  if (targets)
3481
3555
  return targets;
@@ -3486,7 +3560,10 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3486
3560
  continue;
3487
3561
  const fnNode = ctx
3488
3562
  .getNodesInFile(impl.filePath)
3489
- .find((n) => n.kind === 'function' && n.name === fn && n.isExported !== false);
3563
+ .find((n) => n.kind === 'function' &&
3564
+ n.name === fn &&
3565
+ qnArity(n.qualifiedName) === arity &&
3566
+ n.isExported !== false);
3490
3567
  if (fnNode)
3491
3568
  targets.push(fnNode);
3492
3569
  }
@@ -3521,7 +3598,7 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3521
3598
  if (!behaviours || behaviours.length !== 1)
3522
3599
  continue; // unknown or ambiguous
3523
3600
  const behaviour = behaviours[0];
3524
- const targets = targetsOf(behaviour, fn);
3601
+ const targets = targetsOf(behaviour, fn, arity);
3525
3602
  if (targets.length === 0 || targets.length > ERLANG_BEHAVIOUR_FANOUT_CAP)
3526
3603
  continue;
3527
3604
  const line = safe.slice(0, m.index).split('\n').length;
@@ -3715,7 +3792,96 @@ async function laravelEventEdges(ctx, onYield) {
3715
3792
  * Sidekiq Worker.perform_async → #perform + Laravel event(new X) → listener handle).
3716
3793
  * Returns the count added. Never throws into indexing — callers wrap in try/catch.
3717
3794
  */
3718
- async function synthesizeCallbackEdges(queries, ctx) {
3795
+ /**
3796
+ * Number of progress steps synthesizeCallbackEdges reports: one per `__mark()`
3797
+ * call (every synthesis pass, plus the dedupe-merge and edge-insert steps).
3798
+ * Cosmetic only — drift just makes the progress bar end early or jump — and a
3799
+ * test pins it to the actual step count (registry passes + the fixed
3800
+ * pre/post marks) so adding a pass without bumping this fails loudly instead
3801
+ * of silently skewing the bar.
3802
+ */
3803
+ const JS_FAMILY = ['typescript', 'javascript', 'tsx', 'jsx'];
3804
+ const ALWAYS = () => true;
3805
+ /**
3806
+ * The independent passes, in MERGE ORDER — the first-seen dedup in
3807
+ * synthesizeCallbackEdges follows this array, so reordering entries changes
3808
+ * which duplicate edge wins. The two Go pre-passes (cross-file method
3809
+ * `contains`, implicit `implements`) are NOT here: they persist before these
3810
+ * run because interfaceOverrideEdges reads their edges from the DB.
3811
+ */
3812
+ exports.SYNTH_PASSES = [
3813
+ { name: 'fieldEdges', gate: ALWAYS, run: (q, c, y) => fieldChannelEdges(q, c, y) },
3814
+ { name: 'closureCollEdges', gate: ALWAYS, run: (q, c, y) => closureCollectionEdges(q, c, y) },
3815
+ { name: 'emitterEdges', gate: ALWAYS, run: (_q, c, y) => eventEmitterEdges(c, y) },
3816
+ { name: 'renderEdges', gate: ALWAYS, run: (q, c, y) => reactRenderEdges(q, c, y) },
3817
+ { name: 'jsxEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => reactJsxChildEdges(c, y) },
3818
+ { name: 'vueEdges', gate: (has) => has('vue'), run: (_q, c, y) => vueTemplateEdges(c, y) },
3819
+ { name: 'svelteKitEdges', gate: (has) => has('svelte'), run: (_q, c, y) => svelteKitLoadEdges(c, y) },
3820
+ { name: 'pascalEdges', gate: ALWAYS, run: (_q, c, y) => pascalFormEdges(c, y) },
3821
+ { name: 'flutterEdges', gate: (has) => has('dart'), run: (q, c, y) => flutterBuildEdges(q, c, y) },
3822
+ { name: 'arkuiStateEdges', gate: (has) => has('arkts'), run: (q, c, y) => arkuiStateBuildEdges(q, c, y) },
3823
+ { name: 'arkuiEmitter', gate: (has) => has('arkts'), run: (_q, c, y) => arkuiEmitterEdges(c, y) },
3824
+ { name: 'arkuiRoutes', gate: (has) => has('arkts'), run: (_q, c, y) => arkuiRouterEdges(c, y) },
3825
+ { name: 'cppEdges', gate: (has) => has('cpp'), run: (q, _c, y) => cppOverrideEdges(q, y) },
3826
+ {
3827
+ name: 'ifaceEdges',
3828
+ gate: (has) => has('java', 'kotlin', 'csharp', 'swift', 'scala', 'go', 'rust', 'arkts', ...JS_FAMILY),
3829
+ run: (q, _c, y) => interfaceOverrideEdges(q, y),
3830
+ },
3831
+ { name: 'kotlinExpectActual', gate: (has) => has('kotlin'), run: (q, _c, y) => kotlinExpectActualEdges(q, y) },
3832
+ { name: 'goGrpcEdges', gate: (has) => has('go'), run: (q, _c, y) => goGrpcStubImplEdges(q, y) },
3833
+ { name: 'rnEventEdgesList', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => rnEventEdges(c, y) },
3834
+ { name: 'fabricNativeEdges', gate: ALWAYS, run: (_q, c, y) => fabricNativeImplEdges(c, y) },
3835
+ // Expo module nodes (`expo-module:` ids) are emitted only from .swift/.kt
3836
+ // files, and a pair needs BOTH platforms — so without both languages the
3837
+ // pass's only collection loop is provably empty (it was streaming every
3838
+ // method row on pure-Java repos to find nothing).
3839
+ { name: 'expoXPlatEdges', gate: (has) => has('swift') && has('kotlin'), run: (q, _c, y) => expoCrossPlatformEdges(q, y) },
3840
+ // An RN cross-platform edge requires a JS-language caller on the native
3841
+ // method (`isBridge`) — no JS-family files means no JS-language nodes, so
3842
+ // the result is provably empty.
3843
+ { name: 'rnXPlatEdges', gate: (has) => has(...JS_FAMILY), run: (q, _c, y) => rnCrossPlatformEdges(q, y) },
3844
+ {
3845
+ name: 'mybatisEdges',
3846
+ gate: (has) => has('java', 'kotlin') && has('xml'),
3847
+ run: (q, _c, y) => mybatisJavaXmlEdges(q, y),
3848
+ },
3849
+ { name: 'ginEdges', gate: (has) => has('go'), run: (q, c, y) => ginMiddlewareChainEdges(q, c, y) },
3850
+ { name: 'thunkEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => reduxThunkEdges(q, c, y) },
3851
+ { name: 'registryEdges', gate: ALWAYS, run: (_q, c, y) => objectRegistryEdges(c, y) },
3852
+ { name: 'rtkEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => rtkQueryEdges(q, c, y) },
3853
+ { name: 'piniaEdges', gate: (has) => has('vue', ...JS_FAMILY), run: (_q, c, y) => piniaStoreEdges(c, y) },
3854
+ { name: 'vuexEdges', gate: (has) => has('vue', ...JS_FAMILY), run: (_q, c, y) => vuexDispatchEdges(c, y) },
3855
+ { name: 'celeryEdges', gate: (has) => has('python'), run: (_q, c, y) => celeryDispatchEdges(c, y) },
3856
+ { name: 'springEdges', gate: (has) => has('java'), run: (_q, c, y) => springEventEdges(c, y) },
3857
+ { name: 'mediatrEdges', gate: (has) => has('csharp'), run: (_q, c, y) => mediatrDispatchEdges(c, y) },
3858
+ { name: 'sidekiqEdges', gate: (has) => has('ruby'), run: (_q, c, y) => sidekiqDispatchEdges(c, y) },
3859
+ {
3860
+ name: 'erlangBehaviourEdges',
3861
+ gate: (has) => has('erlang'),
3862
+ run: (q, c, y) => erlangBehaviourDispatchEdges(q, c, y),
3863
+ },
3864
+ { name: 'laravelEdges', gate: (has) => has('php'), run: (_q, c, y) => laravelEventEdges(c, y) },
3865
+ {
3866
+ name: 'cFnPtrEdges',
3867
+ gate: (has) => has('c', 'cpp'),
3868
+ run: (q, c, y, sub) => (0, c_fnptr_synthesizer_1.cFnPointerDispatchEdges)(q, c, y, sub),
3869
+ },
3870
+ { name: 'goframeEdges', gate: (has) => has('go'), run: (_q, c, y) => (0, goframe_synthesizer_1.goframeRouteEdges)(c, y) },
3871
+ { name: 'nixOptionEdges', gate: (has) => has('nix'), run: (q, _c, y) => nixOptionPathEdges(q, y) },
3872
+ ];
3873
+ /** Fixed non-registry steps: goMethodContains, goImplements, dedupe-merge, insertMergedEdges. */
3874
+ const FIXED_SYNTH_STEPS = 4;
3875
+ exports.SYNTH_PROGRESS_STEPS = exports.SYNTH_PASSES.length + FIXED_SYNTH_STEPS;
3876
+ async function synthesizeCallbackEdges(queries, ctx, onProgress,
3877
+ // A live resolver pool to fan the independent passes across (structural type
3878
+ // so this file never imports the pool — resolver-worker imports THIS file).
3879
+ // Null/omitted → the sequential path, byte-identical to the pool path.
3880
+ pool,
3881
+ // WAL-valve writer backstop (WalCheckpointValve.backpressure), called at
3882
+ // pool-idle points in the edge-insert loops below — the passes themselves
3883
+ // only read; every write in this function happens with the pool idle.
3884
+ backpressure) {
3719
3885
  // Each sub-pass below is a whole-graph scan, and there are ~30 of them, all
3720
3886
  // running synchronously on the indexer's main thread. Their AGGREGATE can run
3721
3887
  // for well over a minute on a large repo — long enough for the #850 liveness
@@ -3724,6 +3890,30 @@ async function synthesizeCallbackEdges(queries, ctx) {
3724
3890
  // that itself hangs (a real wedge) never reaches the next yield, so the
3725
3891
  // watchdog still catches that. See ./cooperative-yield.
3726
3892
  const yieldToLoop = (0, cooperative_yield_1.createYielder)();
3893
+ // Synthesis runs AFTER the resolution progress bar reaches 100%, so without
3894
+ // its own progress the UI freezes at "Resolving refs 100%" for the whole
3895
+ // tail — long enough on big repos that users conclude the index hung and
3896
+ // kill it. Report each completed pass; the caller surfaces it as its own
3897
+ // progress phase. Emit 0/total up front so the phase flips immediately.
3898
+ // Emissions are throttled to whole-percent movement (each consumes a UI
3899
+ // message); values may be fractional steps from within-pass reporting.
3900
+ let passesDone = 0;
3901
+ let lastPct = -1;
3902
+ const emit = (value) => {
3903
+ if (!onProgress)
3904
+ return;
3905
+ const v = Math.min(value, exports.SYNTH_PROGRESS_STEPS);
3906
+ const pct = Math.floor((v / exports.SYNTH_PROGRESS_STEPS) * 100);
3907
+ if (pct === lastPct)
3908
+ return;
3909
+ lastPct = pct;
3910
+ onProgress(v, exports.SYNTH_PROGRESS_STEPS);
3911
+ };
3912
+ // A single long pass otherwise parks the bar between steps; a pass that
3913
+ // takes this callback reports a 0..1 fraction of its own work, surfaced
3914
+ // here as fractional progress within its step.
3915
+ const subProgress = (fraction) => emit(passesDone + Math.max(0, Math.min(fraction, 1)));
3916
+ emit(0);
3727
3917
  // Per-pass wall-clock timing to stderr, opt-in via CODEGRAPH_SYNTH_TIMINGS
3728
3918
  // (=1: passes over 250ms; =all: every pass). This is the diagnostic that
3729
3919
  // located both the #1091/#1122 watchdog stalls and the #1212 OOM — keep it.
@@ -3735,6 +3925,8 @@ async function synthesizeCallbackEdges(queries, ctx) {
3735
3925
  if (process.env.CODEGRAPH_SYNTH_TIMINGS && (dt > 250 || process.env.CODEGRAPH_SYNTH_TIMINGS === 'all')) {
3736
3926
  console.error(`[synth-timing] ${label}: ${dt}ms`);
3737
3927
  }
3928
+ passesDone++;
3929
+ emit(passesDone);
3738
3930
  };
3739
3931
  // Language gating: one indexed DISTINCT over the files table lets a pass
3740
3932
  // whose own filters reference a specific language/extension be skipped
@@ -3744,17 +3936,24 @@ async function synthesizeCallbackEdges(queries, ctx) {
3744
3936
  // Passes without an explicit language filter always run.
3745
3937
  const langs = queries.getDistinctFileLanguages();
3746
3938
  const has = (...ls) => ls.some((l) => langs.has(l));
3747
- const JS_FAMILY = ['typescript', 'javascript', 'tsx', 'jsx'];
3748
3939
  const NONE = [];
3749
3940
  // Cross-file Go method→type `contains` edges must be synthesized AND persisted
3750
3941
  // FIRST: a method declared in a different file from its receiver type is
3751
3942
  // otherwise orphaned from the struct, and goImplementsEdges (next) derives a
3752
3943
  // struct's method set from its `contains` edges — so without this it would
3753
3944
  // under-count the interfaces a cross-file struct satisfies. (#583)
3945
+ // Writer-side WAL backstop for the insert loops here (see the param doc):
3946
+ // one fstat when under the valve's hard cap, a parked full backfill past it.
3947
+ const foldIfOver = async () => {
3948
+ const bp = backpressure?.();
3949
+ if (bp)
3950
+ await bp;
3951
+ };
3754
3952
  const goMethodContains = has('go') ? await goCrossFileMethodContainsEdges(queries, yieldToLoop) : NONE;
3755
3953
  for (let i = 0; i < goMethodContains.length; i += 2000) {
3756
3954
  queries.insertEdges(goMethodContains.slice(i, i + 2000));
3757
3955
  await yieldToLoop();
3956
+ await foldIfOver();
3758
3957
  }
3759
3958
  await yieldToLoop();
3760
3959
  __mark('goMethodContains');
@@ -3766,158 +3965,78 @@ async function synthesizeCallbackEdges(queries, ctx) {
3766
3965
  for (let i = 0; i < goImpl.length; i += 2000) {
3767
3966
  queries.insertEdges(goImpl.slice(i, i + 2000));
3768
3967
  await yieldToLoop();
3968
+ await foldIfOver();
3769
3969
  }
3770
3970
  await yieldToLoop();
3771
3971
  __mark('goImplements');
3772
- const fieldEdges = await fieldChannelEdges(queries, ctx, yieldToLoop);
3773
- await yieldToLoop();
3774
- __mark('fieldEdges');
3775
- const closureCollEdges = await closureCollectionEdges(queries, ctx, yieldToLoop);
3776
- await yieldToLoop();
3777
- __mark('closureCollEdges');
3778
- const emitterEdges = await eventEmitterEdges(ctx, yieldToLoop);
3779
- await yieldToLoop();
3780
- __mark('emitterEdges');
3781
- const renderEdges = await reactRenderEdges(queries, ctx, yieldToLoop);
3782
- await yieldToLoop();
3783
- __mark('renderEdges');
3784
- const jsxEdges = await reactJsxChildEdges(ctx, yieldToLoop);
3785
- await yieldToLoop();
3786
- __mark('jsxEdges');
3787
- const vueEdges = has('vue') ? await vueTemplateEdges(ctx, yieldToLoop) : NONE;
3788
- await yieldToLoop();
3789
- __mark('vueEdges');
3790
- const svelteKitEdges = has('svelte') ? await svelteKitLoadEdges(ctx, yieldToLoop) : NONE;
3791
- await yieldToLoop();
3792
- __mark('svelteKitEdges');
3793
- const pascalEdges = await pascalFormEdges(ctx, yieldToLoop);
3794
- await yieldToLoop();
3795
- __mark('pascalEdges');
3796
- const flutterEdges = has('dart') ? await flutterBuildEdges(queries, ctx, yieldToLoop) : NONE;
3797
- await yieldToLoop();
3798
- __mark('flutterEdges');
3799
- const arkuiStateEdges = has('arkts') ? await arkuiStateBuildEdges(queries, ctx, yieldToLoop) : NONE;
3800
- await yieldToLoop();
3801
- __mark('arkuiStateEdges');
3802
- const arkuiEmitter = has('arkts') ? await arkuiEmitterEdges(ctx, yieldToLoop) : NONE;
3803
- await yieldToLoop();
3804
- __mark('arkuiEmitter');
3805
- const arkuiRoutes = has('arkts') ? await arkuiRouterEdges(ctx, yieldToLoop) : NONE;
3806
- await yieldToLoop();
3807
- __mark('arkuiRoutes');
3808
- const cppEdges = has('cpp') ? await cppOverrideEdges(queries, yieldToLoop) : NONE;
3809
- await yieldToLoop();
3810
- __mark('cppEdges');
3811
- const ifaceEdges = has('java', 'kotlin', 'csharp', 'swift', 'scala', 'go', 'rust', 'arkts', ...JS_FAMILY)
3812
- ? await interfaceOverrideEdges(queries, yieldToLoop) : NONE;
3813
- await yieldToLoop();
3814
- __mark('ifaceEdges');
3815
- const kotlinExpectActual = has('kotlin') ? await kotlinExpectActualEdges(queries, yieldToLoop) : NONE;
3816
- await yieldToLoop();
3817
- __mark('kotlinExpectActual');
3818
- const goGrpcEdges = has('go') ? await goGrpcStubImplEdges(queries, yieldToLoop) : NONE;
3819
- await yieldToLoop();
3820
- __mark('goGrpcEdges');
3821
- const rnEventEdgesList = has(...JS_FAMILY) ? await rnEventEdges(ctx, yieldToLoop) : NONE;
3822
- await yieldToLoop();
3823
- __mark('rnEventEdgesList');
3824
- const fabricNativeEdges = await fabricNativeImplEdges(ctx, yieldToLoop);
3825
- await yieldToLoop();
3826
- __mark('fabricNativeEdges');
3827
- const expoXPlatEdges = await expoCrossPlatformEdges(queries, yieldToLoop);
3828
- await yieldToLoop();
3829
- __mark('expoXPlatEdges');
3830
- const rnXPlatEdges = await rnCrossPlatformEdges(queries, yieldToLoop);
3831
- await yieldToLoop();
3832
- __mark('rnXPlatEdges');
3833
- const mybatisEdges = has('java', 'kotlin') && has('xml') ? await mybatisJavaXmlEdges(queries, yieldToLoop) : NONE;
3834
- await yieldToLoop();
3835
- __mark('mybatisEdges');
3836
- const ginEdges = has('go') ? await ginMiddlewareChainEdges(queries, ctx, yieldToLoop) : NONE;
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');
3972
+ // Run the independent passes (see SYNTH_PASSES). Their results are merged in
3973
+ // REGISTRY ORDER below regardless of execution order, and none of their edges
3974
+ // persist until that merge — so every pass sees the same committed
3975
+ // post-resolution DB state whether it runs sequentially here or on a resolver
3976
+ // pool worker. With a live pool (already booted on ≥150k-ref repos), passes
3977
+ // fan out across its read-only workers and the per-pass wall-clock comes from
3978
+ // the worker; a pass that fails on a worker falls back to running on the main
3979
+ // thread, so a worker crash isolates to a retry instead of failing synthesis.
3980
+ const passEdges = new Array(exports.SYNTH_PASSES.length).fill(NONE);
3981
+ const markPass = (label, dt) => {
3982
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS && (dt > 250 || process.env.CODEGRAPH_SYNTH_TIMINGS === 'all')) {
3983
+ console.error(`[synth-timing] ${label}: ${dt}ms`);
3984
+ }
3985
+ passesDone++;
3986
+ emit(passesDone);
3987
+ };
3988
+ const runPassOnMain = async (i) => {
3989
+ const pass = exports.SYNTH_PASSES[i];
3990
+ const t0 = Date.now();
3991
+ passEdges[i] = await pass.run(queries, ctx, yieldToLoop, subProgress);
3992
+ await yieldToLoop();
3993
+ markPass(pass.name, Date.now() - t0);
3994
+ };
3995
+ const gatedIn = [];
3996
+ for (let i = 0; i < exports.SYNTH_PASSES.length; i++) {
3997
+ if (exports.SYNTH_PASSES[i].gate(has))
3998
+ gatedIn.push(i);
3999
+ else
4000
+ markPass(exports.SYNTH_PASSES[i].name, 0);
4001
+ }
4002
+ // Above this node count, a pass that OOM-killed its worker must NOT be
4003
+ // retried on the main thread — the retry would OOM the whole process and
4004
+ // take the index with it (the #1212 failure class). Below it, a worker
4005
+ // failure is more likely a transient crash than a memory ceiling, and the
4006
+ // main-thread retry keeps coverage. Skipping loses only that pass's
4007
+ // synthesized edges; the index still completes.
4008
+ const MAIN_RETRY_MAX_NODES = 1_500_000;
4009
+ const graphNodes = queries.getNodeAndEdgeCount().nodes;
4010
+ if (pool && gatedIn.length > 1) {
4011
+ await Promise.all(gatedIn.map(async (i) => {
4012
+ const pass = exports.SYNTH_PASSES[i];
4013
+ try {
4014
+ const out = await pool.runSynthPass(pass.name);
4015
+ passEdges[i] = out.edges;
4016
+ markPass(pass.name, out.ms);
4017
+ }
4018
+ catch (err) {
4019
+ if (graphNodes > MAIN_RETRY_MAX_NODES) {
4020
+ // Worker died at a scale where the main-thread retry is a process
4021
+ // OOM risk: skip the pass, keep the index alive, and say so.
4022
+ 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)}`);
4023
+ markPass(`${pass.name} (skipped at scale)`, 0);
4024
+ return;
4025
+ }
4026
+ // Worker-side failure (crash, OOM, unknown pass after a version
4027
+ // mismatch): retry this one pass on the main thread.
4028
+ await runPassOnMain(i);
4029
+ }
4030
+ }));
4031
+ }
4032
+ else {
4033
+ for (const i of gatedIn) {
4034
+ await runPassOnMain(i);
4035
+ }
4036
+ }
3881
4037
  const merged = [];
3882
4038
  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
- ]) {
4039
+ for (const e of passEdges.flat()) {
3921
4040
  const key = `${e.source}>${e.target}`;
3922
4041
  if (seen.has(key))
3923
4042
  continue;
@@ -3931,6 +4050,7 @@ async function synthesizeCallbackEdges(queries, ctx) {
3931
4050
  for (let i = 0; i < merged.length; i += 2000) {
3932
4051
  queries.insertEdges(merged.slice(i, i + 2000));
3933
4052
  await yieldToLoop();
4053
+ await foldIfOver();
3934
4054
  }
3935
4055
  __mark('insertMergedEdges');
3936
4056
  return merged.length + goImpl.length + goMethodContains.length;