Annotate Storage/Registry reflective surface for AOT (closes #73)#77
Merged
Conversation
The document-store core reflects against the document Type at multiple boundaries: DocumentMapping discovers the Id property + index/foreign-key attributes, DocumentMappingExpression auto-discovers subclass hierarchies via Assembly.GetTypes(), DocumentProviderRegistry reads non-public SubClasses/Indexes/ForeignKeys fields off the expression via reflection, and DocumentProvider serializes documents through ISerializer (RUC/RDC). DocumentStore.EventStoreExplorer reflects on Task<T>.Result and uses MethodInfo.MakeGenericMethod for the by-name RehydrateAtVersion overload. The document type T flows in from caller code at the registration boundary (Schema.For<T>()), so trimming sees and preserves T. AOT consumers must swap in a source-generator-backed ISerializer impl and preserve subclass types per the AOT publishing guide. Apply class-level [UnconditionalSuppressMessage] with justifications: - Storage/DocumentMapping: IL2026 (Assembly.GetTypes), IL2070 (PublicProperties) - Storage/DocumentMappingExpression: IL2026 (Assembly.GetTypes) - Internal/DocumentProviderRegistry: IL2075 (FieldInfo.GetValue cast) - Internal/DocumentProvider: IL2026/IL3050 (ISerializer.ToJson) - DocumentStore.EventStoreExplorer: IL2026/IL2075/IL3050 (RehydrateAtVersionByName reflective Task<T>.Result extraction + MakeGenericMethod; ISerializer.ToJson) 422 → 336 warnings (-86) in Polecat.csproj on this branch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
jeremydmiller
added a commit
that referenced
this pull request
May 13, 2026
Two updates to keep the migration-guide accurate as the 2026-wave alphas roll forward: - Bump the foundation-pin table to current Polecat 4 alpha versions: JasperFx alpha.8 → alpha.11, JasperFx.Events alpha.3 → alpha.4, Weasel.* alpha.2 → alpha.3. Note that the alpha line is still rolling forward and consumers should pin all five together. - Rewrite the AOT / codegen posture section to reflect the actual landed state: IsAotCompatible=true is set on the Polecat assembly (#67), and the reflective surfaces have been progressively annotated through #74 (serialization), #75 (projection replay), #76 (LINQ extension/provider), and #77 (storage / registry / event-store explorer). Link out to the cross-stack "Publishing AOT with JasperFx" guide on jasperfx.github.io for the end-to-end walkthrough. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
jeremydmiller
added a commit
that referenced
this pull request
May 13, 2026
Fifth slice in Polecat's AOT-pillar (jasperfx#213) cleanup, following the Serializer (#74), ProjectionReplay (#75), LINQ (#76), and Storage/Registry (#77) slices that have landed on main. The patching subsystem reflects on the document's property expressions to build JSON path strings and feeds the resulting patch values through ISerializer.ToJson when emitting JSON_MODIFY() SQL. JsonPathHelper also compiles small Expression.Lambda delegates to evaluate constant sub- expressions during path resolution. Document types T flow in from Schema.For<T>() / IDocumentSession.Patch<T>() at the registration boundary and are preserved per the AOT publishing guide; AOT consumers supply a source-generator-backed ISerializer impl. Apply class-level [UnconditionalSuppressMessage] with justifications: - Patching/PatchExpression<T>: IL2026/IL3050 (ISerializer.ToJson on patch values) - Patching/PatchOperation: IL2026/IL3050 (ISerializer.ToJson when building JSON_MODIFY commands) - Patching/JsonPathHelper: IL3050 (Expression.Lambda for constant sub-expression evaluation) 194 → 152 unique IL warnings (-42) in Polecat.csproj. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Annotate Polecat's document-store core (DocumentMapping, DocumentProviderRegistry, DocumentProvider, DocumentMappingExpression, DocumentStore.EventStoreExplorer) so AOT smoke tests can run under
WarningsAsErrors=IL*. Slice 4 of the AOT pillar (after #67 base config, #74 serializer, #75 ProjectionReplay, #76 LINQ).The document type
Tflows in from caller code at the registration boundary (Schema.For<T>()), so trimming sees and preservesTplus its public surface. AOT consumers must swap in a source-generator-backedISerializerimpl and preserve subclass types per the AOT publishing guide.Applied class-level
[UnconditionalSuppressMessage]:Storage/DocumentMapping— IL2026 (Assembly.GetTypes()inAddSubClassHierarchy), IL2070 (PublicPropertiesdiscovery for Id /[Index]/[UniqueIndex])Storage/DocumentMappingExpression— IL2026 (Assembly.GetTypes()subclass discovery)Internal/DocumentProviderRegistry— IL2075 (non-public field reflection onDocumentMappingExpression<T>)Internal/DocumentProvider— IL2026/IL3050 (consumer ofISerializer.ToJson)DocumentStore.EventStoreExplorer— IL2026/IL2075/IL3050 (reflectiveTask<T>.Resultextraction +MethodInfo.MakeGenericMethodforRehydrateAtVersionByNameAsync;ISerializer.ToJson)Warning delta
Polecat.csprojIL warnings on this branch: 422 → 336 (-86).Independent of #75 (ProjectionReplay) and #76 (LINQ); when all three land together, total will drop substantially further.
Test plan
dotnet build src/Polecat/Polecat.csproj -c Debug— no new errors, -86 IL warningsdotnet build src/Polecat.Tests/Polecat.Tests.csproj -c Debug— green🤖 Generated with Claude Code