test: cover audit log generator hosts#431
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 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
partialtype 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.
| 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); | ||
| } |
Test Results 12 files 12 suites 9m 42s ⏱️ Results for commit 04246c4. |
🔍 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. |
Code Coverage |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
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:
|
Summary:
Coverage:
Validation:
Closes part of #413.