test: harden content enricher policy generation#475
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 hardens the ContentEnricherGenerator by validating DefaultPolicy and per-step Policy values before source emission, and adds generator tests to cover the newly enforced invalid-policy diagnostic paths (PKMCE004). This aligns with the repo’s coverage goals (Issue #413) by exercising previously uncovered validation branches in a source generator.
Changes:
- Add generator-time validation that rejects unsupported
DefaultPolicyvalues with PKMCE004 (instead of generating invalid source). - Add generator-time validation that rejects unsupported per-step
Policyvalues with PKMCE004. - Add TinyBDD/xUnit scenarios verifying both invalid policy diagnostics and their messages.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/PatternKit.Generators/Messaging/ContentEnricherGenerator.cs |
Adds IsKnownPolicy checks for default and step policies and reports PKMCE004 early to prevent invalid emitted code. |
test/PatternKit.Generators.Tests/ContentEnricherGeneratorTests.cs |
Adds scenarios covering invalid default policy and invalid step policy diagnostics/messages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test Results 12 files 12 suites 10m 58s ⏱️ Results for commit 802e94e. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #475 +/- ##
==========================================
+ Coverage 97.24% 97.34% +0.10%
==========================================
Files 579 579
Lines 47180 47187 +7
Branches 3079 6771 +3692
==========================================
+ Hits 45882 45936 +54
+ Misses 1298 1251 -47
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:
|
Code Coverage |
🔍 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. |
Summary
Refs #413
Verification