Auto-detect metadata-only CLI mode to suppress DB/transport init#2485
Merged
jeremydmiller merged 1 commit intomainfrom Apr 9, 2026
Merged
Auto-detect metadata-only CLI mode to suppress DB/transport init#2485jeremydmiller merged 1 commit intomainfrom
jeremydmiller merged 1 commit intomainfrom
Conversation
- Wolverine now detects codegen commands (via DynamicCodeBuilder.WithinCodegenCommand)
and OpenAPI generation tools (via ASPNETCORE_HOSTINGSTARTUPASSEMBLIES containing
"GetDocument") and automatically applies lightweight startup mode, suppressing
persistence and transport initialization.
- Replaced the Environment.CommandLine.Contains("codegen") code smell in
WolverineHttpEndpointRouteBuilderExtensions with DynamicCodeBuilder.WithinCodegenCommand.
- Added smoke tests verifying codegen preview and host startup work without DB.
- Added documentation in command-line.md explaining that CLI commands do not
require external connectivity.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Apr 11, 2026
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
Fixes #2471.
WolverineRuntime.StartAsyncnow callsapplyMetadataOnlyModeIfDetected()before any persistence or transport initialization. WhenDynamicCodeBuilder.WithinCodegenCommandis true (set by JasperFx when thecodegencommand is in the command-line args or when running with--start), Wolverine automatically applies lightweight startup settings: external transports are stubbed, durability agents are disabled, and the durability mode is set toMediatorOnly.ASPNETCORE_HOSTINGSTARTUPASSEMBLIESfor"GetDocument", which is set byMicrosoft.Extensions.ApiDescription.Server(GetDocument.Insider) when generating OpenAPI docs. This removes the need for users to addGetCommandLineArgsor assembly-name workarounds.Environment.CommandLine.Contains("codegen", StringComparison.OrdinalIgnoreCase)inWolverineHttpEndpointRouteBuilderExtensionswithDynamicCodeBuilder.WithinCodegenCommand.codegen previewbuilds without starting the host, one verifyingStartAsyncapplies lightweight mode whenWithinCodegenCommandis true.command-line.mdupdated with a section explaining that CLI diagnostic commands do not require external connectivity.Test plan
Bug_2471_codegen_without_connectivitytests pass (2/2)Wolverine.csprojbuilds with 0 errorsWolverine.Http.csprojbuilds with 0 errorsCoreTests.csprojbuilds with 0 errors🤖 Generated with Claude Code