Skip to content

fix(typescript): resolve calls through destructured methods - #5612

Closed
rvitaliy wants to merge 3 commits into
Graphify-Labs:v8from
rvitaliy:fix/typescript-destructured-typed-methods
Closed

rvitaliy wants to merge 3 commits into
Graphify-Labs:v8from
rvitaliy:fix/typescript-destructured-typed-methods

Conversation

@rvitaliy

@rvitaliy rvitaliy commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Resolve calls through a local immutable destructuring binding such as const { retire: finish } = owner; finish(). The receiver is an explicitly typed, required TypeScript parameter. The existing typed receiver resolver links the original call site to the declared member with INFERRED confidence.

Closes #5611. Related to #5586 and #5530.

Type of change

  • Bug fix

Verification & Invariants

  • Simple shorthand and renamed bindings keep the original call location and lexical caller, including inside a closure.
  • Resolution requires a unique, directly declared required callable on a non-generic, named interface or object alias. Optional members, accessors, ambiguous types, mutable bindings and unsupported patterns stay unresolved.
  • Extract and watch can reuse the required-member facts from the saved graph after a caller-only edit. AST cache schema 60 refreshes cached embedded TypeScript. Force a rebuild after upgrading to populate the new facts in an existing graph.
  • Verified the two missing calls in the real Booking Engine owner.

How was this tested?

  • Three regression cases fail on v8 and pass with the fix. The focused TypeScript, JS member and Astro suites passed on Python 3.14 (124 tests), and the typed receiver suite passed on Python 3.11 (21 tests).
  • Full Python 3.14 suite split across xdist (12,077 passed), the two worker-sensitive files without xdist (93 passed), and the serial group (282 passed).
  • ruff check ., git diff --check, and graphify update . passed. Pyright adds no diagnostics relative to v8.

Graphify-specific checklist

  • Verified lexical ownership, determinism, and incremental graph metadata.
  • Reviewed the diff for credentials and generated graph files.
  • Disclosed AI assistance in the commit trailer.

Review follow-up

Check writes through var loop targets and erased TypeScript syntax around assignment targets and property receivers. The const destructuring declaration itself remains a lexical declaration. Shadowed loop bindings retain valid inferred calls.

The updated branch passed 81 targeted tests on Python 3.14 and the nine reassignment and shadowing cases on Python 3.13. The full Python 3.14 suite passed with 12,461 tests across the parallel and serial groups. Ruff and graphify update . passed. Pyright matches the v8 baseline.

Merged interface follow-up

Resolve destructured methods declared across interface blocks with the same name and module scope. The saved provider facts retain only unique required methods and identify their original declaration, so a nested interface with the same name cannot supply a call target. The regression cases also cover imports through a re-export, caller-only updates, overloads, and literal member names.

Six regressions fail on the previous PR head and pass with this patch. The full Python 3.14 suite passed (12,467 tests), along with 116 focused tests on Python 3.14 and 36 each on Python 3.11 and 3.13. Ruff and graphify update . passed. Pyright diagnostics match the v8 baseline.

Addresses the merged-interface review.

@rvitaliy
rvitaliy requested a review from safishamsi as a code owner November 28, 2026 23:28
@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @rvitaliy. A maintainer will review it soon.

Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions.

A couple of things that speed up review: make sure the test suite passes on Python 3.11 and 3.13, and that the change keeps extraction deterministic.

@github-actions github-actions Bot added the contributor Pull request from a returning community contributor label Nov 28, 2026

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify review View in Graphify

Nothing blocking · 3 possible issues to check · Merge confidence 5/5

3 possible issues to check · High impact

The change tracks typed methods pulled from object destructuring, then resolves calls through those local bindings.

3 possible issues we couldn't confirm

They don't change the score.

What this review covered
  • We didn't review 1 file that isn't source code, such as docs, config, images, or generated or third-party code.
  • A changed file's diff was too long to show in full, so the review may not have seen every changed line in it.
  • 6 of 6 changed files inspected. This is scope, not a correctness guarantee.
Code graph · 6864 functions depend on this change
  • 5 functions became more coupled. Largest: main() (137 callers), _extract_generic() (23 callers), _js_receiver_binding_scope() (4 callers).
  • 658 of 658 test files are affected by this change.
  • Gate, test list and every flagged function: in the Graphify check.

Reviewed 7c6ad72 · 8 earlier findings not re-checked

Comment thread graphify/extractors/engine.py Resolved
Comment thread graphify/extractors/engine.py Resolved
safishamsi added a commit that referenced this pull request Nov 30, 2026
Extractor accuracy (Swift #5641, Apex #5627, Python #5647, TypeScript
#5604/#5614/#5612, Bash caller-var #5602), GitHub Actions run-step
extraction (#5603), incremental correctness (#5634/#5638/#5636), symlink
and semantic-cache fixes (#5617/#5618), export/report hardening and perf
(#5643/#5644/#5645/#5646/#5619/#5620/#5621), and CLI/docs/skill/install
work (#5629/#5628/#5626/#5624/#5623/#5625/#5642/#5583). AST cache schema
59 to 60; Swift/Apex/Python/Bash/GHA inputs re-extract on first build.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@safishamsi

Copy link
Copy Markdown
Member

Landed in v0.9.124 (just released to PyPI), cherry-picked with your authorship preserved so it shows under your name in the history. Thanks @rvitaliy for resolving calls through destructured methods — verified green in the full suite and, where applicable, smoke-tested against the published package. 🙏

@safishamsi safishamsi closed this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor Pull request from a returning community contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: TypeScript calls through destructured methods of typed parameters are missing

2 participants