Skip to content

Additional assertions Juli 2026#146

Merged
feO2x merged 2 commits into
mainfrom
145-additional-assertions-july-2026
Jul 13, 2026
Merged

Additional assertions Juli 2026#146
feO2x merged 2 commits into
mainfrom
145-additional-assertions-july-2026

Conversation

@feO2x

@feO2x feO2x commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Closes #145

Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
@feO2x feO2x requested a review from Copilot July 13, 2026 13:14
@feO2x feO2x self-assigned this Jul 13, 2026
@feO2x feO2x linked an issue Jul 13, 2026 that may be closed by this pull request
14 tasks

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

This PR implements Issue #145 by adding several new guard-clause assertion families (UUIDv7, finiteness, ASCII, ranged collection counts, additional span/memory guards, and DateTimeOffset UTC validation) while keeping the source-export pipeline, single-file distribution, benchmarks, tests, and documentation in sync.

Changes:

  • Added new Check.* predicates/guards: IsUuidVersion7/MustBeUuidVersion7, IsFinite/MustBeFinite, IsAscii/MustBeAscii, MustHaveCountIn, plus additional span/memory length and whitespace guards, and DateTimeOffset support for MustBeUtc.
  • Introduced supporting infrastructure (e.g., GuidLayout overlay and new Throw.* helpers) and regenerated the committed single-file distribution.
  • Updated BenchmarkDotNet project to run .NET 10-only with memory diagnoser enabled by default (disassembly opt-in), and added/extended tests + docs + source-export whitelist coverage.

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs Ensures generated single-file output includes interop namespace needed by UUIDv7 layout overlay.
tools/source-export/Light.GuardClauses.SourceCodeTransformation/settings.json Adds new assertion families to the source-export settings catalog.
tools/source-export/Light.GuardClauses.SourceCodeTransformation/AssertionWhitelist.cs Extends the whitelist model with new assertion entries for export/trimming.
tests/Light.GuardClauses.Tests/StringAssertions/AsciiTests.cs Adds test coverage for ASCII predicates/guards across scalar/string/span/memory shapes.
tests/Light.GuardClauses.Tests/DateTimeAssertions/MustBeUtcTests.cs Extends UTC guard tests to cover DateTimeOffset zero/non-zero offset behavior.
tests/Light.GuardClauses.Tests/CommonAssertions/UuidVersion7Tests.cs Adds correctness tests for UUIDv7 structural validation and guard behavior.
tests/Light.GuardClauses.Tests/CommonAssertions/FiniteTests.cs Adds finiteness tests for float/double and modern generic IEEE-754 overload availability.
tests/Light.GuardClauses.Tests/CollectionAssertions/MustHaveCountInTests.cs Validates ranged collection-count guard semantics (inclusive/exclusive endpoints, null, lazy enumerables, factories/messages).
tests/Light.GuardClauses.Tests/CollectionAssertions/AdditionalSpanAndMemoryGuardsTests.cs Adds span/memory parity tests for non-empty, length range, exact length (memory), and non-whitespace guards.
tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerWhitelistTests.cs Ensures new assertions retain required portable helpers and target-specific surfaces in generated source.
tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerFrameworkTests.cs Verifies net10 export includes IEEE-754 generic finiteness + optimized ASCII, while netstandard omits them.
src/Light.GuardClauses/GuidLayout.cs Adds internal explicit-layout overlay struct used for allocation-free UUIDv7 inspection.
src/Light.GuardClauses/Exceptions/InvalidDateTimeException.cs Updates exception documentation to cover DateTimeOffset in addition to DateTime.
src/Light.GuardClauses/ExceptionFactory/Throw.WhiteSpaceString.cs Adds a span-specific whitespace throw helper to support MustNotBeEmptyOrWhiteSpace for spans.
src/Light.GuardClauses/ExceptionFactory/Throw.Span.cs Adds ranged-length throw helper for spans.
src/Light.GuardClauses/ExceptionFactory/Throw.NotFinite.cs Adds default throw helper for non-finite floating-point guard failures.
src/Light.GuardClauses/ExceptionFactory/Throw.DateTime.cs Adds DateTimeOffset UTC-offset throw helper.
src/Light.GuardClauses/ExceptionFactory/Throw.CollectionCountNotInRange.cs Adds default throw helper for ranged collection-count guard failures.
src/Light.GuardClauses/Check.MustNotBeEmptyOrWhiteSpace.cs Adds throwing guard for whitespace/empty character span and memory shapes.
src/Light.GuardClauses/Check.MustNotBeEmpty.cs Adds MustNotBeEmpty overloads for span/memory shapes.
src/Light.GuardClauses/Check.MustHaveLengthIn.cs Adds MustHaveLengthIn overloads for span/memory shapes with ranged-length semantics.
src/Light.GuardClauses/Check.MustHaveLength.cs Adds exact-length guards for Memory<T> / ReadOnlyMemory<T>.
src/Light.GuardClauses/Check.MustHaveCountIn.cs Adds ranged count guard for general IEnumerable collections with factory overload.
src/Light.GuardClauses/Check.MustBeUuidVersion7.cs Adds UUIDv7 throwing guard with default and factory overloads.
src/Light.GuardClauses/Check.MustBeUtc.cs Adds DateTimeOffset overloads for MustBeUtc without normalizing instants.
src/Light.GuardClauses/Check.MustBeFinite.cs Adds throwing finiteness guards for float/double plus modern generic IEEE-754 overloads.
src/Light.GuardClauses/Check.MustBeAscii.cs Adds ASCII throwing guards for scalars, strings, and span/memory shapes.
src/Light.GuardClauses/Check.IsUuidVersion7.cs Adds allocation-free UUIDv7 predicate based on GUID structural fields.
src/Light.GuardClauses/Check.IsFinite.cs Adds finiteness predicates for float/double plus modern generic IEEE-754 predicate.
src/Light.GuardClauses/Check.IsAscii.cs Adds ASCII predicates for scalars/strings/spans/memory, using optimized framework APIs on modern TFMs.
Light.GuardClauses.SingleFile.cs Regenerates the committed netstandard2.0 single-file distribution including the new APIs/helpers.
docs/source-code-inclusion.md Updates source-export docs to reflect new net10-only optimized surfaces.
docs/historical-performance.md Updates benchmark targeting statement to reflect .NET 10-only benchmarks.
docs/contributing-and-building.md Updates build/contribution docs for .NET 10-only benchmarks and disassembly opt-in.
docs/assertion-overview.md Documents new assertion families and overload matrices (UUIDv7, finiteness, ASCII, count-in-range, span/memory parity, DateTimeOffset UTC).
benchmarks/Light.GuardClauses.Performance/Program.cs Makes memory diagnoser default and disassembly diagnoser opt-in; updates to .NET 10 runtime job.
benchmarks/Light.GuardClauses.Performance/Light.GuardClauses.Performance.csproj Switches benchmark project to net10.0 only.
benchmarks/Light.GuardClauses.Performance/CommonAssertions/UuidVersion7Benchmark.cs Adds UUIDv7 structural validation microbenchmarks for direct vs guard-clause checks.
ai-plans/0145-additional-assertions.md Adds a plan/acceptance-criteria checklist documenting the implementation scope for #145.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Light.GuardClauses/GuidLayout.cs
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
@feO2x feO2x merged commit bb3dfc6 into main Jul 13, 2026
1 check passed
@feO2x feO2x deleted the 145-additional-assertions-july-2026 branch July 13, 2026 13:33
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.

Additional Assertions July 2026

2 participants