Skip to content

fix(extraction): index TypeScript interface members (#1638) - #1780

Merged
colbymchenry merged 1 commit into
mainfrom
forge/fix-1638-ts-interface-members
Sep 8, 2026
Merged

colbymchenry merged 1 commit into
mainfrom
forge/fix-1638-ts-interface-members

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

Summary

Linux verify (fail → pass)

Fixture from the issue (api.d.ts with PlatformContext + 2 methods + 1 property):

before (main) after
codegraph init 2 nodes, 1 edges 5 nodes, 4 edges
kind:method / kind:property empty 2 methods + tenantId
node deleteQueueCustomAck / tenantId Symbol not found found; members contains-linked to the interface

Focused suites: explore-declaration-only 12/12, extraction interface-member case pass, kernel-tsjs-parity 17/17 (earlier run). The store-actions e2e in object-literal-methods already fails on clean main (destructured loginFlow callers); not a regression from this land.

Test plan

  • Repro fail on Linux main, pass on this branch
  • Rebuild kernel (linux-x64) + tsc / copy-assets
  • CG-28 / explore-declaration-only green
  • Klaus: merge when ready

Land upstream #1686 (maxmilian + bompus kernel/CG-28 follow-ups)
onto current main. tree-sitter-typescript interface members
(method_signature / property_signature) were never listed in the
TS extractor, so platform .d.ts APIs had no declaration nodes for
call edges. Mirrors on the Rust kernel path; keeps CG-28 damping
for pure-interface declaration files; filters damped files from
the explore RWR seed set.
@colbymchenry
colbymchenry merged commit ee83636 into main Sep 8, 2026
@colbymchenry
colbymchenry deleted the forge/fix-1638-ts-interface-members branch September 8, 2026 16:27
Dshuishui added a commit to Dshuishui/codegraph that referenced this pull request Sep 14, 2026
…nry#1784)

`extension_type_declaration` appears in none of the three places Dart's other
type-like declarations do. `extension_declaration` — the older `extension` — is
in all three, and the two names are near neighbours.

That is why colbymchenry#1780's `isInsideClassLikeNode()` gate dropped these members and no
others: the gate asks whether a class-like node is on the stack, and an
`extension type` never put one there, while `extension`, `mixin` and `class`
all did. The gate surfaced the omission rather than causing it. Before it, the
members were still reached — but as top-level `function:km` rather than
`method:MetersT::km`, indexed and attributed to nothing.

The kernel omits the same node type, so it walks the members through its own
fallback and mints them as top-level functions with no `MetersT` to belong to.
`kernel-dart-parity.test.ts` fails four cases on `main` because of it; fixing
only the wasm side would leave those red.

Listing it alongside the others is the whole fix — `extraClassNodeTypes` and
`dartEnclosingTypeName` on the wasm side, the two `matches!` arms on the
kernel's. Both paths now give:

    class:MetersT · method:MetersT::km · method:MetersT::report

with `report`'s span running to its closing brace rather than stopping at the
signature line, and an ordinary class untouched.
Dshuishui added a commit to Dshuishui/codegraph that referenced this pull request Sep 14, 2026
…nry#1784)

`extension_type_declaration` appears in none of the three places Dart's other
type-like declarations do. `extension_declaration` — the older `extension` — is
in all three, and the two names are near neighbours.

That is why colbymchenry#1780's `isInsideClassLikeNode()` gate dropped these members and no
others: the gate asks whether a class-like node is on the stack, and an
`extension type` never put one there, while `extension`, `mixin` and `class`
all did. The gate surfaced the omission rather than causing it. Before it, the
members were still reached — but as top-level `function:km` rather than
`method:MetersT::km`, indexed and attributed to nothing.

The kernel omits the same node type, so it walks the members through its own
fallback and mints them as top-level functions with no `MetersT` to belong to.
`kernel-dart-parity.test.ts` fails four cases on `main` because of it; fixing
only the wasm side would leave those red.

Listing it alongside the others is the whole fix — `extraClassNodeTypes` and
`dartEnclosingTypeName` on the wasm side, the two `matches!` arms on the
kernel's. Both paths now give:

    class:MetersT · method:MetersT::km · method:MetersT::report

with `report`'s span running to its closing brace rather than stopping at the
signature line, and an ordinary class untouched.
Dshuishui added a commit to Dshuishui/codegraph that referenced this pull request Sep 15, 2026
…nry#1784)

`extension_type_declaration` appears in none of the three places Dart's other
type-like declarations do. `extension_declaration` — the older `extension` — is
in all three, and the two names are near neighbours.

That is why colbymchenry#1780's `isInsideClassLikeNode()` gate dropped these members and no
others: the gate asks whether a class-like node is on the stack, and an
`extension type` never put one there, while `extension`, `mixin` and `class`
all did. The gate surfaced the omission rather than causing it. Before it, the
members were still reached — but as top-level `function:km` rather than
`method:MetersT::km`, indexed and attributed to nothing.

The kernel omits the same node type, so it walks the members through its own
fallback and mints them as top-level functions with no `MetersT` to belong to.
`kernel-dart-parity.test.ts` fails four cases on `main` because of it; fixing
only the wasm side would leave those red.

Listing it alongside the others is the whole fix — `extraClassNodeTypes` and
`dartEnclosingTypeName` on the wasm side, the two `matches!` arms on the
kernel's. Both paths now give:

    class:MetersT · method:MetersT::km · method:MetersT::report

with `report`'s span running to its closing brace rather than stopping at the
signature line, and an ordinary class untouched.
inth3shadows added a commit to inth3shadows/codegraph that referenced this pull request Sep 23, 2026
…ymchenry#1784)

Dart spells an ordinary implemented method `method_signature` — the same node
type TypeScript uses for a bodiless interface member. colbymchenry#1780 gated that node
type behind isInsideClassLikeNode() to stop a TS interface member minting a
phantom free function. Correct for TS, but a Dart 3 `extension type` body was
not class-like, so every member in one failed the gate and was dropped.

The declaration itself was missing too, not only its members: on main,

  extension type Meters(double value) {
    double get km => value / 1000;
    void show() { print(km); }
  }

extracts `function:show` alone — no `Meters`, no `km`. So `extension type` was
never a class-like node in the first place; colbymchenry#1780 only made the omission
visible by making the members depend on it.

Adding `extension_type_declaration` to Dart's extraClassNodeTypes fixes both
halves at once, and gives the members the right owner: `method:Meters::km`
rather than a loose top-level `km`.

MIRRORED INTO THE KERNEL. Dart is default-routed to the native kernel, so a
change made only in the TypeScript arm would not run in a published bundle —
and here the two arms had already diverged: the kernel still emitted
`function:km` while wasm emitted nothing, which is why kernel-dart-parity is
RED on main today. dart.rs listed the class-like node types in two places
(enclosing_type_name and the extract dispatch); both now include it.

That parity suite is the regression pin this already had — it just never runs
without a staged .node, since every kernel-*-parity suite describe.skipIf's
itself. From source `npm test` reports 188 skipped; after build-kernel.sh, 10.

Verified (Linux, Node 22.23.2, kernel built and staged):

  kernel-dart-parity            18/18   (4 of these fail on main)
  dart-extension-type            2/2    (new; both fail without the change)
  tsc --noEmit                  clean
  npm test                      252 files, 4373 passed, 3 failed

The 3 remaining failures — object-literal-methods and two in ui-steps-api —
reproduce on a clean upstream/main worktree and are unrelated.

Thanks to the reporter for the diagnosis; this is their suggested option 2,
now measured, plus the kernel half.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant