The debugger service URN embeds device_id verbatim while every other id lookup folds case, so two spellings of one UDID open two debugger sessions

Open Beginner friendly
#910 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
devtools

Research direction

Start at packages/tool-server/src/tools/debugger/debugger-service-ref.ts:89 and compare its device ID handling with device-alias.ts, device-services.ts, and reaped-sessions.ts. Reproduce the two casing variants through the breadcrumb store, then verify they produce one debugger service identity rather than duplicate sessions and that the existing reaped-sessions.test.ts behavior remains intact.

Written by the indexing model from the issue text.

Description

b:minor bug

[Diplomat, Opus 5]: debuggerServiceRef builds the URN from the raw string:

// packages/tool-server/src/tools/debugger/debugger-service-ref.ts:89
return `JsRuntimeDebugger:${params.port}:${deviceId}`;

Every other place that looks a device id up folds case first:

  • device-alias.ts:86,92,97logicalKeyedConnectIds add/has/delete all .toLowerCase()
  • device-services.ts:213,215deviceIdOwningUrn lowercases both sides, with a written rationale
  • reaped-sessions.ts:87key() lowercases, pinned by reaped-sessions.test.ts:40 ("iOS UDIDs come back uppercase from simctl and lowercase from some tool args, and every id lookup in the stop tools already compares case-insensitively")

So 6DBF83B4-… and 6dbf83b4-… are one device to the alias map, the teardown scoper and the breadcrumb store, and two devices to the registry. selectTarget compares with === (target-selection.ts:54) but falls through to the single-device fallback, so both spellings resolve to the same target and each mints its own JsRuntimeDebugger node — a second CDP socket to Metro, a second bound loopback console-log server, and a second log file, all for one device. On Metro that also evicts the first session, since its inspector proxy allows one debugger per device (#909).

The two conventions meet in the breadcrumb store: one folded slot serves two unfolded sessions, so a record filed by the second spelling's session is what the first spelling's reader gets. Reproducible directly against the store — record 6DBF83B4-… with keptAt=P1, then 6dbf83b4-… with keptAt=P2: the supersede path unlinks P1 and a read under the upper spelling returns a note naming P2.

Folding in the URN builder looks like the consistent fix — it is the one holdout, and a device id is not case-sensitive on any platform argent supports (simctl UDIDs, adb serials, chromium-cdp-<port>).

Not caused by #705: debugger-service-ref.ts:89 is unchanged by it. Found while reviewing it — that PR's breadcrumb store is where the asymmetry becomes observable, but the duplicate sessions predate it.

Dominant language
TypeScript
Stars
2.9k
Forks
118
Avg merge
1d 19h
Merged PRs (30d)
93

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from software-mansion/argent

All issues in software-mansion/argent

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.