JS/TS: an import naming a file extension ('./x.mjs') loses the call bind of a const-arrow export #542
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
h-dv/code-index#542
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
In JS/TS, an import whose specifier names a file extension loses the call bind of a
const-arrow export. Node ESM requires the extension, andexport const f = () =>is the dominant modern style.Fixture (
lang-out/javascript/fixture2, verified by hand):fixture4: the extensionless'./shapes'resolves (tier1b_same_directory), and'./shapes.js'does not.fixture5: ESM importing from a CommonJS file (import {runIt} from '../a/lib.js') also stays name_fallback.Likely cause
Verified: the candidate query in
crates/indexer/src/index/import_bindings.rs:115(prepare) admits onlys.kind='function' AND s.parent_id IS NULL AND … AND s.is_named_export=1.Inferred, not yet verified: the later step (
finish) clears any prior bind of a call that has an import-binding row unless that strict candidate matched. So aconstexport never qualifies, and the bind another tier made is removed. This probably arrived with #510 (configured imports / named-export proof).Proposal
finishmay clear only binds that contradict a proven route. When no candidate qualified, the earlier bind stays.const/staticsymbols whose initializer is a function or arrow as callable named exports.Acceptance
Severity: high. This is a recall regression that removes correct binds, on the module style Node requires.
Filed from the per-language review on 2026-11-09: 8 agents, one per language plus one for Vue/Svelte/XAML/timeline, run against copies of the pinned corpus repos (
tests/corpus/corpus.toml) using installed build2dcfc615, which differs from master only by XAML/CI commits. The top claim of every issue was spot-checked in the main session. Artifacts live under the review session's scratchpadlang-out/<lang>/and are available on request.Consolidated into #543 during the 2026-11-09 triage. The remaining scope of this issue is tracked there as a checklist item; this report stays as the detailed evidence.