Skip to content

feat: add null object pattern#493

Merged
JerrettDavis merged 1 commit into
mainfrom
feature/null-object-pattern-488
Jun 1, 2026
Merged

feat: add null object pattern#493
JerrettDavis merged 1 commit into
mainfrom
feature/null-object-pattern-488

Conversation

@JerrettDavis
Copy link
Copy Markdown
Owner

Summary

  • closes Add Null Object pattern #488
  • adds fluent NullObject runtime support and a source generator for interface-based null implementations
  • adds IServiceCollection registration for both wrapper and contract fallback resolution
  • adds production notification example, docs/catalog updates, and BenchmarkDotNet coverage

Validation

  • dotnet test test\PatternKit.Tests\PatternKit.Tests.csproj --framework net8.0 --filter "FullyQualifiedName~NullObject" --no-restore
  • dotnet test test\PatternKit.Generators.Tests\PatternKit.Generators.Tests.csproj --framework net8.0 --filter "FullyQualifiedName~NullObjectGeneratorTests" --no-restore
  • dotnet test test\PatternKit.Hosting.Extensions.Tests\PatternKit.Hosting.Extensions.Tests.csproj --framework net8.0 --filter "FullyQualifiedName~PatternKitServiceCollectionExtensionsTests" --no-restore
  • dotnet test test\PatternKit.Examples.Tests\PatternKit.Examples.Tests.csproj --framework net8.0 --filter "FullyQualifiedNameCustomerNotificationNullObjectDemoTests|FullyQualifiedNamePatternKitExampleDependencyInjectionTests|FullyQualifiedNamePatternKitPatternCatalogTests|FullyQualifiedNamePatternKitExampleCatalogTests" --no-restore
  • dotnet build PatternKit.slnx --no-restore
  • git diff --check

Copilot AI review requested due to automatic review settings June 1, 2026 03:20
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Null Object pattern support across PatternKit runtime APIs, source generation, hosting extensions, examples, docs, tests, and benchmarks.

Changes:

  • Introduces NullObject<TContract> fluent runtime wrapper and DI registration helpers.
  • Adds [GenerateNullObject] / [NullObjectDefault] attributes plus a generator for interface null implementations.
  • Adds customer notification examples, catalog entries, docs, tests, and benchmark coverage.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
src/PatternKit.Core/Structural/NullObject/NullObject.cs Adds runtime Null Object wrapper and builder.
src/PatternKit.Generators.Abstractions/NullObject/NullObjectAttributes.cs Adds generator attributes.
src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Adds source generator implementation.
src/PatternKit.Generators/AnalyzerReleases.Unshipped.md Registers new analyzer diagnostics.
src/PatternKit.Hosting.Extensions/DependencyInjection/PatternKitServiceCollectionExtensions.cs Adds DI registration helpers.
src/PatternKit.Examples/NullObjectDemo/CustomerNotificationNullObjectDemo.cs Adds customer notification example.
src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs Registers example with DI catalog.
src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs Adds Null Object to production catalog.
src/PatternKit.Examples/ProductionReadiness/PatternKitHostingIntegrationCatalog.cs Adds hosting integration catalog entry.
src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs Adds example catalog entry.
benchmarks/PatternKit.Benchmarks/Structural/NullObjectBenchmarks.cs Adds scenario benchmarks.
test/PatternKit.Tests/Structural/NullObject/NullObjectTests.cs Adds runtime tests.
test/PatternKit.Generators.Tests/NullObjectGeneratorTests.cs Adds generator tests.
test/PatternKit.Hosting.Extensions.Tests/DependencyInjection/PatternKitServiceCollectionExtensionsTests.cs Extends hosting tests.
test/PatternKit.Examples.Tests/NullObjectDemo/CustomerNotificationNullObjectDemoTests.cs Adds example tests.
test/PatternKit.Examples.Tests/DependencyInjection/PatternKitExampleDependencyInjectionTests.cs Verifies DI import path.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs Updates production catalog expectations.
README.md Updates pattern counts/table.
docs/patterns/structural/null-object/index.md Adds pattern docs.
docs/guides/hosting-extensions.md Documents hosting registration.
docs/generators/null-object.md Adds generator docs.
docs/examples/null-object-notification.md Adds example docs.

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

Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Outdated
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Outdated
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Outdated
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Outdated
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs
Comment thread README.md Outdated
Comment thread docs/generators/null-object.md
Comment thread docs/patterns/behavioral/null-object/index.md
Comment thread docs/examples/null-object-notification.md
Comment thread src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Test Results

    12 files      12 suites   10m 33s ⏱️
 4 089 tests  4 089 ✅ 0 💤 0 ❌
12 698 runs  12 698 ✅ 0 💤 0 ❌

Results for commit 0d76816.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🔍 PR Validation Results

Version: ``

✅ Validation Steps

  • Build solution
  • Run tests
  • Build documentation
  • Dry-run NuGet packaging

📊 Artifacts

Dry-run artifacts have been uploaded and will be available for 7 days.


This comment was automatically generated by the PR validation workflow.

@JerrettDavis JerrettDavis force-pushed the feature/null-object-pattern-488 branch from 3003429 to 787e508 Compare June 1, 2026 03:46
@github-actions github-actions Bot added size/xl and removed size/l labels Jun 1, 2026
Copilot AI review requested due to automatic review settings June 1, 2026 03:51
@JerrettDavis JerrettDavis force-pushed the feature/null-object-pattern-488 branch from 787e508 to 210322a Compare June 1, 2026 03:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 29 out of 29 changed files in this pull request and generated 9 comments.

Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Outdated
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Outdated
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Outdated
Comment thread docs/index.md Outdated
Comment thread src/PatternKit.Generators.Abstractions/NullObject/NullObjectAttributes.cs Outdated
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Outdated
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 97.09443% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.40%. Comparing base (88a5711) to head (0d76816).

Files with missing lines Patch % Lines
...rnKit.Generators/NullObject/NullObjectGenerator.cs 96.33% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #493      +/-   ##
==========================================
- Coverage   97.41%   97.40%   -0.01%     
==========================================
  Files         583      587       +4     
  Lines       47614    48026     +412     
  Branches     3097       34    -3063     
==========================================
+ Hits        46382    46782     +400     
- Misses       1232     1244      +12     
Flag Coverage Δ
unittests 97.40% <97.09%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JerrettDavis JerrettDavis force-pushed the feature/null-object-pattern-488 branch from 210322a to 9c7366a Compare June 1, 2026 04:05
Copilot AI review requested due to automatic review settings June 1, 2026 04:24
@JerrettDavis JerrettDavis force-pushed the feature/null-object-pattern-488 branch from 9c7366a to fd1fbd1 Compare June 1, 2026 04:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 29 out of 29 changed files in this pull request and generated 6 comments.

Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Outdated
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs Outdated
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs
@JerrettDavis JerrettDavis force-pushed the feature/null-object-pattern-488 branch from fd1fbd1 to 4a517ac Compare June 1, 2026 05:51
Copilot AI review requested due to automatic review settings June 1, 2026 06:09
@JerrettDavis JerrettDavis force-pushed the feature/null-object-pattern-488 branch from 4a517ac to 35d5ea3 Compare June 1, 2026 06:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.

Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs
Comment thread src/PatternKit.Generators/NullObject/NullObjectGenerator.cs
Comment thread docs/generators/null-object.md Outdated
@JerrettDavis JerrettDavis force-pushed the feature/null-object-pattern-488 branch from 35d5ea3 to 0d76816 Compare June 1, 2026 06:27
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Code Coverage

Summary
  Generated on: 06/01/2026 - 06:37:22
  Coverage date: 06/01/2026 - 06:32:40 - 06/01/2026 - 06:37:04
  Parser: MultiReport (24x Cobertura)
  Assemblies: 5
  Classes: 1737
  Files: 587
  Line coverage: 97.4%
  Covered lines: 46780
  Uncovered lines: 1246
  Coverable lines: 48026
  Total lines: 102260
  Branch coverage: 84.3% (14974 of 17744)
  Covered branches: 14974
  Total branches: 17744
  Method coverage: 97.2% (9090 of 9345)
  Full method coverage: 91.5% (8553 of 9345)
  Covered methods: 9090
  Fully covered methods: 8553
  Total methods: 9345

PatternKit.Core                                                                                                       96%
  PatternKit.Application.ActivityTracking.ActivityGateState                                                          100%
  PatternKit.Application.ActivityTracking.ActivityLease                                                              100%
  PatternKit.Application.ActivityTracking.ActivityRecord                                                             100%
  PatternKit.Application.ActivityTracking.ActivityTracker                                                            100%
  PatternKit.Application.Aggregates.AggregateCommandHandler<T1, T2, T3>                                              100%
  PatternKit.Application.Aggregates.AggregateCommandResult<T>                                                        100%
  PatternKit.Application.Aggregates.AggregateRoot<T1, T2>                                                            100%
  PatternKit.Application.AntiCorruption.AntiCorruptionLayer<T1, T2>                                                 90.4%
  PatternKit.Application.AntiCorruption.AntiCorruptionResult<T>                                                      100%
  PatternKit.Application.AuditLog.AuditLogAppendResult<T>                                                           85.7%
  PatternKit.Application.AuditLog.InMemoryAuditLog<T1, T2>                                                          95.4%
  PatternKit.Application.BoundedContexts.BoundedContextAdapter                                                       100%
  PatternKit.Application.BoundedContexts.BoundedContextCapability                                                   83.3%
  PatternKit.Application.BoundedContexts.BoundedContextDescriptor                                                   95.4%
  PatternKit.Application.ContextMaps.ContextMapDescriptor                                                           96.8%
  PatternKit.Application.ContextMaps.ContextMapRelationship                                                          100%
  PatternKit.Application.DataMapping.DataMapper<T1, T2>                                                             94.6%
  PatternKit.Application.DataMapping.DataMapperError                                                                  90%
  PatternKit.Application.DataMapping.DataMapperResult<T>                                                            84.6%
  PatternKit.Application.DomainEvents.DomainEventDispatcher<T>                                                      95.4%
  PatternKit.Application.DomainEvents.DomainEventDispatchResult                                                      100%
  PatternKit.Application.DomainServices.DomainServiceOperation<T1, T2>                                               100%
  PatternKit.Application.DomainServices.DomainServiceRegistry<T1, T2>                                                100%
  PatternKit.Application.EventSourcing.EventStoreAppendResult                                                        100%
  PatternKit.Application.EventSourcing.InMemoryEventStore<T1, T2>                                                   97.9%
  PatternKit.Application.EventSourcing.StoredEvent<T1, T2>                                                            80%
  PatternKit.Application.EventualConsistency.EventualConsistencyEvaluation<T>                                       92.3%
  PatternKit.Application.EventualConsistency.EventualConsistencyMonitor<T>                                          97.2%
  PatternKit.Application.EventualConsistency.EventualConsistencyMonitorState<T>                                      100%
  PatternKit.Application.EventualConsistency.EventualConsistencyWatermarks<T>                                       96.7%
  PatternKit.Application.FeatureToggles.FeatureToggleDecision                                                       87.5%
  PatternKit.Application.FeatureToggles.FeatureToggleRule<T>                                                         100%
  PatternKit.Application.FeatureToggles.FeatureToggleSet<T>                                                         96.9%
  PatternKit.Application.IdentityMap.IdentityMap<T1, T2>                                                             100%
  PatternKit.Application.IdentityMap.IdentityMapResult<T>                                                           92.8%
  PatternKit.Application.ManualTaskGates.ManualTaskGate<T>                                                          98.5%
  PatternKit.Application.ManualTaskGates.ManualTaskGateState<T>                                                      100%
  PatternKit.Application.ManualTaskGates.ManualTaskRecord<T>                                                        96.9%

@JerrettDavis JerrettDavis merged commit 00ee468 into main Jun 1, 2026
12 checks passed
@JerrettDavis JerrettDavis deleted the feature/null-object-pattern-488 branch June 1, 2026 06:43
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.

Add Null Object pattern

2 participants