Repository navigation
Description
What's missing
The async-surface spec requires three tests for each provider whose stream path was converted to genuine async:
Essentials/docs/superpowers/specs/2026-08-21-async-surface-design.md
Lines 151 to 156 in 8546476
| A fake-async implementation reaches for the synchronous path and throws; a genuine one passes. This | |
| is deterministic and machine-independent. Each converted provider gets: | |
| 1. An `AsyncOnlyStream` test proving it never touches the synchronous members. | |
| 2. A round-trip test asserting the async path produces byte-identical output to the sync path. | |
| 3. A cancellation test asserting an already-cancelled token is honoured before work begins. |
- An
AsyncOnlyStreamtest proving it never touches the synchronous members.- A round-trip test asserting the async path produces byte-identical output to the sync path.
- A cancellation test asserting an already-cancelled token is honoured before work begins.
Items 1 and 3 are covered for every converted provider. Item 2 is covered for Gzip only: GzipAsyncCompression_ProducesTheSameBytesAsTheSynchronousPathAsync (Essentials.Tests/AsyncStreamIoTests.cs:75).
The other converted providers have only round trips:
- Deflate, ZLib and Brotli.
CompressionProvider_RoundTripsThroughAsyncOnlyStreamsAsync, which runs overStreamingCompressionProviders. - AES.
AesEncryptionRoundTripsThroughAsyncOnlyStreamsAsync. - Elsewhere.
ProviderContractTestsandRoundTripTestsalso only round-trip the async path back to the original.
Why it matters
A round trip only shows that async compress and async decompress agree with each other. It does not show that the async path emits the same stream as the sync path. Two kinds of divergence would pass every current test while producing output the sync path, or another consumer, may not accept:
- a different compression level, or a missing final flush or footer, as long as the async decompressor tolerates it;
- an AES async path that writes the IV or padding differently from
TryEncrypt.
Data written by TryCompressAsync and later read through the synchronous API is exactly the case the spec's byte-identity test exists to protect.
Acceptance criteria
- A
[DynamicData]test over Deflate, ZLib and Brotli, mirroring the Gzip one. For a fixed payload, the bytesTryCompressAsyncwrites into anAsyncOnlyStreamequal the bytes the synchronousTryCompressproduces. - An AES test with a fixed key and IV. The bytes
TryEncryptAsyncwrites into anAsyncOnlyStreamequal the synchronousTryEncryptoutput. - Optionally, the Gzip-specific test folds into the parameterised one.
- Test-only change, tagged
[patch].
Dependencies
None. Release 1 of the spec has shipped (PR #14 and PR #15), and this closes its remaining test gap. Release 2, the ValueTask migration, is tracked under #8.
Activity
matt-edmondson commentedon Oct 6, 2026
Triage
ValueTaskmigration (Most async methods are Task.Run wrappers, not genuine async I/O #8) touches these code paths again.Essentials.Tests/AsyncStreamIoTests.cs, compression and encryption providersRecommended next step: Parameterise the Gzip byte-identity test with
[DynamicData]over Deflate, ZLib and Brotli. Add an AES fixed-key/IV test comparingTryEncryptAsyncagainstTryEncrypt. Tag the change[patch].Generated by Claude Code
Check async compression and encryption write the same bytes as the sy…