An Oversized Telemetry Packet Causes Partial Batch Transmission
Level 2 · node · Reliability · Partial batch transmission caused by validation after sending
Scenario
A fictional telemetry uplink sends queued packets through a transport gateway in order. The gateway contract requires every payload to fit a UTF-8 byte-size limit, and an invalid packet anywhere in a batch must prevent the entire batch from being sent. The current service checks size only after sending each packet, so the invalid packet and preceding packets can already have been transmitted. Inspect the repository, sender, and transport flow.
Requirements
Validate the UTF-8 byte length of every payload before sending any packet. If one exceeds maxBytes, throw RangeError and send nothing. Accept payloads exactly at the limit. When all packets are valid, preserve their order and return the sent count. An empty queue returns zero. Preserve existing signatures and transport interface; do not use external networks.
Acceptance criteria
- One packet is sent and the sent count is returned.
- Multiple packets are transmitted in stored order.
- An empty queue returns zero without sending anything.
- A packet whose UTF-8 byte length equals the limit is accepted.
- An oversized packet raises RangeError before transmission.
- An oversized later packet prevents any partial batch transmission.