Skip to content

fix(#5863): decouple @props type hint emission from includeMetadata in map2json - #5952

Closed
waterWang wants to merge 2 commits into
ArcadeData:mainfrom
waterWang:fix/props-typehint-ws-leak-5863
Closed

waterWang wants to merge 2 commits into
ArcadeData:mainfrom
waterWang:fix/props-typehint-ws-leak-5863

Conversation

@waterWang

Copy link
Copy Markdown
Contributor

Description

Follow-up to #5812 / #5860. map2json was using the includeMetadata parameter to decide whether to emit the @props per-column JSON type-hint string. This bundled @props into every toJSON(true) call, including the WebSocketEventBus/ChangeEvent broadcast path where no consumer can opt in to receiving it.

The WebSocketEventBus calls record.toJSON(true) once per change event and broadcasts the resulting JSON string to every connected subscriber. There is no per-subscriber request to key an opt-in off of, so today every subscriber gets @props on any property whose type is lossy through JSON (SHORT, FLOAT, LONG, temporals, ...) and isn't declared in the schema.

Fix

Decouple @props emission from includeMetadata in map2json, mirroring the #5860 fix for serializeResult:

  • map2json now uses the serializer-level includeTypeHints field (off by default) instead of the includeMetadata parameter to decide whether to emit @props.
  • includeMetadata keeps its original meaning: "include @rid/@type/@cat/@in/@out" identity metadata only.
  • The @props hint is now emitted only when the caller explicitly enables it via JsonSerializer.setIncludeTypeHints(true).

Behavior

  • ChangeEvent.toJSON() (WebSocket fan-out) no longer emits @props — a WS subscriber has no way to request it.
  • Embedded-API callers of document.toJSON(true) no longer get an unexpected @props field mixed in.
  • The driver's own document round-tripping can still opt in via setIncludeTypeHints(true) if needed; the server ignores unknown @-prefixed fields either way.

Test plan

Closes #5863

…Metadata in map2json

map2json was using the includeMetadata parameter to decide whether to emit the
@props type-hint string. This bundled @props into every toJSON(true) call,
including the WebSocket ChangeEvent broadcast path where no consumer can opt
in to receiving it.

Fix: use the serializer-level includeTypeHints field (off by default, same
as serializeResult from ArcadeData#5860) instead of the includeMetadata parameter. The
@props hint is now emitted only when the caller explicitly enables it via
JsonSerializer.setIncludeTypeHints(true).
@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@lvca

lvca commented Aug 9, 2026

Copy link
Copy Markdown
Member

Thanks for finding and fixing this, @waterWang! I've opened #5980 with the same fix plus regression test coverage for both the map2json off-by-default behavior and the ChangeEvent/WebSocket broadcast path (which is the reported leak in #5863). Closing this in favor of that PR.

@lvca

lvca commented Aug 9, 2026

Copy link
Copy Markdown
Member

Superseded by #5980.

@lvca lvca closed this Aug 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.

@props type hint still leaks unconditionally via Document.toJSON(true) / WebSocket change events

2 participants