refactor(generator): split source generator into cohesive files + safe perf wins#113
Merged
antosubash merged 39 commits intomainfrom Apr 15, 2026
Merged
refactor(generator): split source generator into cohesive files + safe perf wins#113antosubash merged 39 commits intomainfrom
antosubash merged 39 commits intomainfrom
Conversation
Replace the 17 scattered GetTypeByMetadataName calls at the top and throughout Extract with a single CoreSymbols.TryResolve call, then thread the resolved symbols through downstream finder invocations via the s.Field naming convention.
… file to 135 lines
…Discover* Move the Step 2 (contracts-assembly map), Step 3 (interface scan), and Step 3b (implementation scan) blocks from SymbolDiscovery.Extract into two new orchestration methods: ContractFinder.BuildContractsAssemblyMap and ContractFinder.DiscoverInterfacesAndImplementations. The convention-DTO scan block between them remains in Extract.
…to PermissionFeatureFinder.Discover*
Move mutable working types (ModuleInfo, EndpointInfo, ViewInfo, etc.) from DataRecords.cs into WorkingTypes.cs, and extract ExtractDtoProperties + HasJsonIgnoreAttribute from DtoFinder.cs into DtoPropertyExtractor.cs.
…file Move all DiagnosticDescriptor static fields from DiagnosticEmitter into a dedicated DiagnosticDescriptors static class. Fixes the one external reference in HostDbContextEmitter to use the new class as well.
…ference re-iterations
Adds a reflection-based test that snapshots all 38 DiagnosticDescriptor fields from DiagnosticDescriptors (ID, severity, category) and asserts they match the post-refactor baseline. Any accidental add, remove, or change to a descriptor will fail the test.
Deploying simplemodule-website with
|
| Latest commit: |
a9cd233
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://deb5972c.simplemodule-website.pages.dev |
| Branch Preview URL: | https://feature-xenodochial-brown.simplemodule-website.pages.dev |
Deploying simplemodule-docs with
|
| Latest commit: |
686318d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://237e287b.simplemodule.pages.dev |
| Branch Preview URL: | https://feature-xenodochial-brown.simplemodule.pages.dev |
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.
Summary
SimpleModule.Generatorfrom 3 monolithic files into ~30 cohesive files, all under 300 linesWhat moved
Discovery/SymbolDiscovery.csDiscovery/DiscoveryData.csEmitters/DiagnosticEmitter.csNew structure:
Discovery/CoreSymbols.cs— one-shot type resolution recordDiscovery/Finders/— 9 finder classes (Module, Endpoint, Dto, DbContext, Contract, PermissionFeature, Interceptor, Vogen, Agent) +DtoPropertyExtractorDiscovery/Records/ModuleRecords.cs,DataRecords.cs,WorkingTypes.csDiscovery/SymbolHelpers.cs,AssemblyConventions.cs,DependencyAnalyzer.cs,DiscoveryDataBuilder.csEmitters/Diagnostics/— 6 checker classes + 6 partial descriptor files (by concern)Perf wins
CoreSymbolsrecordGetTypeByMetadataNamecalls → 1 per Extractcompilation.References→ 1moduleNsByNameFindClosestModuleNameSystem/Microsoft/Vogentree walksScoped attributed-DTO discovery was attempted (restrict
[Dto]scan to module + host assemblies) but reverted per the plan's gate — it shifted the DTO emission order without dropping/adding any DTO.Design docs
Test plan
dotnet build— 0 errors, 0 warnings underTreatWarningsAsErrorsdotnet test tests/SimpleModule.Generator.Tests— 195/195 pass (193 existing + 2 new:IncrementalCachingTests,DiagnosticCatalogTests)