This document connects the compression specification to the implementation in this repository. It is informative: deviations recorded here do not weaken the generic contract.
Request compression is configured with
RequestCompressionAlgorithm
and minCompressionSizeBytes in
AlternatorConfig. Response
compression is configured with
ResponseCompressionAlgorithm.
Both client builders propagate these settings and install the corresponding execution interceptors.
GzipRequestInterceptor
reads and caches serialized request bytes, decides whether the threshold is met, and provides a
replacement blocking or asynchronous body.
ResponseCompressionInterceptor
adds Accept-Encoding, recognizes configured response encodings, strips stale response headers,
and wraps blocking streams or asynchronous publishers for decompression.
Compression runs in the request and response interceptor lifecycle. Request bodies are buffered before compression. Asynchronous responses are also buffered completely, then emitted as one decoded buffer after positive demand. Per-request execution attributes hold cached request bytes, the request compression decision, and the selected response encoding.
| Requirement | Code | Test evidence | Status |
|---|---|---|---|
COMP-REQ-001 |
AlternatorConfig |
FeatureSpecDefaultsTest#compressionDefaultsMatchSpecification |
conformant |
COMP-REQ-002 |
GzipRequestInterceptor |
GzipRequestInterceptorTest#testCompressedBodyIsValidGzip |
gap |
COMP-REQ-003 |
GzipRequestInterceptor |
— | gap |
COMP-REQ-004 |
ResponseCompressionInterceptor |
ResponseCompressionInterceptorTest#testGzipSyncResponseIsDecompressedAndHeadersAreStripped |
gap |
COMP-REQ-005 |
ResponseCompressionInterceptor |
— | gap |
COMP-REQ-006 |
ResponseCompressionInterceptor |
ResponseCompressionInterceptorTest#testGzipAsyncResponseIsDecompressedAndHeadersAreStripped |
gap |
COMP-REQ-007 |
AlternatorDynamoDbClient |
AlternatorConfigHeadersTest#testHeadersOptimizationWithCompression |
gap |
COMP-REQ-008 |
AlternatorDynamoDbAsyncClient |
ResponseCompressionIT#testAsyncSdkClientParsesGzipResponse |
gap |
FeatureSpecDefaultsTestexecutes the machine-readable compression defaults.RequestCompressionAlgorithmTestcovers request algorithm values and enablement.GzipRequestInterceptorTestcovers direct interceptor-method thresholds, gzip round trips, and blocking/asynchronous bodies.ResponseCompressionInterceptorTestcovers negotiation, gzip/deflate decoding, header stripping, unsupported encodings, and a single-buffer asynchronous success path.ResponseCompressionITverifies end-to-end protocol parsing for compressed blocking and asynchronous responses.AlternatorDynamoDbClientCustomizerTestandAlternatorDynamoDbAsyncClientCustomizerTestcover builder propagation.
COMP-REQ-002,COMP-REQ-003,COMP-REQ-007,COMP-REQ-008: The request-compression interceptor is not conformant in the current request pipeline. Content modifiers run beforemodifyHttpRequest(...), but the interceptor reads the body and records its decision only inmodifyHttpRequest(...). An ordinary eligible request therefore carriesContent-Encoding: gzipwith its original JSON bytes. Existing tests call these methods in the opposite order and integration tests inspect the header without validating the transmitted gzip stream.COMP-REQ-002: A replacement body does not update the originalContent-Length, and a present zero-byte body is compressed when the threshold is zero.COMP-REQ-003: Compressor failure returns original bytes after the gzip header decision instead of failing or removing that header. No injected compressor-failure test covers the path.COMP-REQ-004: The selected response encoding is stored in request-scoped attributes and is not cleared for a later unencoded, unsupported, or ambiguous retry response. A stale encoding can be reused across attempts.COMP-REQ-005,COMP-REQ-006,COMP-REQ-008: Corrupt configured responses, asynchronous demand accounting, non-positive demand, upstream errors, cancellation, case and parameter handling, duplicate algorithms, and multiple encoding header values lack direct coverage.