Skip to content

Annotate Patching subsystem for AOT (slice 5)#79

Merged
jeremydmiller merged 1 commit into
mainfrom
feature/aot-patching
May 13, 2026
Merged

Annotate Patching subsystem for AOT (slice 5)#79
jeremydmiller merged 1 commit into
mainfrom
feature/aot-patching

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Summary

Fifth slice in Polecat's AOT-pillar (jasperfx#213) cleanup, following the Serializer (#74), ProjectionReplay (#75), LINQ (#76), and Storage/Registry (#77) slices already 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.

Applied class-level [UnconditionalSuppressMessage]:

File Codes
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)

Warning delta

Polecat.csproj IL warnings: 194 → 152 (-42).

Test plan

  • dotnet build src/Polecat/Polecat.csproj -c Debug — 0 errors, -42 IL warnings
  • dotnet build src/Polecat.Tests/Polecat.Tests.csproj -c Debug — 0 errors
  • CI passes

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>
@jeremydmiller jeremydmiller merged commit 3160324 into main May 13, 2026
6 checks passed
jeremydmiller added a commit that referenced this pull request May 13, 2026
Sixth slice in Polecat's AOT-pillar (jasperfx#213) cleanup, following the
Patching slice (#79).

The session + event-operations layer threads document and event types
through ISerializer (ToJson/FromJson), the JasperFx.Events event-registry
infrastructure (Event<T>.MakeGenericType + aggregator-source factories),
and JasperFx natural-key reflection. Document and event types are
preserved by registration on the caller side (Schema.For<T>() /
StoreOptions.Events.AddEventType / projection registration) per the AOT
publishing guide. AOT consumers supply a source-generator-backed
ISerializer impl.

Apply class-level [UnconditionalSuppressMessage] with justifications:

- Events/EventOperations: IL2026/IL2090/IL3050 (serializer + JasperFx.Events
  generic factories + FindNaturalKeyDefinition<T> property reflection)
- Internal/QuerySession (all partials): IL2026/IL3050 (load/query through
  ISerializer.FromJson)
- Internal/DocumentSessionBase: IL2026/IL3050 (store/update/delete through
  ISerializer.ToJson + inline projection runners)
- AdvancedOperations: IL2026/IL3050 (BulkInsertAsync /
  BulkInsertWithVersionAsync via ISerializer.ToJson)
- Events/EventGraph: IL2026/IL2057/IL3050 (EventRegistry extension, dynamic
  aggregate-type resolution by .NET type name as a fallback,
  Type.MakeGenericType for aggregator-source factories)
- Events/EventGraph.PolecatEventType: IL3050 (Wrap uses
  Event<T>.MakeGenericType for envelope construction)

194 → 88 unique IL warnings on this branch (-106 cumulative with #79's
-42; this slice alone accounts for -64).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jeremydmiller added a commit that referenced this pull request May 13, 2026
Final slice in Polecat's AOT-pillar (jasperfx#213) cleanup, following the
Patching slice (#79) and Operations/Sessions slice (#85). Annotates the
remaining reflective surfaces across projection storage, batching, result
readers, the LINQ parser pipeline, IoC service-collection extensions, and
flat-table projection helpers.

Apply class-level [UnconditionalSuppressMessage] with justifications:

Serializer consumers (IL2026 + IL3050):
- Projections/PolecatProjectionStorage
- Internal/Batching/QueryBatchItem (QueryListBatchItem + QueryFirstOrDefaultBatchItem)
- Internal/Batching/LoadBatchQueryItem
- Internal/Batching/LoadManyBatchQueryItem
- Internal/AdvancedSqlResultReader (JsonReader + DocumentReader)
- Events/Internal/PcEventsRowReader
- Events/Linq/EventListHandler
- Events/Daemon/PolecatEventLoader
- Linq/QueryHandlers/GroupByListHandler
- Events/Protected/StreamCompacting.StreamCompactingRequest<T>

JasperFx.Events projection registration (IL2026 + IL3050):
- Projections/PolecatProjectionOptions
- Projections/PolecatCompositeProjection

Expression.Lambda / Type.MakeGenericType (IL3050 only):
- Projections/Flattened/StatementMap<TEvent>
- Projections/Flattened/EventDeleter<TEvent>
- Linq/Parsing/WhereClauseParser
- Linq/Parsing/LinqQueryParser
- Linq/Parsing/GroupBySelectBuilder
- Linq/Joins/JoinResultSelectorRewriter
- Events/Operations/EventWhereClauseParser

IoC type-argument flow:
- PolecatStoreServiceCollectionExtensions: IL2091 (M.E.DI registration of T)
- PolecatConfigurationExpression: IL2087 (fluent generic flow)

194 → 106 unique IL warnings on this branch (-88). Combined with the open
slice 5 (#79, -42) and slice 6 (#85, -64), Polecat.csproj will be at or
near 0 IL warnings once all three merge.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller deleted the feature/aot-patching branch May 14, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant