Skip to content

Stream Guards#157

Merged
feO2x merged 2 commits into
mainfrom
156-stream-guards
Jul 14, 2026
Merged

Stream Guards#157
feO2x merged 2 commits into
mainfrom
156-stream-guards

Conversation

@feO2x

@feO2x feO2x commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Closes #156

feO2x added 2 commits July 14, 2026 22:59
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
@feO2x feO2x requested a review from Copilot July 14, 2026 21:16
@feO2x feO2x self-assigned this Jul 14, 2026
@feO2x feO2x linked an issue Jul 14, 2026 that may be closed by this pull request
10 tasks
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Complexity Health
Light.GuardClauses 95% 88% 2372
Light.GuardClauses.InternalRoslynAnalyzers 96% 86% 52
Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes 95% 100% 8
Light.GuardClauses.SourceCodeTransformation 92% 83% 663
Summary 94% (4476 / 4746) 87% (2430 / 2793) 3095

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and MustBeSeekable guards (default + exception-factory overloads) plus matching Throw.* 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.

@feO2x feO2x merged commit ee163d5 into main Jul 14, 2026
3 checks passed
@feO2x feO2x deleted the 156-stream-guards branch July 14, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stream Guards

2 participants