Skip to content

truapi-server: ProtocolMessage::decode_error / call_error build half-valid frames #102

@pgherveou

Description

@pgherveou

Found during review of #96. ProtocolMessage::decode_error and ::call_error in rust/crates/truapi-server/src/frame.rs:35 return a ProtocolMessage with empty request_id and empty tag, relying on the dispatcher to 'overlay' both. The constructor name suggests it produces a usable wire frame; nothing in the type prevents a caller from transport.send(ProtocolMessage::decode_error(...)) directly, which would produce [0x00 empty-str compact-len][0xFF unknown-tag poison][err bytes] — a frame the peer must reject. Fix: return a plain Vec<u8> (encoded CallError bytes) from these constructors since that's all the dispatcher actually uses; the ProtocolMessage envelope is then built once at the dispatcher seam with the right request_id/tag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions