fix(extraction): a TS/JS call through a host-global chain emits no ref (#1707) - #1766
Merged
Merged
Conversation
#1707) `chrome.storage.local.get(key)` and `document.body.querySelector(s)` end in a platform API, but the extractor emitted the bare method name for them. That name then exact-matched whatever project symbol shared it: in a Chrome extension every `chrome.storage.local.get/set` inside a storage wrapper bound to the wrapper's own `get`/`set`, giving self-edges that are not in the source (#1707). A member chain whose root identifier is a host object the project never declares now emits nothing — a silent miss instead of a wrong edge, the same trade the literal-receiver gate makes (#1230). `window` is deliberately not a host root: `window.MyNs.doThing()` reaches a project symbol. A chain rooted at a project value keeps the bare name, so `store.getState().act()`, `ref.value .m()` and `this.<field>.m()` are untouched. The Rust kernel mirrors the same gate. Verified on Linux: fail→pass on both kernel and wasm arms for `__tests__/ts-chained-receiver.test.ts` (2 fail / 1 pass on main → 3/3 with the fix). Lands / rebases #1710 onto current main. Co-authored-by: Aaron Queen <bompus@users.noreply.github.com>
This was referenced Sep 8, 2026
bompus
added a commit
to bompus/codegraph
that referenced
this pull request
Sep 8, 2026
Upstream re-landed four of the fork's changes under its own commits today (colbymchenry#1697 directly; colbymchenry#1766, colbymchenry#1767, colbymchenry#1769 rebased from the closed colbymchenry#1710, colbymchenry#1706, colbymchenry#1695), so the fork carried a second copy of each and the hourly sync stopped with nine conflicts. Upstream's version wins wherever it now owns the change. take upstream, drop the fork's duplicate: src/bin/codegraph.ts capPromptHookInjection() supersedes the inline MAX = 9000 the fork carried from colbymchenry#1695. src/extraction/tree-sitter.ts CommonJS export assignment support (colbymchenry#1675); the fork had no version of it. src/resolution/name-matcher.ts comment-only conflict; upstream's text already covers colbymchenry#1745, colbymchenry#1719, colbymchenry#1714, colbymchenry#1230, colbymchenry#1708 and colbymchenry#1709. keep the fork's version, upstream has none: src/mcp/tools.ts the codegraph_sessions tool definition (colbymchenry#1702). README.md documents that alwaysLoad also covers codegraph_sessions. __tests__/fixtures/kernel-parity/torture.tsx markdown-path fixture. union, upstream entry first: CHANGELOG.md per UNION_MERGE_FILES. __tests__/fixtures/kernel-parity/torture.js the fork's colbymchenry#693 initializer walks and upstream's colbymchenry#1675 CommonJS exports are different fixtures at the same point in the file. __tests__/fuzzy-lexical-reach.test.ts add/add: both sides created it. Upstream's C-nesting test plus the fork's two sealed-module tests, with the one test both sides wrote kept once. Verified on Windows against a release build of the kernel: tsc --noEmit clean, npm run build clean (engine, UI, 29 wasm grammars), full native suite 4438 passed of 4483. The single failure is a refresh-launcher timeout that passes in 2.7s when the file is run on its own.
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.
Summary
main).chrome,document,process,Math, …), emit no ref instead of the bare method name — sochrome.storage.local.get/document.body.querySelectorno longer exact-match unrelated project symbols.windowis intentionally not a host root (window.MyNs.doThing()stays resolvable). Project-rooted chains keep the bare-name fallback.src/extraction/tree-sitter.tsandcodegraph-kernel/src/tsjs/extractors.rs.__tests__/ts-chained-receiver.test.ts.Credit: @bompus authored the original fix in #1710; this PR rebases it onto latest
mainand verifies the Rust kernel on Linux.Scope left open
this.map.get(k)androws[0].text()still bare-name match — those need receiver typing (#1496 / #1691), not this host-global gate.Test plan
main:__tests__/ts-chained-receiver.test.ts→ 2 failed / 1 passed on both kernel andCODEGRAPH_KERNEL=0(wasm).scripts/build-kernel.sh: 3/3 pass on kernel and wasm.__tests__/nextjs.test.ts(36),__tests__/react-native-bridge.test.ts(24) pass.__tests__/object-literal-methods.test.tsfailure is pre-existing on main, not introduced here.Fixes #1707
Supersedes #1710