Story #47 Streaming · Truncated Responses · Transfer Integrity

The Download That Looked Complete but Ended Halfway Through

"HTTP 200 means the response started. It doesn't mean the stream finished"

A records-management API streamed large audit exports. During a network maintenance event, a proxy terminated connections before all records were sent. The client treated connection close as end-of-file and marked truncated exports as complete. The discrepancy surfaced weeks later in a regulatory reconciliation.

What happened

A records-management provider offered an endpoint that streamed large audit exports as newline-delimited JSON. The service wrote records progressively, and clients processed each line as it arrived. During a network maintenance event, a proxy terminated several long-lived connections before the final record was sent.

The client library treated the connection close as normal end-of-file. Because the response had started with HTTP 200, the consuming system marked the export as complete and imported only the records it had received. No explicit completion marker, expected record count, or checksum was validated.

The discrepancy was discovered during a regulatory reconciliation weeks later. The server had generated all records, but the consumer had accepted truncated streams as complete files. The issue was not visible in small test exports because they finished before the proxy’s idle timeout.

Root cause

Connection close was incorrectly treated as successful completion without validating the stream’s completion semantics. Tests used small, uninterrupted responses and did not simulate mid-stream disconnection.

The fix

The provider added explicit stream framing and completion metadata, and the client now checks record counts and integrity before committing an import. Tests deliberately interrupt streams at different chunk boundaries, slow the consumer, cancel requests, and verify that incomplete transfers are detected.

Testing gaps and preventive tests

Mid-stream disconnect tests, chunk-boundary parsing, expected-count and checksum validation, cancellation cleanup, and proxy-timeout tests. HTTP 200 means the response started successfully; it does not prove a streamed transfer completed correctly.

Business impact

Incomplete audit exports were consumed as complete datasets, creating reconciliation and compliance risk.

Lesson learned

HTTP 200 means the response started successfully; it does not prove a streamed transfer completed correctly.

The Download That Looked Complete but Ended Halfway Through