Skip to content

feat(resolver): resolve iteration-callback edges for for-of, Set, and Array.from (JS)#1397

Merged
carlos-alm merged 6 commits into
mainfrom
feat/iteration-callback-edges-1378
Jun 9, 2026
Merged

feat(resolver): resolve iteration-callback edges for for-of, Set, and Array.from (JS)#1397
carlos-alm merged 6 commits into
mainfrom
feat/iteration-callback-edges-1378

Conversation

@carlos-alm

Copy link
Copy Markdown
Contributor

Summary

  • Fixes the more1 jelly-micro benchmark from 0% → 100% recall (10/10 named edges)
  • The PTS resolution for for-of, Set+for-of, Array.from, and spread patterns was already fully implemented
  • The 0% recall was caused by a naming mismatch in the fixture: _iterPlain/_iterSet vs the expected-edges.json which referenced iterPlain/iterSet — renamed to align them

Patterns verified working

Pattern Mode Example
for (const f of arr) { f() } pts-for-of iterPlain → fn1, fn2
new Set(arr) + for-of pts-set iterSet → fn3, fn4
Array.from(arr, mapCallback) pts-array-from mapCallback → fn5, fn6
f(...arr) pts-spread consumer1 → fn7, fn8

Test plan

  • jelly-micro.test.ts: more1 → 10/10 recall (was 0/10)
  • All 6 jelly-micro tests at 100% recall (26/26 total named edges)
  • Main resolution-benchmark.test.ts: 171/171 pass (no regressions)

Closes #1378

… Array.from (JS)

Fixes more1 jelly-micro benchmark from 0% → 100% recall (10/10 named edges).

The PTS resolution for for-of, Set+for-of, Array.from, and spread patterns was
already fully implemented. The 0% recall was caused by a naming mismatch in the
fixture: _iterPlain/_iterSet (underscore-prefixed) vs the expected-edges.json
which referenced iterPlain/iterSet (without prefix). Renaming the fixture
functions to match the expected edges exposes all four PTS patterns resolving
correctly.

Closes #1378
@claude

claude Bot commented Jun 8, 2026

Copy link
Copy Markdown

Claude finished @carlos-alm's task —— View job


PR Review: feat(resolver): resolve iteration-callback edges for for-of, Set, and Array.from (JS)

Tasks:

  • Gather context
  • Read changed file and related fixtures
  • Analyze root cause
  • Assess backlog compliance
  • Post final review

Root Cause Analysis

Problem Being Solved: The more1 jelly-micro benchmark was reporting 0/10 recall because the fixture functions were named _iterPlain and _iterSet (with underscore prefix), but expected-edges.json referenced them as iterPlain and iterSet. The benchmark matched by symbol name, so no edges were ever found — not because the PTS resolution logic was broken, but because the fixture had a naming mismatch from the start.

Why This Approach: Renaming the fixture functions to align with expected-edges.json is the correct fix. The alternative — updating expected-edges.json to use the underscore-prefixed names — would leave fixture functions named inconsistently and could imply they are "private/internal" helpers when they're actually the test subjects. The PR author chose the right direction.

Risk Assessment: Very low. This is a test fixture rename in a benchmark subdirectory. It does not touch production code, the resolution engine, or any shared utilities. The only risk would be if something else depended on the _iterPlain/_iterSet names, but a quick check confirms these are standalone fixture functions not referenced anywhere else.


Backlog Compliance

  • Zero-dep: ✓ — No new runtime dependencies added
  • Foundation-aligned: ✓ — Pure fixture correction, no architecture concerns
  • Problem-fit: 4 — Directly improves benchmark accuracy, which validates the resolution logic that helps AI agents navigate codebases accurately
  • Breaking: No — Test fixture internal rename only; no API, CLI, or schema changes
  • Tier: 1

Code Review

The diff is exactly 2 lines: _iterPlainiterPlain and _iterSetiterSet in more1.js (lines 13 and 21). The expected-edges.json is unchanged and already correctly uses iterPlain/iterSet.

One minor observation worth noting: _runFrom and _runSpread (lines 33 and 48) still carry the underscore prefix, but they are not referenced in expected-edges.json either — they're just the harness functions that trigger the patterns under test (the edges flow through mapCallback, consumer1, consumer2 which are already correctly named). This is consistent and correct as-is.

No concerns with test integrity: no assertions were weakened, no expectations were lowered, and no production code was changed. This is a clean fixture correction.


Final Recommendation

  • Rating: ⭐⭐⭐⭐ (4/5)
  • Action: APPROVE
  • Reasoning: The change correctly identifies and fixes a naming mismatch that caused a false 0% recall in the benchmark. It fixes the fixture to match the spec (expected-edges.json), not the reverse. The resolution logic itself was already correct. The change is minimal, surgical, and risk-free.

@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a naming mismatch in the more1 jelly-micro benchmark fixture: _iterPlain and _iterSet (with underscore prefixes) did not match the iterPlain/iterSet names referenced in expected-edges.json, causing all 10 expected edges to go unmatched. Removing the underscore prefixes corrects the alignment and brings the benchmark to 100% recall.

  • Renames _iterPlainiterPlain and _iterSetiterSet in more1.js so the functions match the source names declared in expected-edges.json.
  • No resolver logic, test harness, or other fixtures are changed; the fix is purely a fixture naming correction.

Confidence Score: 5/5

Safe to merge — the change is a two-line rename in a test fixture with no impact on production code.

Only two function names are changed in a single benchmark fixture file. The fix directly and verifiably closes the gap between the fixture and its expected-edges definition. No resolver logic, test harness, or other benchmarks are touched.

No files require special attention.

Important Files Changed

Filename Overview
tests/benchmarks/resolution/fixtures/jelly-micro/more1/more1.js Renames _iterPlainiterPlain and _iterSetiterSet to align fixture function names with the expected-edges.json entries, fixing 0% recall for this benchmark.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["more1.js fixture\n(before PR)"] -->|"_iterPlain, _iterSet\n(underscore prefix)"| B["Resolver extracts\nfunction names"]
    B --> C["Compare vs expected-edges.json\n(iterPlain, iterSet)"]
    C -->|"Names don't match"| D["0 / 10 edges recalled\n0% recall"]

    E["more1.js fixture\n(after PR)"] -->|"iterPlain, iterSet\n(no underscore)"| F["Resolver extracts\nfunction names"]
    F --> G["Compare vs expected-edges.json\n(iterPlain, iterSet)"]
    G -->|"Names match"| H["10 / 10 edges recalled\n100% recall"]
Loading

Reviews (3): Last reviewed commit: "fix: sync with main (#1397)" | Re-trigger Greptile

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Codegraph Impact Analysis

2 functions changed0 callers affected across 0 files

  • iterPlain in tests/benchmarks/resolution/fixtures/jelly-micro/more1/more1.js:13 (0 transitive callers)
  • iterSet in tests/benchmarks/resolution/fixtures/jelly-micro/more1/more1.js:21 (0 transitive callers)

@carlos-alm

Copy link
Copy Markdown
Contributor Author

@greptileai

@carlos-alm carlos-alm merged commit 0754216 into main Jun 9, 2026
22 checks passed
@carlos-alm carlos-alm deleted the feat/iteration-callback-edges-1378 branch June 9, 2026 00:55
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(resolver): resolve iteration-callback edges for for-of, Set, and Array.from (JS)

1 participant