redhat-et / redhat-et/ripwire

TypeScript: built-in member calls resolve to unrelated functions with the same name

Open
#59 3 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
C++
Stars
2.1k
Forks
125
Avg merge
5h 42m
Merged PRs (30d)
136

Description

Ripwire links `String.replace` and `Array.map` calls to unrelated functions that the calling file does not import.
The result reports zero ambiguous calls and lists both functions as callees.

Environment:

- Ripwire 0.5.0, release binary, `built_from=bacfa3b7b`.
- macOS ARM64, AppleClang 15.0.0.15000309 release build.
- Node.js v26.8.1 for runtime checks.
- Each example uses a new temporary directory and `--no-cache`.

Reproduce:

```sh
mkdir -p src
cat > src/bounded.ts <<'EOF'
export function bounded(text: string): string {
return text.replace(/x/g, "").split(" ").map(part => part.trim()).join(" ");
}
EOF
cat > src/unrelated.ts <<'EOF'
export function map(value: number): number { throw new Error("unrelated map was called"); }
export function replace(value: number): number { throw new Error("unrelated replace was called"); }
EOF
ripwire . --no-cache --callees=src/bounded.ts:bounded
```

Actual output, with the explanatory XML comments removed:

```xml


```

The command exits zero. `--expand=src/bounded.ts:bounded --top-k=0` also includes these functions in its callee signatures.

Runtime control:

```sh
node --experimental-strip-types --input-type=module -e 'import "./src/unrelated.ts"; import { bounded } from "./src/bounded.ts"; console.log(JSON.stringify(bounded("x value")));'
```

This prints `" value"` and exits zero. Neither throwing function runs.

Expected behavior:

Do not resolve these built-in member calls to unrelated top-level exports.
Leave the targets external or unresolved when the receiver cannot be proved.

The legend discloses name-based extraction and missing edges. This example adds false edges rather than omitting real edges.
The false links affect dependency inspection and can direct an agent to unrelated implementation code.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with src/bounded.ts and src/unrelated.ts using ripwire . --no-cache --callees=src/bounded.ts:bounded, then inspect the callee-resolution path for TypeScript member calls. Done means unrelated top-level map and replace exports are no longer reported as callees when the receiver cannot be proved, while the command and runtime control continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.