infra stuff in gleam

atproto_codegen: binary-output queries degrade to Nil through the UTF-8 text path #34

Open mokkenstorm.dev
Open opened by mokkenstorm.dev

Any query whose output has an encoding like / and no schema (a raw-bytes response, e.g. com.atproto.sync.getBlob) is lowered to FlatBody(_, None), which output_section maps to OutNil, and call_expr routes the call through xrpc.get (text mode: send_text + bit_array.to_string).

The generated sync_get_blob therefore returns Result(Nil, SyncGetBlobError): it discards the response payload entirely, and since real image bytes are essentially never valid UTF-8, the call typically errors outright. Confirmed empirically against a live PDS during the at-record migration; the hand-written xrpc.get_bits call had to stay.

There is a PostBits counterpart for binary input but no GetBits for binary output. Binary-download endpoints should generate a function returning the body as a BitArray (plus content-type).

Sign up or Sign in to add to the discussion.