Skip to content

TypeScript: split() on an awaited Promise<string> result resolves to an unrelated class method (v1.6.0) #1840

Closed

Description

@yaoguohh

Summary

With CodeGraph 1.6.0 and a fresh two-file TypeScript index, calling split() on the awaited result of a function explicitly returning Promise<string> creates a false call edge to an unrelated project class's split() method.

The unrelated class is not imported or instantiated by the caller. The incorrect edge is persisted in SQLite, so this is not just a display problem.

Environment

  • CodeGraph CLI: 1.6.0
  • macOS, Apple Silicon
  • Fresh codegraph init --yes . index; 2 TypeScript files, 6 nodes, 6 edges
  • Reproduced independently of the original project

Minimal reproduction

Create an empty directory containing these two files.

strings.ts:

export async function listPaths(): Promise<string> { return "a\0b"; }
export async function snapshot(): Promise<string[]> {
  const listed = await listPaths();
  return listed.split('\0');
}

pane.ts:

export class PaneManager {
  split(): string { return "new pane"; }
}

Run:

codegraph init --yes .
codegraph node snapshot --file strings.ts

Actual result

Calls → listPaths (strings.ts:1), split (pane.ts:2)

The persisted calls edge has:

{
  "caller": "snapshot",
  "source": "strings.ts",
  "callee": "PaneManager::split",
  "target": "pane.ts",
  "line": 4,
  "metadata": {
    "confidence": 0.7,
    "resolvedBy": "instance-method",
    "refName": "listed.split"
  }
}

Expected result

Keep the real snapshot → listPaths edge. Do not create snapshot → PaneManager::split: listed is a string, and this call invokes the built-in string method.

If the resolver cannot infer the awaited return type, leaving this member call unresolved is preferable to asserting a call into an unrelated class. Actual calls on a PaneManager receiver should still resolve normally.

Impact and related work

This gives callers/callees and downstream dependency or impact analysis a nonexistent relationship. I initially encountered it while inspecting a filesystem snapshot function, which appeared to call an unrelated terminal-pane splitting method.

Related: #1566 and its fix #1790 address built-in collection calls resolving to project methods. This report provides a fresh-index reproduction involving an awaited Promise<string> return value. I have not tested this fixture against current main, so I am not claiming the earlier fix regressed. #1794 also highlights why broadly suppressing project receiver calls would be undesirable.

Activity

  1. added a commit that references this issue on Sep 16, 2026
    d0996a2
  2. colbymchenry commented on Sep 16, 2026

    @colbymchenry
    Owner

    Fixed in #1885 (merged as d0996a2), incorporating @maxmilian's work from #1855 with additional scope/import and edit/sync guards. Your original two-file reproduction now keeps snapshot → listPaths without the false PaneManager::split edge on both native and WASM indexing. Valid awaited project-type method calls are covered as well. This will be included in the next release.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions