Commit 204862c
authored
feat(parity): port the JS points-to solver to native and unify engine resolution (#1465)
* refactor(native): mirror crate module layout to the src/ TypeScript tree
Reorganize crates/codegraph-core/src/ so every module sits at the path of
its TypeScript counterpart (snake_case for kebab-case): shared/,
infrastructure/, db/repository/, domain/graph/builder/stages/,
ast_analysis/, graph/algorithms/, graph/classifiers/, features/.
- Pure git mv moves; only graph_algorithms.rs is split (bfs, shortest_path,
centrality, louvain) along its existing section boundaries
- lib.rs doc comment carries the full Rust<->TypeScript mapping table
- Cross-references in TS sources, tests, and docs updated to new paths
- Cargo.lock version synced to 3.12.0 (Cargo.toml was already bumped)
- cargo test: 360 passed; tsc build and drift-guard test green
* feat(parity): port the JS points-to solver to the native engine and unify per-engine resolution
Native (Rust):
- Extract all eight pts binding kinds in the JS extractor (param,
this-call, array-element, spread-arg, for-of, array-callback,
object-rest-param, object-prop) and surface them on FileSymbols
- Run the same fixed-point points-to solver as the WASM path inside
build_call_edges: thisCall-to-fnRef conversion, four-case key gate with
receiver-key fallback, hop-penalised alias edges with pts upgrade
- Normalize inline-new receivers (new A().t() -> receiver "A") in
extract_receiver_name, mirroring extractReceiverName in the TS extractor
- Apply the >=0.5 confidence filter on exact cross-file lookups (#1439)
WASM/TS:
- Plumb params and all eight binding arrays through NativeFileEntry so the
hybrid path feeds the native solver
- Serialize thisCallBindings across the WASM worker boundary
- Backport the native engine's class-field type-annotation extraction
(private repo: Repository seeds typeMap "repo"/"this.repo")
- Remove the four JS pts post-passes that duplicated the native solver on
the hybrid path (param-flow, fnRef, thisCall, object-rest)
- Report the native build summary and build_meta counts after the JS
edge-writing post-passes so they include CHA/this-dispatch edges (#1452)
WASM, full-native orchestrator, and hybrid builds now produce identical
edge multisets on the javascript fixture (155 rows each, including
confidence and dynamic flags); javascript 42/42 and pts-javascript 13/13
expected edges on both engines; 392 Rust tests, 3043 JS tests, and the
176-test resolution benchmark are green.
Closes #1453
Closes #1452
Closes #1439
* fix(native): port Phase 8.2 cross-file return-type propagation to the Rust orchestrator
The JS pipeline seeds each file's typeMap with the return types of
imported factory functions (propagateReturnTypesAcrossFiles) before
edge resolution, so `const svc = buildService(); svc.createUser()`
resolves across files. The Rust orchestrator extracted returnTypeMap
and callAssignments but never consumed them, dropping those calls and
receiver edges on the native path (hybrid was unaffected because the
JS pipeline pre-seeds the typeMap it sends over napi).
Mirror the JS pass in pipeline.rs: build a per-file + global return-type
index, resolve each call assignment through the file's imports (or the
qualified Type.method global map), and inject typeMap entries at
confidence minus PROPAGATION_HOP_PENALTY, never overwriting locally
typed variables.
Verified with scripts/parity-compare.mjs: the javascript fixture now
matches exactly across wasm/native/hybrid (180 edges incl. driver.mjs
conf=0.7 calls + conf=0.75 receiver edges).
* fix(native): add process/window/document/globalThis to JS_BUILTIN_GLOBALS (#1465)
* fix(native): add safety comment on max_idx usize cast guard (#1465)1 parent f814067 commit 204862c
13 files changed
Lines changed: 2386 additions & 528 deletions
File tree
- crates/codegraph-core/src
- domain/graph/builder
- stages
- extractors
- features
- src
- domain
- graph/builder/stages
- extractors
- tests/parsers
Lines changed: 248 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
553 | 558 | | |
554 | 559 | | |
555 | 560 | | |
| |||
1288 | 1293 | | |
1289 | 1294 | | |
1290 | 1295 | | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
1291 | 1396 | | |
1292 | 1397 | | |
1293 | 1398 | | |
| |||
1348 | 1453 | | |
1349 | 1454 | | |
1350 | 1455 | | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
1351 | 1460 | | |
1352 | 1461 | | |
1353 | 1462 | | |
| |||
1359 | 1468 | | |
1360 | 1469 | | |
1361 | 1470 | | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
1362 | 1480 | | |
1363 | 1481 | | |
1364 | 1482 | | |
| |||
1382 | 1500 | | |
1383 | 1501 | | |
1384 | 1502 | | |
1385 | | - | |
1386 | | - | |
1387 | | - | |
1388 | | - | |
1389 | | - | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
1390 | 1512 | | |
1391 | 1513 | | |
1392 | 1514 | | |
| |||
1798 | 1920 | | |
1799 | 1921 | | |
1800 | 1922 | | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
0 commit comments