CqrsMinimalApi: end-to-end production static-codegen example (no Roslyn)#4
Open
jeremydmiller wants to merge 2 commits into
Open
CqrsMinimalApi: end-to-end production static-codegen example (no Roslyn)#4jeremydmiller wants to merge 2 commits into
jeremydmiller wants to merge 2 commits into
Conversation
- WolverineFx.Http / .Marten 5.30.0 -> 6.0.0-rc.2; net9.0 -> net10.0 - Add WolverineFx.RuntimeCompilation (Wolverine 6 core no longer ships Roslyn; Dynamic TypeLoadMode needs it for dev/test) - Pin docker-compose postgres:latest -> postgres:17 (latest drifted to v18, whose data-dir layout breaks the /var/lib/postgresql/data mount) Tests: 5/5 pass against Postgres 17 on :5433. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Demonstrates the Wolverine 6 production workflow requested in wolverine#2900: pre-generate code and run TypeLoadMode.Static in production WITHOUT the WolverineFx.RuntimeCompilation (Roslyn) package, while keeping runtime compilation for local Debug/dev. - Program.cs: CritterStackDefaults Production -> TypeLoadMode.Static + AssertAllPreGeneratedTypesExist; RunJasperFxCommands(args) so `dotnet run -- codegen write` works. - CqrsMinimalApi.csproj: WolverineFx.RuntimeCompilation referenced only in Debug (correctly-formed '$(Configuration)' condition — note the typo gotcha from #2900). - Internal/Generated: committed pre-generated code (codegen write; metadata-only, no DB needed). - Dockerfile: codegen write -> publish Release -> Roslyn-free production image. - verify-production-build.sh: publishes Release and asserts no Wolverine.RuntimeCompilation / Microsoft.CodeAnalysis* / JasperFx.RuntimeCompiler in the output. - Tests/ProductionStaticCodegenTests: boots with ASPNETCORE_ENVIRONMENT=Production and serves a request, proving the Static pre-generated path runs with no runtime compilation. - README: workflow walkthrough + FAQ answering the #2900 questions. Verified locally: 6/6 tests pass; Release publish confirmed Roslyn-free. 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.
Addresses wolverine#2900 — an end-to-end example of removing
WolverineFx.RuntimeCompilation(Roslyn) from production builds.Extends the RC pilot CqrsMinimalApi into a working, proven example of the Wolverine 6 production code-generation workflow: pre-generate code and run
TypeLoadMode.Staticin production without theWolverineFx.RuntimeCompilationpackage, while keeping runtime compilation for local dev.What's added/changed (my commit)
Program.cs—CritterStackDefaults(x => { x.Production.GeneratedCodeMode = TypeLoadMode.Static; x.Production.AssertAllPreGeneratedTypesExist = true; }), andreturn await app.RunJasperFxCommands(args)sodotnet run -- codegen writeworks.CqrsMinimalApi.csproj—WolverineFx.RuntimeCompilationreferenced only in<ItemGroup Condition="'$(Configuration)' == 'Debug'">; calls out the malformed-$(Configuration)-condition gotcha from #2900.Internal/Generated/— committed pre-generated code (codegen write; metadata-only, no DB needed).Dockerfile—codegen write→dotnet publish -c Release→ Roslyn-free production image.verify-production-build.sh— publishes Release and asserts noWolverine.RuntimeCompilation/Microsoft.CodeAnalysis*/JasperFx.RuntimeCompiler.Tests/ProductionStaticCodegenTests— Alba host withUseEnvironment("Production")proving the Static pre-generated path boots + serves.README.md— workflow walkthrough + FAQ answering the #2900 questions.Verification (local)
dotnet test Tests→ 6/6 pass (5 existing endpoint tests + the new Production/Static boot test) against the repo's docker-compose Postgres../verify-production-build.sh→ PASS, Release publish confirmed Roslyn-free.🤖 Generated with Claude Code