Skip to content

test: cover adapter generator edge cases#420

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

test: cover adapter generator edge cases#420
JerrettDavis merged 1 commit into
mainfrom
test/adapter-generator-coverage-413

Conversation

@JerrettDavis

Copy link
Copy Markdown
Owner

Summary

  • harden Adapter map discovery so malformed single-adapter mappings receive precise PKADP005 signature diagnostics
  • add TinyBDD coverage for unbound adaptee, invalid map signatures, abstract/internal constructors, partial adapter coexistence, ref readonly/default emission, and metadata-only target/conflict paths
  • raise AdapterGenerator source coverage from 95.4% to 99.2% in the generator-only report

Part of #413.

Validation

  • dotnet test test\PatternKit.Generators.Tests\PatternKit.Generators.Tests.csproj --configuration Release --framework net10.0 --filter "FullyQualifiedName~AdapterGeneratorTests" --logger "console;verbosity=minimal"
  • dotnet test test\PatternKit.Generators.Tests\PatternKit.Generators.Tests.csproj --configuration Release --no-restore -p:TestTfmsInParallel=false --collect:"XPlat Code Coverage" --results-directory .\TestResults --logger "console;verbosity=minimal" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura
  • dotnet tool run reportgenerator -reports:"TestResults*\coverage.cobertura.xml" -targetdir:"coverage-report-generators" -reporttypes:"TextSummary;Cobertura" -assemblyfilters:"+PatternKit.Generators" -filefilters:"-**/.Tests/;-/Tests/;-/obj/;-/bin/;-**/.g.cs"
  • dotnet format PatternKit.slnx --verify-no-changes --verbosity minimal
  • dotnet test test\PatternKit.Tests\PatternKit.Tests.csproj --configuration Release --framework net10.0 --no-restore --logger "console;verbosity=minimal"
  • dotnet test PatternKit.slnx --configuration Release --no-restore --no-build -p:TestTfmsInParallel=false -m:1 --logger "console;verbosity=minimal"

@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

Hardens the Adapter source generator so malformed [AdapterMap] methods on single-adapter hosts surface as precise PKADP005 signature diagnostics instead of being silently dropped (which previously produced misleading PKADP003 "missing mapping" errors), and adds extensive TinyBDD test coverage to raise AdapterGenerator coverage from 95.4% to 99.2%.

Changes:

  • In GetMappingMethods, count [GenerateAdapter] attributes on the host and only filter mappings by first-parameter adaptee type for multi-adapter hosts; single-adapter hosts retain all [AdapterMap]-annotated methods for downstream signature validation.
  • Add new TinyBDD scenarios covering unbound generic adaptees, malformed first-parameter cases (missing, wrong type, ref, this, scoped), method/property arity & type mismatches, abstract base + internal-ctor + ref readonly/enum-default emission, and metadata-only target/conflict paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/PatternKit.Generators/Adapter/AdapterGenerator.cs Branches mapping discovery by adapter attribute count so single-adapter hosts preserve malformed maps for PKADP005 reporting.
test/PatternKit.Generators.Tests/AdapterGeneratorTests.cs Adds three scenarios covering invalid map signatures, abstract-base + ref readonly/enum-default emission, and metadata-only target/conflict paths.

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

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

    12 files      12 suites   7m 4s ⏱️
 3 611 tests  3 611 ✅ 0 💤 0 ❌
10 844 runs  10 844 ✅ 0 💤 0 ❌

Results for commit 77e358a.

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

@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 95.86%. Comparing base (6c078e8) to head (77e358a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #420      +/-   ##
==========================================
+ Coverage   89.81%   95.86%   +6.04%     
==========================================
  Files         551      551              
  Lines       44183    44186       +3     
  Branches     6357     6359       +2     
==========================================
+ Hits        39684    42359    +2675     
+ Misses       1990     1827     -163     
+ Partials     2509        0    -2509     
Flag Coverage Δ
unittests 95.86% <100.00%> (+6.04%) ⬆️

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.

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/29/2026 - 05:14:24
  Coverage date: 05/29/2026 - 05:12:11 - 05/29/2026 - 05:14:12
  Parser: MultiReport (12x Cobertura)
  Assemblies: 5
  Classes: 1616
  Files: 551
  Line coverage: 95.5%
  Covered lines: 42217
  Uncovered lines: 1969
  Coverable lines: 44186
  Total lines: 95385
  Branch coverage: 77% (12496 of 16227)
  Covered branches: 12496
  Total branches: 16227
  Method coverage: 96.4% (8351 of 8658)
  Full method coverage: 89% (7712 of 8658)
  Covered methods: 8351
  Fully covered methods: 7712
  Total methods: 8658

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%

@JerrettDavis JerrettDavis changed the title Cover Adapter generator edge cases test: cover adapter generator edge cases May 29, 2026
@JerrettDavis
JerrettDavis merged commit 695af52 into main May 29, 2026
13 checks passed
@JerrettDavis
JerrettDavis deleted the test/adapter-generator-coverage-413 branch May 29, 2026 05:19
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