Skip to content

fix(bridge): honor allowEdits in source-file skeleton line helpers - #81

Open
KazariAI wants to merge 2 commits into
johnsoncodehk:masterfrom
KazariAI:fix/gtd-declmap-allowedits
Open

KazariAI wants to merge 2 commits into
johnsoncodehk:masterfrom
KazariAI:fix/gtd-declmap-allowedits

Conversation

@KazariAI

@KazariAI KazariAI commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

The tsserver declaration-map remapper decodes every mapping with getPositionOfLineAndCharacter(..., allowEdits=true). TNB's host-side SourceFile skeletons dropped that argument, so stale declaration-map coordinates hit Debug.assert and the whole definition request failed.


This pull request was created with assistance from a code agent.

tsserver remaps definitions through declaration maps (session
mapDefinitionInfoLocations -> documentPositionMapper), and that decoder calls
getPositionOfLineAndCharacter(..., allowEdits=true) for EVERY mapping in the
map, clamping stale coordinates — real packages ship them (unified@11.0.5's
index.d.ts.map has generated 846:313 on a 301-char line). The host-side
SourceFile skeletons dropped the allowEdits argument, so stock's clamping
call took the strict path, hit Debug.assert, and the whole definition request
failed: goto definition on an import of such a package resolved to nothing
while quickinfo still worked.

Forward (line, character, allowEdits?) in all three skeletons
(createSharedLightStub, installLazyLineHelpers, patchLineHelpers), matching
the stock SourceFileLike contract; non-allowEdits callers keep the strict
behavior.

Witness triage-gtd-declmap-allowedits drives the pinned unified@11.0.5
reproduction through both engines (pre-fix TNB fails the request with the
Debug assert; post-fix lands at unified/lib/index.js like stock), wired wg5.
The unified@11.0.5 npm install was the witness's only dependency and
most of its runtime (~4s of ~6s), and its pass depended on upstream
package content staying stale. A synthesized fake-unified package
reproduces the three conditions by construction (exports→js resolution
leaving the d.ts a light stub, an out-of-range mapping, a sourceMappingURL
comment), so the witness needs no npm or network, runs in ~1.5s, and
cannot silently degrade if upstream fixes their map.
@KazariAI KazariAI changed the title fix(bridge): honor allowEdits in source-file skeleton line helpers fix(bridge): honor allowEdits in source-file skeleton line helpers Oct 9, 2026
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