Stream Guards#157
Merged
Merged
Conversation
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Closed
10 tasks
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class stream capability guard clauses to Light.GuardClauses so API boundaries can enforce Stream readability/writability/seekability early, while preserving fluent chaining, concrete stream types, and the single-file distribution pipeline.
Changes:
- Introduces
MustBeReadable,MustBeWritable, andMustBeSeekableguards (default + exception-factory overloads) plus matchingThrow.*helpers. - Adds comprehensive tests for capability semantics, expression capture, exception behavior, allocation-free success paths, and source-export whitelist reachability/trimming.
- Updates source-export configuration, regenerated single-file artifact, and documentation to include the new stream assertions.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs | Ensures the merged single-file template includes System.IO for Stream-based guards. |
| tools/source-export/Light.GuardClauses.SourceCodeTransformation/settings.json | Whitelists the three new stream assertions (including exception-factory overloads) for source export. |
| tools/source-export/Light.GuardClauses.SourceCodeTransformation/AssertionWhitelist.cs | Adds MustBeReadable/Writable/Seekable entries to the whitelist model. |
| tests/Light.GuardClauses.Tests/StreamAssertions/StreamGuardTests.cs | Adds coverage for capability-only checks, exception contracts, type preservation, and allocation-free success paths. |
| tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerWhitelistTests.cs | Adds focused source-export tests validating inclusion/trimming of stream guards and related throw/helpers/factory paths. |
| src/Light.GuardClauses/ExceptionFactory/Throw.Stream.cs | Adds dedicated Throw.MustBeReadable/Writable/Seekable helpers producing capability-specific ArgumentExceptions without formatting streams. |
| src/Light.GuardClauses/Check.MustBeReadable.cs | Implements MustBeReadable<TStream> guard (default + factory overload) with property-only validation. |
| src/Light.GuardClauses/Check.MustBeWritable.cs | Implements MustBeWritable<TStream> guard (default + factory overload) with property-only validation. |
| src/Light.GuardClauses/Check.MustBeSeekable.cs | Implements MustBeSeekable<TStream> guard (default + factory overload) with property-only validation. |
| Light.GuardClauses.SingleFile.cs | Regenerates the .NET Standard 2.0 single-file distribution to include stream guards and throw helpers. |
| docs/assertion-overview.md | Documents the new stream assertions and their property-only, non-mutating semantics and exception behavior. |
| ai-plans/0156-stream-guards.md | Adds the completed plan capturing rationale and acceptance-criteria completion for issue #156. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Closes #156