Skip to content

test: cover audit log generator hosts#431

Merged
JerrettDavis merged 1 commit into
mainfrom
test/audit-log-generator-coverage-413
May 29, 2026
Merged

test: cover audit log generator hosts#431
JerrettDavis merged 1 commit into
mainfrom
test/audit-log-generator-coverage-413

Conversation

@JerrettDavis

Copy link
Copy Markdown
Owner

Summary:

  • Harden AuditLogGenerator to emit containing partial wrappers for nested hosts.
  • Reject generic audit key selectors consistently with other selector-based generators.
  • Expand Audit Log generator TinyBDD scenarios for defaults, malformed type arguments, selector count/signature diagnostics, host type shapes, escaped log names, nested accessibility wrappers, and emitted-compilation success.

Coverage:

  • AuditLogGenerator: 99.1% locally.
  • PatternKit.Generators: 95.5% locally.

Validation:

  • Focused AuditLogGeneratorTests passed on net10.0.
  • Full PatternKit.Generators.Tests passed on net8.0, net9.0, and net10.0.
  • Generator coverage run completed with Cobertura plus ReportGenerator summary.
  • dotnet format PatternKit.slnx --verify-no-changes passed.

Closes part of #413.

Copilot AI review requested due to automatic review settings May 29, 2026 19:55
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ 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

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 pull request strengthens the AuditLogGenerator source generator to better handle nested host types and improves test coverage to exercise more generation and diagnostic paths, supporting the repo’s broader goal of raising generator coverage (Issue #413).

Changes:

  • Hardened selector validation to reject generic key selector methods.
  • Updated source emission to include containing partial type wrappers for nested audit log hosts.
  • Expanded TinyBDD scenarios to cover defaults/type shapes, nested accessibility wrappers, malformed type arguments, and additional selector-signature diagnostics.

Reviewed changes

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

File Description
src/PatternKit.Generators/AuditLog/AuditLogGenerator.cs Adds generic-method rejection for key selectors and refactors emission to wrap nested hosts in containing partial type declarations.
test/PatternKit.Generators.Tests/AuditLogGeneratorTests.cs Adds scenarios and assertions to increase coverage for nested hosts, defaults/type shapes, selector validation, escaping, and malformed type arguments.

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

Comment on lines 161 to 163
sb.Append("sealed ");
sb.Append("partial ").Append(type.TypeKind == TypeKind.Struct ? "struct" : "class").Append(' ').Append(type.Name).AppendLine();
sb.AppendLine("{");
sb.Append(" public static global::PatternKit.Application.AuditLog.InMemoryAuditLog<")
.Append(entryTypeName).Append(", ").Append(keyTypeName).Append("> ").Append(factoryName).AppendLine("()");
sb.Append(" => global::PatternKit.Application.AuditLog.InMemoryAuditLog<")
.Append(entryTypeName).Append(", ").Append(keyTypeName).Append(">.Create(\"").Append(Escape(logName)).Append("\", ").Append(selectorName).AppendLine(").Build();");
sb.AppendLine("}");
return sb.ToString();
sb.Append("partial ").Append(type.TypeKind == TypeKind.Struct ? "struct" : "class").Append(' ').Append(type.Name);
}
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

    12 files      12 suites   9m 42s ⏱️
 3 665 tests  3 665 ✅ 0 💤 0 ❌
11 048 runs  11 048 ✅ 0 💤 0 ❌

Results for commit 04246c4.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 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.

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/29/2026 - 20:03:14
  Coverage date: 05/29/2026 - 20:00:46 - 05/29/2026 - 20:03:02
  Parser: MultiReport (12x Cobertura)
  Assemblies: 5
  Classes: 1616
  Files: 551
  Line coverage: 95.8%
  Covered lines: 42530
  Uncovered lines: 1842
  Coverable lines: 44372
  Total lines: 95713
  Branch coverage: 78.4% (12769 of 16281)
  Covered branches: 12769
  Total branches: 16281
  Method coverage: 96.4% (8370 of 8676)
  Full method coverage: 89.3% (7754 of 8676)
  Covered methods: 8370
  Fully covered methods: 7754
  Total methods: 8676

PatternKit.Core                                                                                                     95.4%
  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.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.MaterializedViews.MaterializedView<T1, T2>                                                 98.4%
  PatternKit.Application.Repository.InMemoryRepository<T1, T2>                                                      92.8%
  PatternKit.Application.Repository.RepositoryResult<T>                                                             93.3%
  PatternKit.Application.ServiceLayer.ServiceLayerOperation<T1, T2>                                                 96.7%
  PatternKit.Application.ServiceLayer.ServiceLayerResult<T>                                                         94.7%
  PatternKit.Application.ServiceLayer.ServiceLayerRule<T>                                                            100%
  PatternKit.Application.Specification.Specification<T>                                                              100%

@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.12%. Comparing base (40b9e43) to head (04246c4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #431      +/-   ##
==========================================
+ Coverage   90.32%   96.12%   +5.80%     
==========================================
  Files         551      551              
  Lines       44351    44372      +21     
  Branches     6382     6385       +3     
==========================================
+ Hits        40059    42652    +2593     
+ Misses       1848     1720     -128     
+ Partials     2444        0    -2444     
Flag Coverage Δ
unittests 96.12% <100.00%> (+5.80%) ⬆️

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 merged commit 2014641 into main May 29, 2026
13 checks passed
@JerrettDavis JerrettDavis deleted the test/audit-log-generator-coverage-413 branch May 29, 2026 20:08
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.

2 participants