Skip to content

M2: Unknown* concrete-type serialization does not reproduce the raw document (F07) #19

Closed

Description

@Blind-Striker

Source: multi-agent review of PR #16, verifier CONFIRMED · medium · public API · all seven Unknown* carriers. 2026-08-13. M-anchor: M2 opening hardening batch.

UnknownOpenCodeError.Payload is public and not ignored (src/OpenCode.Sdk/Models/UnknownOpenCodeError.cs:32). The union converter is attached to the OpenCodeError base and writes Payload.WriteTo only when dispatch goes through the base; concrete source-generated metadata treats the carrier as an ordinary record and emits {"_tag":...,"Payload":{...}} instead of the preserved original JSON. Same shape on the other six carriers. SDK's own HTTP I/O is unaffected (uses union-base metadata); consumer serialization of a concrete carrier is affected.

Fix (verifier-corrected): change UnionEmitter to attach a concrete-type converter whose write path calls Payload.WriteTo. Do not use [JsonIgnore] alone — that would keep only the marker and discard the preserved body. Keep Payload public. Add concrete-type round-trip tests across representative carriers. Regenerate committed output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentSpecified enough that the work is mechanical

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions