Skip to content

test: harden composer generator coverage#481

Merged
JerrettDavis merged 1 commit into
mainfrom
coverage/harden-composer-generator-413
May 31, 2026
Merged

test: harden composer generator coverage#481
JerrettDavis merged 1 commit into
mainfrom
coverage/harden-composer-generator-413

Conversation

@JerrettDavis

Copy link
Copy Markdown
Owner

No description provided.

@github-actions

github-actions Bot commented May 31, 2026

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

@JerrettDavis JerrettDavis force-pushed the coverage/harden-composer-generator-413 branch from 731aa6e to 2ff3c98 Compare May 31, 2026 17:51
@github-actions github-actions Bot added size/m and removed size/l labels May 31, 2026

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 hardens the Composer source-generator’s coverage by adding additional Roslyn-based tests, and aligns the Composer attribute/docs with updated async-generation configuration semantics.

Changes:

  • Added new Composer generator tests covering explicit async-disable diagnostics, deterministic ordering with ignored steps, struct async terminals without CancellationToken, and invalid “next” signatures.
  • Changed ComposerAttribute.GenerateAsync from bool? to bool and updated its inline documentation.
  • Reformatted/updated the Composer generator documentation, including the GenerateAsync attribute table entry.

Reviewed changes

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

File Description
test/PatternKit.Generators.Tests/ComposerGeneratorTests.cs Adds new coverage scenarios for async enablement, ordering/ignore behavior, struct async terminal shape, and invalid signatures.
src/PatternKit.Generators.Abstractions/Composer/ComposerAttribute.cs Updates async-generation configuration surface (GenerateAsync) and XML docs.
docs/generators/composer.md Updates Composer generator documentation formatting and GenerateAsync attribute documentation.
Comments suppressed due to low confidence (4)

docs/generators/composer.md:93

  • The async step signature shown here implies CancellationToken is required, but the generator accepts async steps with only (TIn input, Func<TIn, ValueTask<TOut>> next) (no warning/diagnostic is emitted when the token is omitted). The docs should reflect that CancellationToken is optional.
### Async Steps
```csharp
ValueTask<TOut> StepNameAsync(TIn input, Func<TIn, ValueTask<TOut>> next, CancellationToken ct)
  • input: The pipeline input (not in for async)
  • next: Async delegate to call the next step
  • ct: CancellationToken for cooperative cancellation
**docs/generators/composer.md:107**
* The async terminal signature shown here implies `CancellationToken` is required, but the generator accepts async terminals with only a single input parameter (and does not warn/diagnose when `CancellationToken` is omitted). The docs should reflect the optional token.

Async Terminal

ValueTask<TOut> TerminalNameAsync(TIn input, CancellationToken ct)
**docs/generators/composer.md:210**
* PKCOM009 is documented as "Async method missing CancellationToken parameter", but the current generator only reports PKCOM009 when a CancellationToken-like parameter is present with the wrong type (it does not warn when the token is omitted). Update the description to match the actual behavior.

| PKCOM008 | Error | Async step detected but async generation disabled |
| PKCOM009 | Warning | Async method missing CancellationToken parameter |

**docs/generators/composer.md:5**
* This markdown file appears to have been committed with CRLF line endings (visible as `\r` in the rendered diff/tool output), which violates the repo-wide `.editorconfig` setting `end_of_line = lf`. Please normalize this file back to LF-only to avoid churn and formatting/tooling issues.

Composer Generator

Overview

The Composer Generator creates deterministic pipeline compositions from ordered step methods. It eliminates boilerplate by automatically generating Invoke and InvokeAsync methods that compose your pipeline steps in order, wrapping each step around the next until reaching a terminal handler.

</details>



---

💡 <a href="/JerrettDavis/PatternKit/new/main?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.

Comment on lines 23 to +27
/// Gets or sets whether to generate async methods.
/// When null (default), async generation is inferred from the presence of async steps or terminal.
/// Note: Nullable bool in attributes is non-standard but supported by C#.
/// Set to true/false explicitly to control async generation, or leave unset for inference.
/// When omitted, async generation is inferred from the presence of async steps or terminal.
/// Set to true/false explicitly to control async generation.
/// </summary>
public bool? GenerateAsync { get; set; }
public bool GenerateAsync { get; set; }
Comment on lines 22 to 26
/// <summary>
/// Gets or sets whether to generate async methods.
/// When null (default), async generation is inferred from the presence of async steps or terminal.
/// Note: Nullable bool in attributes is non-standard but supported by C#.
/// Set to true/false explicitly to control async generation, or leave unset for inference.
/// When omitted, async generation is inferred from the presence of async steps or terminal.
/// Set to true/false explicitly to control async generation.
/// </summary>
Comment on lines +1252 to +1253
var comp = RoslynTestHelpers.CreateCompilation(source, nameof(InvalidStep_WithFunctionPointerNext_ReportsDiagnostic));
var gen = new ComposerGenerator();
@github-actions

github-actions Bot commented May 31, 2026

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/31/2026 - 17:56:04
  Coverage date: 05/31/2026 - 17:54:23 - 05/31/2026 - 17:55:55
  Parser: MultiReport (12x Cobertura)
  Assemblies: 5
  Classes: 1715
  Files: 579
  Line coverage: 97.4%
  Covered lines: 45947
  Uncovered lines: 1214
  Coverable lines: 47161
  Total lines: 100732
  Branch coverage: 84.4% (14563 of 17248)
  Covered branches: 14563
  Total branches: 17248
  Method coverage: 97.2% (8971 of 9227)
  Full method coverage: 91.6% (8452 of 9227)
  Covered methods: 8971
  Fully covered methods: 8452
  Total methods: 9227

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%

@codecov

codecov Bot commented May 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.50%. Comparing base (6c0f5cf) to head (2ff3c98).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #481      +/-   ##
==========================================
+ Coverage   97.39%   97.50%   +0.11%     
==========================================
  Files         579      579              
  Lines       47161    47161              
  Branches     3070     5138    +2068     
==========================================
+ Hits        45931    45983      +52     
+ Misses       1230     1178      -52     
Flag Coverage Δ
unittests 97.50% <100.00%> (+0.11%) ⬆️

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

Test Results

    12 files      12 suites   11m 5s ⏱️
 4 044 tests  4 044 ✅ 0 💤 0 ❌
12 563 runs  12 563 ✅ 0 💤 0 ❌

Results for commit 2ff3c98.

@JerrettDavis JerrettDavis merged commit 85fa569 into main May 31, 2026
12 checks passed
@JerrettDavis JerrettDavis deleted the coverage/harden-composer-generator-413 branch May 31, 2026 18:05
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