Skip to content

fix(typescript): resolve calls through typed property aliases - #5530

Closed
rvitaliy wants to merge 1 commit into
Graphify-Labs:v8from
rvitaliy:fix/typescript-typed-property-receiver
Closed

rvitaliy wants to merge 1 commit into
Graphify-Labs:v8from
rvitaliy:fix/typescript-typed-property-receiver

Conversation

@rvitaliy

Copy link
Copy Markdown
Contributor

What does this PR do?

Resolve calls through a local const initialized from one explicitly typed parameter property, such as const authority = ports.authority. Follow the lexical binding at the call and at the initializer, including through closures. Use the declared property type and its exact method to add an INFERRED edge.

In our offboarding factory this recovers calls to the authority's inspect, redeem, and recheck contract methods. The same method declarations were already present in the base graph.

On a 102-file TypeScript sample containing that factory, a cold extraction preserved all 1,893 nodes and 6,227 existing edges and added those three calls.

Verification & Invariants

  • A regression test covers inline annotations, unshadowed Readonly, and a simple same-file object type alias. The same cases run with unchanged contract files supplied as incremental resolver context.
  • Separate tests cover shadowing, precedence over file-wide hints, and omission of unresolved or unsupported cases. The new rule requires a same-file type or a named import and avoids fallback by method name.
  • The rule covers a single property read into a local const. It leaves destructuring, chained properties, and complex type expressions to future work. AST cache schema 58 retires old receiver facts.

How was this tested?

uv run --frozen pytest tests/ -q --tb=short -n 6 -m 'not serial'
uv run --frozen pytest tests/ -q --tb=short -m serial
uv run --frozen ruff check .
uv run --frozen pyright --outputjson
uv run --frozen graphify update . --no-cluster

The minimal CLI reproduction in the issue resolves both the directly annotated receiver and its property-alias counterpart on this branch.

Pyright reports the same 782 diagnostics on the base and on this branch.

Fixes #5529

Follow the lexical receiver binding to the declared parameter property type and verify the exact method owner before adding the call edge.

Fixes Graphify-Labs#5529

Co-authored-by: Codex <[email protected]>
@rvitaliy
rvitaliy requested a review from safishamsi as a code owner November 26, 2026 23:28
@github-actions github-actions Bot added the contributor Pull request from a returning community contributor label Nov 26, 2026
@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.

@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

This change adds call resolution for TypeScript aliases initialized from explicitly typed object properties.

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.
  • 4 of 4 changed files inspected. This is scope, not a correctness guarantee.
Code graph · 6258 functions depend on this change
  • 3 functions became more coupled. extract() (1395 callers), _js_receiver_binding_scope() (3 callers), walk_calls() (1 callers).
  • 643 of 643 test files are affected by this change.
  • Gate, test list and every flagged function: in the Graphify check.

Reviewed 85252f3

@safishamsi

Copy link
Copy Markdown
Member

Shipped in v0.9.122, landed via authorship-preserving cherry-pick so your commits keep your name. Thanks @rvitaliy!

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]: Calls through TypeScript aliases of typed parameter properties are missing

2 participants