test: harden proxy generator coverage#480
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR strengthens the Proxy source generator’s coverage by adding regression tests around async suppression, parameter-default edge cases, and void delegation, and adjusts the generator’s delegation logic to honor the effective async mode when interceptors are absent.
Changes:
- Add generator tests for
GenerateAsync = falsewarning behavior + suppression of async interceptor hooks, reserved context parameter names,dynamicdefault values, and void delegation behavior. - Fix proxy generation so the “no interceptor” fast-path doesn’t emit
await/async behavior when async hooks are effectively disabled. - Update the Proxy generator documentation and change
GenerateProxyAttribute.GenerateAsync’s type.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/PatternKit.Generators.Tests/ProxyGeneratorTests.cs | Adds regression tests covering async suppression, reserved context names, dynamic defaults, params, and void delegation. |
| src/PatternKit.Generators/ProxyGenerator.cs | Ensures delegation code uses the same effective async mode as interceptor generation/configuration (prevents incorrect await emission). |
| src/PatternKit.Generators.Abstractions/Proxy/GenerateProxyAttribute.cs | Changes GenerateAsync property type (currently a breaking public API change). |
| docs/generators/proxy.md | Updates GenerateAsync type/docs in the attribute reference table. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// <summary> | ||
| /// Gets or sets whether async interceptor hooks should be generated. | ||
| /// If not specified, async support is inferred from the contract | ||
| /// (enabled if any member returns Task/ValueTask or has a CancellationToken parameter). | ||
| /// </summary> | ||
| public bool? GenerateAsync { get; set; } | ||
| public bool GenerateAsync { get; set; } | ||
|
|
Test Results 12 files 12 suites 12m 17s ⏱️ Results for commit 98d2e6e. ♻️ This comment has been updated with latest results. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #480 +/- ##
==========================================
+ Coverage 97.30% 97.47% +0.16%
==========================================
Files 579 579
Lines 47191 47161 -30
Branches 3076 6767 +3691
==========================================
+ Hits 45918 45968 +50
+ Misses 1273 1193 -80
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 PR Validation ResultsVersion: `` ✅ Validation Steps
📊 ArtifactsDry-run artifacts have been uploaded and will be available for 7 days. This comment was automatically generated by the PR validation workflow. |
ff1f79b to
98d2e6e
Compare
Code Coverage |
No description provided.