feat(tests): add scrubbers for dynamic snapshot values#273
Merged
j-d-ha merged 7 commits intoDec 22, 2025
Conversation
…neratedCode attributes - Introduced RegexHelper for replacing specific GeneratedCode attribute values in tests. - Updated `GeneratorTestHelpers` to use scrubbing logic for verification snapshots. - Adjusted existing test snapshots to align with the new scrubbing behavior.
- Introduced RegexHelper method to scrub [InterceptsLocation(...)] lines in test snapshots. - Updated `GeneratorTestHelpers` with logic to replace InterceptsLocation attribute values. - Enhanced snapshot verification to ensure consistency with new scrubbing behavior.
…elpers - Updated `RegexHelper.GeneratedCodeAttributeRegex` to use a simplified pattern for GeneratedCode attributes. - Refactored `GeneratorTestHelpers` to remove redundant generator arguments for clarity. - Optimized test snapshot handling logic to reduce complexity.
- Adjusted `GeneratedCodeAttributeRegex` pattern to use an updated inline formatting approach. - Changed `RegexHelper` class to be `static` for better utility alignment.
…plify usage - Removed redundant fields and constructors for generator name and version in `MapHandlerIncrementalGenerator`. - Moved `GeneratedCodeAttribute` logic to a single utility property in `LambdaHostOutputGenerator`. - Updated generator outputs to reference `LambdaHostOutputGenerator.GeneratedCodeAttribute` directly. - Simplified method signatures across output generator classes by removing unnecessary parameters.
- Added LH0005 and LH0006 to `AnalyzerReleases.Shipped.md` under version 2.1.1. - Removed LH0001 from `AnalyzerReleases.Shipped.md` for version 2.0.0. - Cleared `AnalyzerReleases.Unshipped.md` to reflect updates in shipped release notes.
- Updated `.claude/commands/pr.md` to include "tests" in the list of valid PR scopes. - Modified `.github/workflows/validate-pr-title.yaml` to recognize "tests" as an allowed PR title scope.
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #273 +/- ##
==========================================
+ Coverage 88.89% 88.96% +0.06%
==========================================
Files 132 132
Lines 3270 3252 -18
Branches 324 326 +2
==========================================
- Hits 2907 2893 -14
+ Misses 247 242 -5
- Partials 116 117 +1
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
j-d-ha
deleted the
feature/#263-add-scrubbers-for-dynamic-snapshot-values
branch
December 22, 2025 01:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



🚀 Pull Request
📋 Summary
This PR implements standardized scrubbers in Verify tests to automatically normalize dynamic values that change between test runs, specifically
GeneratedCodeAttributeversion information andInterceptsLocationhash values.Key Changes
LambdaHostOutputGenerator: MovedGeneratedCodeAttributecreation into a static property with backing field, eliminating the need to pass it through the entire generation pipelineMapHandlerIncrementalGeneratorconstructor - version info is now handled internally via reflectionGeneratedCodeAttributeRegex: Replaces version info in[GeneratedCode(...)]attributesInterceptsLocationRegex: Replaces base64-encoded hash values in[InterceptsLocation(...)]attributesREPLACEDfor consistent verification)Benefits
✅ Checklist
🧪 Related Issues or PRs
Closes #263
💬 Notes for Reviewers
The bulk of the diff is regenerated snapshot files (94 files) with scrubbed attribute values. The core logic changes are:
GeneratorTestHelpers.cs- Added scrubbing logic and regex helpersLambdaHostOutputGenerator.cs- CentralizedGeneratedCodeAttributecreationMapHandlerIncrementalGenerator.cs- Removed constructor overloadAll tests pass with the new scrubbing approach, ensuring snapshots remain stable across builds.