Repository navigation
feat: port upstream overload, framework and dynamic-dispatch resolution - #7
Merged
Merged
Conversation
Close the gaps against upstream CodeGraph in three areas. Types and overloads: - Calls record their argument shapes (Java, Kotlin, TS/JS) and pick the overload whose arity and argument types fit, instead of the first declared. - Java/Kotlin calls on a field receiver (`repo.find()`, `this.repo.find()`) are typed by the field; same-package Java types resolve through the package node, so `Token.Tag` names the nested type. - Go structural interfaces match by method key, parameter/result counts and types; interface dispatch follows upstream's per-type override pass. Frameworks: - Next.js routes named by path with upstream segments; router.push, redirect and <Link href> navigation; middleware/proxy matcher coverage. - React Router and TanStack Router route tables, links and navigation. - NestJS HTTP, GraphQL, microservice and WebSocket routes. - Express chained router.route() and cross-file mount prefixes. - A decorator route's bare handler name falls back to the method it sits on. Dynamic and cross-boundary calls: - Callback collections, object registries, HTTP client -> route, queue job -> consumer, event bus and sockets, Celery tasks, Spring events. - Synthesized edges merge by (source, target) in upstream pass order. Engine rule version 5; segment format unchanged. Incremental sync recomputes the cross-file passes and re-resolves names whose signatures changed. Minified files are skipped by the new site scanners, and facts compute columns incrementally so a one-line bundle no longer costs quadratic time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Rust engine lagged upstream CodeGraph in three areas: overload and type resolution, framework understanding, and dynamic / cross-boundary calls. This ports upstream's rules for each (pinned oracle
d2e0389, plus upstream's two later fixes for Java overload arguments and Go interface types), restructured for this engine's extract-sites-then-link model so that incremental sync still equals a full rebuild.Changes
Types and overloads
repo.find(), andthis.repo.find(), which the kernel writes asrepo.find) are typed by the field, through outer types. A field whose declared type is outside the project now resolves as external instead of a guessed project member.Token.Tagresolve.type MatchPath []string) and promoted methods. True aliases and type parameters never rule a type out.Frameworks
[id]as:id, one route per exported method inroute.ts,pages/apiasANY; parallel and intercepting routes are skipped.navigatesedges to the page:router.push/replace/prefetch,redirect,NextResponse.redirect(new URL(..)), React Routernavigate/history.push, TanStacknavigate({ to }), and<Link href|to>,<NavLink>,<Navigate>,<LinkContainer>, internal<a href>. Conditional arms and a localconstdestination are read. A receiver-qualified Nextpushmust name a router, solist.push('/about')is not navigation (upstream takes it).middleware.ts/proxy.ts:config.matcheris compiled (parameters, groups, negative-lookahead exclusions) by a small matcher of its own, and every covered routecallsthe proxy entry.<Route>markup and route objects (nesting, index routes, layouts); TanStack Router file and code routes.@Resolver),@MessagePattern/@EventPattern,@SubscribeMessagewith the gateway namespace.router.route('/x').get(..).put(..)form, and cross-fileapp.use('/prefix', router)mounts, composed at link time for HTTP matching (route node names are unchanged).Dynamic and cross-boundary calls (synthesized passes over persisted sites)
callback: a registrar stores a callback in a field that a same-file dispatcher iterates.object-registry:handlers[action](..)through an object literal of functions.http-client:fetch, axios, ky, got, useSWR and client instances (with base URLs, also imported ones) → the one route serving the method and path.queue-job(Bull / BullMQ, Nest@Processor),event-bus(@OnEventglobs, sockets in both directions),celery-dispatch,spring-event.Engine
Validation
crates/cg-resolve/tests/upstream_parity.rs(10 end-to-end cases, each positive case with a negative twin) and unit tests for signature parsing, href and route matching, the proxy matcher and the scanners.crates/cg-sync/tests/incremental_parity.rsbuilds a fixture that draws every new edge kind, then applies 22 targeted one-sided edits and 80 random edits, comparing each sync with a full rebuild and requiring delta syncs.cargo fmt --checkon our crates andcargo clippy --workspace --exclude cg-kernel --all-targets -- -D warningspass. The vendored kernel is untouched.mainvs this branch on real repositories (index p50 of 7 runs, release builds):ReentrantLock/Map/StringBuilderreceivers matched to project methods); the other, a nested-type field receiver, is fixed in this branch. On caddy, sampled removed implementers had a different signature (TLS vs HTTP matchers) or came from methods of same-named types in other packages.Reviewer notes
GET /cart→/cart,[id]→:id) and reach their component withcallsinstead ofreferences.#argscandidate list (the kernel never gives calls candidates); only resolution reads it.string/number/boolean; a union still prefers its first non-primitive member.RouterModuleand global prefixes, React Router tables declared in another file, Go dispatch through promoted methods. README and quality-report docs are not updated.🤖 Generated with Claude Code