Skip to content

fix: add same-class bare-call fallback to incremental rebuild path#1886

Open
carlos-alm wants to merge 1 commit into
fix/issue-1764-computed-key-object-literalfrom
fix/issue-1765-incremental-same-class-barecall
Open

fix: add same-class bare-call fallback to incremental rebuild path#1886
carlos-alm wants to merge 1 commit into
fix/issue-1764-computed-key-object-literalfrom
fix/issue-1765-incremental-same-class-barecall

Conversation

@carlos-alm

Copy link
Copy Markdown
Contributor

Summary

  • applyThisReceiverFallbacks (renamed applyCallFallbacks, since it's no longer this-receiver-only) in incremental.ts only implemented two of the full-build path's fallback strategies (same-class this.method(), Object.defineProperty accessor). The full-build path's resolveSameClassBareCallFallback (a same-class bare-call fallback for class-scoped languages, e.g. C# static sibling calls) had no incremental-path counterpart.
  • Added the missing fallback, reusing the already-shared resolveSameClassQualifiedMethod/isModuleScopedLanguage from call-resolver.ts (no logic duplicated — isModuleScopedLanguage just needed to be added to the existing import list).

Transparency note: I could not reproduce an observable failure from the issue's own example. incremental.ts's primary resolution step already delegates to a shared function (resolveViaSameClassSibling) that implements an equivalent, strictly broader fallback (global-name lookup vs. this fix's same-file-only lookup) — so the new fallback can mathematically never resolve anything the primary pass didn't already resolve for well-formed inputs. Implemented anyway per the issue's explicit ask: it closes a genuine structural divergence between the two files and is provably harmless. The new test validates full-build/incremental parity (which holds both before and after) rather than a red→green bug transition.

Closes #1765

Test plan

  • npm test — full suite green (3535 passed, 0 failed)
  • npm run lint — clean
  • New parity test (C# Validators fixture matching the issue's exact example) confirmed passing on both wasm and native parsing engines, both before and after the change (see transparency note above)
  • Confirmed incremental.ts has a same-named Rust file (incremental.rs) but it only implements tree-sitter re-parse caching, zero call-resolution logic — no Rust changes needed

Stacked on #1885 (base branch fix/issue-1764-computed-key-object-literal) — only the incremental.ts/test diff is this issue's change.

…ocs check acknowledged)

incremental.ts's applyThisReceiverFallbacks (renamed applyCallFallbacks)
only implemented the this.method() and Object.defineProperty fallbacks,
missing the same-class bare-call fallback that the full-build path has
(resolveSameClassBareCallFallback in stages/build-edges.ts). For
class-scoped languages (non-JS/TS), a bare call with no receiver now
retries qualified as <CallerClass>.<callName> in the incremental path too,
guarded by isModuleScopedLanguage exactly as the full-build path is.

Reuses the already-shared resolveSameClassQualifiedMethod from
call-resolver.ts rather than duplicating its lookup logic.

Fixes #1765

Impact: 2 functions changed, 6 affected
@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds the missing same-class bare-call fallback (Strategy 2) to the incremental rebuild path in incremental.ts, closing a structural divergence from the full-build path's resolveSameClassBareCallFallback in build-edges.ts. The new strategy reuses the already-shared resolveSameClassQualifiedMethod and isModuleScopedLanguage helpers — no logic is duplicated. As the author notes, the primary resolution pass (resolveViaSameClassSibling) covers this case with a strictly broader lookup, so the fix is provably safe but cannot currently produce a new resolved edge.

  • incremental.ts: Renames applyThisReceiverFallbacksapplyCallFallbacks and inserts Strategy 2 between the existing this-receiver (S1) and Object.defineProperty (S3) strategies; the guard conditions are mutually exclusive, preserving fall-through correctness.
  • issue-1765-incremental-same-class-barecall.test.ts: Adds a full-build vs. incremental parity test using a C# Validators fixture on both the wasm and native parsing engines; test is green before and after the change by design (acknowledged in PR description).

Confidence Score: 5/5

The change is safe to merge — it adds a new fallback branch with guard conditions that are mutually exclusive with all existing strategies, and the shared helper it calls is already proven correct by the full-build path.

The new Strategy 2 guard is disjoint from all existing strategies, the implementation mirrors the full-build path exactly, and the parity test is well-structured.

No files require special attention.

Important Files Changed

Filename Overview
src/domain/graph/builder/incremental.ts Adds Strategy 2 (same-class bare-call fallback) and renames the fallback function; implementation correctly mirrors build-edges.ts with mutually exclusive guard conditions.
tests/integration/issue-1765-incremental-same-class-barecall.test.ts Parity test between full-build and incremental rebuild for a C# Validators fixture; correctly structured but cannot produce a red→green transition because the primary pass already covers the bare-call case.

Reviews (1): Last reviewed commit: "fix: add same-class bare-call fallback t..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Codegraph Impact Analysis

2 functions changed6 callers affected across 2 files

  • applyCallFallbacks in src/domain/graph/builder/incremental.ts:672 (5 transitive callers)
  • buildCallEdges in src/domain/graph/builder/incremental.ts:766 (5 transitive callers)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant