Skip to content

Type number-or-string DAP ids as Int64 - #142

Merged
davidanthoff merged 1 commit into
mainfrom
agents/c61-protocol-int64-ids
Oct 5, 2026
Merged

davidanthoff merged 1 commit into
mainfrom
agents/c61-protocol-int64-ids

Conversation

@davidanthoff

@davidanthoff davidanthoff commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

This PR was opened by Claude (Claude Code) on David's behalf.

What

DAModule.id and StackFrame.moduleId are Union{Int,String} / Union{Missing,Int,String}. On 32-bit Julia that is Int32, but JSON numbers always parse as Int64. For a union that isn't just Missing plus one type, @dict_readable's field_type gives Any, so the value is passed through unconverted. The default constructor's convert(Union{Int32,String}, ::Int64) then throws a MethodError. This is the same shape as JSONRPC.jl#127 (julia-vscode#4260).

This PR changes both fields to Int64.

Impact

Latent: nothing that happens today can trigger it. Neither type can be reached from any registered request or event's parameter type. The adapter only ever sends StackFrame, always with moduleId = missing, and nothing uses DAModule. That is consistent with this never showing up in crash telemetry.

I also checked the plain-Int fields that are read from client messages: threadId, frameId, variablesReference, sourceReference, targetId, line/column, and paging start/count.

  • They do throw InexactError at 2^31 and above on 32-bit.
  • But every one of them is either an id the adapter minted, which stays small, or an editor position.
  • So they are left alone.

Tests

Two new test items in test/test_json_serialization.jl:

  • Targeted test: builds both types from _parse_json output with numeric and string ids. It also checks the declared field types, so it means something on 64-bit legs as well.
  • Guard: walks every Outbound type and requires each integer-bearing field to accept an Int64. It catches future Union{Int,String}-style fields, but only bites on the ~x86 legs.

Local runs:

Julia Before the fix With the fix
1.12.7 x86 3 failures + 1 error (the MethodError) 191/191 pass
1.12.7 x64 — 191/191 pass
1.0.5 x64 (fresh copy, no Manifest) — 188/188 pass

Checklist

  • End-user documentation check: none needed.
  • Changelog mention: none, because there's no user-visible change, so there's no julia-vscode changelog PR.

🤖 Generated with Claude Code

`DAModule.id` and `StackFrame.moduleId` were `Union{Int,String}`. The
dict constructor passes such a union field through unconverted, and JSON
numbers parse as `Int64`, which does not convert to `Union{Int32,String}`
on 32-bit Julia. Neither type is ever read from a client message, so this
was latent, but it is the same shape as JSONRPC.jl#127.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davidanthoff
davidanthoff merged commit a39a4bc into main Oct 5, 2026
236 of 237 checks passed
@davidanthoff
davidanthoff deleted the agents/c61-protocol-int64-ids branch October 5, 2026 00:23
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