docs: correct the decompress and decrypt cancellation remarks - #15
Merged
Conversation
The remarks on `TryDecompressAsync` and `TryDecryptAsync` shipped in 2.2.0 claiming that cancellation "still flushes the trailer" or "still flushes the final block". That is false on those paths. The decompressing and decrypting streams wrap the source, not the destination, and are constructed with `leaveOpen: true`, so disposing them writes nothing to the destination. The destination only ever receives the output of `CopyToAsync`. The advice to treat a partial destination as invalid was right, but the reason given was wrong. State the real one: raw decompressed bytes and recovered plaintext carry no structure of their own, so a truncated destination cannot be told apart from a complete one by inspecting it. The matching remarks on the compress and encrypt paths are correct and are left alone. There, the stream does wrap the destination and disposal does write the trailer or final cipher block. Documentation only. No behavior change, and no test asserted the wrong claim.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Corrects five XML doc remarks that shipped in 2.2.0 and are already on NuGet. Callers reading the current docs are told the wrong reason to distrust a partial destination.
What was wrong
TryDecompressAsync(Gzip, Deflate, ZLib, Brotli) andTryDecryptAsync(AES) each claimed that cancellation "still flushes the trailer" or "still flushes the final block". On those paths nothing is flushed to the destination at all. The wrapping stream takes the source:Disposal tears down the decompressor over the source. The destination only ever sees
CopyToAsyncoutput.What it says now
The conclusion was always right, so the guidance to treat the destination as invalid unless the method returns
trueis unchanged. Only the justification is replaced: decompressed bytes and recovered plaintext have no structure of their own, so a truncated destination can't be told apart from a complete one by inspecting it. Each remark also now notes that the stream wraps the source, which is what makes the trailer irrelevant here.What is deliberately untouched
The compress and encrypt remarks in the same five files. Those are accurate, because there the stream really does wrap the destination and disposal really does write the trailer or the final cipher block. That asymmetry is the whole point, and it is why only one of each pair changed.
Risk
None. Documentation only, no behavior change. Confirmed no test asserted the wrong claim, so nothing needed rewriting alongside it. Full solution builds clean, 0 warnings and 0 errors under warnings-as-errors.