Skip to content

Scrub all remaining JasperFx.CodeGeneration usages from Marten#4498

Merged
jeremydmiller merged 3 commits into
masterfrom
chore/scrub-jasperfx-codegen-namespace
May 19, 2026
Merged

Scrub all remaining JasperFx.CodeGeneration usages from Marten#4498
jeremydmiller merged 3 commits into
masterfrom
chore/scrub-jasperfx-codegen-namespace

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

The follow-up to #4461 ("Removing All Runtime Compilation From Marten"). That PR retired the JasperFx.RuntimeCompiler PackageReference and the major emission pipelines, but called out a remaining cleanup:

ICodeFileCollection / ICodeFile implementations on DocumentStore, StoreOptions, and EventGraph are vestigial but harmless. Cheap follow-up to remove once we've confirmed no third-party Critter-Stack tool walks them.

This PR is that follow-up, plus the long-tail of stale using JasperFx.CodeGeneration imports, the now-orphaned GenerateCode(...) interface methods + override bodies, the [Obsolete] StoreOptions codegen-config properties #4461 left as no-ops, and the dead MartenSnapshot fingerprint feature that existed only to invalidate codegen artifacts that no longer exist.

Summary

Code changes (commit 1): 113 files, +60 / −3387 = ~3,300 LOC net deleted.

  • 8 stale using JasperFx.CodeGeneration imports dropped — files had no actual type usage post-Removing All Runtime Compilation From Marten. (Boom) #4461.
  • 3 dead interface methods removed: IIdGeneration.GenerateCode, ISelectableColumn.GenerateCode, plus UpsertArgument.GenerateCodeTo* / GenerateBulkWriterCodeAsync virtuals (and MetadataColumn.setMemberFromReader). Cascade-deleted the override bodies across 8 identity strategies, 9 upsert-argument derivatives, 13 metadata columns, plus DataColumn / IdColumn / Events/Schema/VersionColumn. The types themselves are preserved as data carriers / config markers.
  • 5 whole-file deletions: Internal/CodeGeneration/MartenSnapshot.cs, MartenSnapshotInputs.cs, FrameCollectionExtensions.cs, StoreOptions.GeneratesCode.cs, Events/EventGraph.GeneratesCode.cs. Removed MartenSnapshot.VerifyAtBoot / PersistFingerprint calls from DocumentStore.cs and the two CoreTests covering them.
  • ICodeFileCollection / ICodeFile implementations dropped from DocumentStore, EventGraph, and StoreOptions (carried implicitly through deleting the GeneratesCode partials). Removed 2 services.AddSingleton<ICodeFileCollection>(...) DI registrations from MartenServiceCollectionExtensions.cs.
  • StoreOptions scrubbed: GeneratedCodeMode, SourceCodeWritingEnabled, GeneratedCodeOutputPath, AllowRuntimeCodeGeneration, SetApplicationProject, CreateGenerationRules, BuildFiles, _generatedCodeMode, PreferJasperFxMessage. Test-side cleanup deleted dozens of opts.GeneratedCodeMode = TypeLoadMode.X lines and several test files (e.g. CoreTests/Examples/CodeGenerationOptions.cs). ApplicationAssembly kept — AutoRegister and TryUseSourceGeneratedDiscovery legitimately need it as a scan hint.
  • Directory.Packages.props orphan JasperFx.RuntimeCompiler PackageVersion removed. Comments referencing RuntimeCompiler scrubbed in SecondaryStoreProxyFactory.cs, CompiledQueryHandlerRegistry.cs, DocumentStore.CompiledQueryCollection.cs, Internal/ProviderGraph.cs.
  • src/Marten/ is now free of JasperFx.CodeGeneration imports — grep -rn \"JasperFx\\.CodeGeneration\" src/Marten/ returns empty.

Doc changes (commit 2): 28 files, +108 / −148.

  • docs/migration-guide.md updated to say the codegen-config knobs are deleted (not [Obsolete]).
  • docs/configuration/cli.md Codegen warning reframed: dotnet run -- codegen write is no longer necessary for Marten; the codegen family stays exposed by the shared JasperFx CLI for tools like Wolverine that ship their own codegen.
  • docs/configuration/aot-publishing.md and docs/configuration/optimized_artifact_workflow.md corrected the "kept as [Obsolete] no-ops" claim to "deleted entirely."
  • docs/devops/devops.md Application-Dockerfile section dropped the RUN dotnet run -- codegen write step plus a Marten 9.0 tip. The recovered Docker content (the pre-9.0 multi-stage Dockerfile pattern) is captured in follow-up issues filed against Wolverine and JasperFx for re-publication in their docs.
  • docs/schema/index.md lost the stale opts.GeneratedCodeMode = TypeLoadMode.Auto warning.
  • All other docs/**.md changes are mdsnippets refreshes propagating the source-side scrubs from commit 1 (Startup.cs samples, hostbuilder snippets, ValueType / EventSourcing samples, etc.).

Test plan

  • Full solution build: 0 errors, 13 warnings (pre-existing — unrelated to this PR's diff).
  • CoreTests (net9.0): 411 pass, 1 skip, 0 fail.
  • DocumentDbTests (net9.0): 987 pass, 1 skip, 0 fail.
  • LinqTests (net9.0): 1257 pass, 1 skip, 0 fail.
  • mdsnippets clean.
  • markdownlint --disable MD009 clean across changed docs.
  • cspell --config ./docs/cSpell.json clean.
  • vitepress build docs exits 0.

Out of scope / follow-ups filed elsewhere

  • Recovered Docker / codegen write content for Wolverine + JasperFx: filed as follow-up issues in those repos (see PR description trail).
  • Test-project comments (Marten.AotSmoke, CompiledQueryTests, Marten.SourceGenerator.Tests) still reference JasperFx.RuntimeCompiler in code-comments only — left alone for a later AOT-publishing pass.
  • MetadataColumn.GenerateCode virtual on the base class is gone, but a couple of MetadataColumn<T> subclasses (HeadersColumn, etc.) retain internal EventTableColumn-style codegen overloads they were never asked about in the inventory — out of scope here.

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits May 19, 2026 11:41
PR #4461 removed the JasperFx.RuntimeCompiler PackageReference and
retired the major codegen surfaces. This is the long-tail cleanup of
the leftover `using JasperFx.CodeGeneration` imports, the now-orphaned
`GenerateCode(...)` interface methods + override bodies, the vestigial
ICodeFileCollection plumbing, the [Obsolete] StoreOptions
codegen-config properties, and the dead MartenSnapshot fingerprint
feature that existed to invalidate codegen artifacts that no longer
exist.

What changed (112 files, +60 / -3387):

- 8 stale `using JasperFx.CodeGeneration` imports dropped (no actual
  type usage post-#4461).
- 3 dead interface methods removed: `IIdGeneration.GenerateCode`,
  `ISelectableColumn.GenerateCode`, plus the
  `UpsertArgument.GenerateCodeTo*` / `GenerateBulkWriterCodeAsync`
  virtuals (+ `MetadataColumn.setMemberFromReader`). Cascade-deleted
  the override bodies across 8 identity strategies, 9 upsert-argument
  derivatives, 13 metadata columns, plus DataColumn / IdColumn /
  Events/Schema/VersionColumn. Each type itself is preserved as a
  data carrier / config marker.
- 5 whole-file deletions: `Internal/CodeGeneration/MartenSnapshot.cs`,
  `MartenSnapshotInputs.cs`, `FrameCollectionExtensions.cs`,
  `StoreOptions.GeneratesCode.cs`, `Events/EventGraph.GeneratesCode.cs`.
  Removed the `MartenSnapshot.VerifyAtBoot` / `PersistFingerprint`
  calls from `DocumentStore.cs` and the two CoreTests covering them.
- ICodeFileCollection / ICodeFile implementations dropped from
  `DocumentStore`, `EventGraph`, and `StoreOptions` (carried implicitly
  through deleting the GeneratesCode partials). Removed 2
  `services.AddSingleton<ICodeFileCollection>(...)` DI registrations
  from `MartenServiceCollectionExtensions.cs`.
- StoreOptions scrubbed: `GeneratedCodeMode`, `SourceCodeWritingEnabled`,
  `GeneratedCodeOutputPath`, `AllowRuntimeCodeGeneration`,
  `SetApplicationProject`, `CreateGenerationRules`, `BuildFiles`,
  `_generatedCodeMode`, `PreferJasperFxMessage`. Test-side cleanup
  deleted dozens of `opts.GeneratedCodeMode = TypeLoadMode.X` lines.
  `ApplicationAssembly` kept — `AutoRegister` and
  `TryUseSourceGeneratedDiscovery` legitimately need it as a scan
  hint.
- `Directory.Packages.props` orphan `JasperFx.RuntimeCompiler`
  PackageVersion line removed. Comments referencing RuntimeCompiler
  scrubbed in `SecondaryStoreProxyFactory.cs`,
  `CompiledQueryHandlerRegistry.cs`,
  `DocumentStore.CompiledQueryCollection.cs`,
  `Internal/ProviderGraph.cs`.

Verification:
- `src/Marten/` is now free of `JasperFx.CodeGeneration` imports —
  `grep -rn "JasperFx\.CodeGeneration" src/Marten/` returns empty.
- Full solution builds clean (0 errors).
- CoreTests 411/412 (1 pre-existing skip), DocumentDbTests 987/988
  (1 pre-existing skip), LinqTests 1257/1258 (1 pre-existing skip).

Doc updates and follow-up issues for the recovered Docker content
(now relevant to Wolverine / JasperFx rather than Marten) ship in
follow-up commits.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ing repos

The companion to the code cleanup. Codegen-removal-related doc pages
are slimmed to a brief "removed in 9.0, delete your Internal/Generated
folder, codegen write no longer needed for Marten" note; the rest of
the touched files are snippet refreshes from `mdsnippets` propagating
the source-side scrubs.

- docs/devops/devops.md — the application-Dockerfile section dropped
  the `RUN dotnet run -- codegen write` step + added a Marten-9.0 tip
  pointing at the new reality. The recovered Docker content (the
  pre-9.0 multi-stage Dockerfile that ran codegen-write in the build
  stage) is captured in the follow-up issues filed against the
  Wolverine and JasperFx repos for re-publication in their docs.
- docs/configuration/cli.md — the Codegen warning block reframed:
  the `codegen` family is still exposed by the shared JasperFx CLI
  (for tools like Wolverine that ship their own codegen), but
  `dotnet run -- codegen write` is no longer necessary for Marten.
- docs/configuration/aot-publishing.md — corrected the "kept as
  [Obsolete] no-ops" claim to "deleted entirely" for the codegen-
  config properties.
- docs/configuration/optimized_artifact_workflow.md — same correction;
  the `GeneratedCodeMode` line was dropped from the sample
  bootstrapping. Snippet wrappers replaced with inline code blocks
  since the two snippets (`sample_simplest_possible_setup`,
  `sample_using_optimized_artifact_workflow`) no longer have a source
  region.
- docs/migration-guide.md — the Runtime code generation removed
  section says the codegen-config knobs are deleted (not [Obsolete]);
  the Obsolete API sweep section drops the `GeneratedCodeMode`
  guidance.
- docs/schema/index.md — pulled the stale warning about
  `opts.GeneratedCodeMode = TypeLoadMode.Auto` requiring a manual
  `Internal/` delete; not applicable post-9.0.
- All other docs/**.md changes are `mdsnippets` refreshes propagated
  from the source-side scrubs in the previous commit (Startup.cs
  samples, hostbuilder snippets, ValueType / EventSourcing samples,
  etc.).

Verified: `mdsnippets` clean, `markdownlint --disable MD009` clean
across changed files, `cspell --config ./docs/cSpell.json` clean,
`vitepress build docs` exits 0.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@jeremydmiller jeremydmiller force-pushed the chore/scrub-jasperfx-codegen-namespace branch from 5572713 to baab62f Compare May 19, 2026 16:48
Master merged #4495 (ModularConfigTests) after I branched, so the
agent pass didn't see this fixture's `opts.GeneratedCodeMode =
TypeLoadMode.Auto;` line. Build failed on CI for both NET10 + NET9
matrix legs. Removing the now-deleted property reference + the
matching `using JasperFx.CodeGeneration` import.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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