F# codegen: behavioural run-step under TypeLoadMode.Static (GH-2969)#2987
Merged
Conversation
…H-2969) Adds the run-verified harness the audit was missing: every prior slice is a compile-gate (proves the generated F# compiles); this proves it RUNS. Wolverine.Behavioural.FSharpApp (F#) is a self-contained "application assembly" carrying BOTH an F# handler (BehaviouralPingHandler, records to an in-process sink) AND its pre-generated F# adapter (Generated.fs). Wolverine.Behavioural.FSharpTests: - generated_fsharp_handler_runs_under_static_load: boots a real Wolverine host with TypeLoadMode.Static + ApplicationAssembly = the F# app, sends a BehaviouralPing, and asserts the sink recorded it — i.e. Wolverine loaded the pre-generated F# MessageHandler by name (BehaviouralPingHandler<hash>) and executed it, no Roslyn at runtime. - generated_fsharp_regenerates_and_compiles: regenerates Generated.fs from the SHARED BehaviouralCodegen.Configure and dotnet-builds the app, so the committed F# adapter can't silently drift from the codegen output (the shared config keeps the generated type-name hash in sync between generation and the runtime host). Key mechanics: set opts.ApplicationAssembly (cascades to CodeGeneration.ApplicationAssembly and survives bootstrap because _applicationAssembly is non-null) so static load scans the F# app, not the test assembly; the generated F# type is public (exported) and QuickBuild instantiates it via its primary constructor. Wire-up: app + test added to wolverine_fsharp.slnx; fsharp.yml runs the behavioural run-step as its own sequential step. No production-code changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced May 29, 2026
This was referenced Jun 1, 2026
Merged
This was referenced Jun 4, 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.
Part of the F# code-generation audit (#2969). Every slice so far is a compile-gate (proves the generated F# compiles). This adds the missing run-verified harness: it boots a real Wolverine host in
TypeLoadMode.Staticagainst a pre-generated F# handler adapter and asserts the handler actually executes.How it works
Wolverine.Behavioural.FSharpApp(F#) is a self-contained application assembly carrying BOTH an F# handler (BehaviouralPingHandler, which records to an in-process sink) AND its pre-generated F# adapter (Generated.fs).Wolverine.Behavioural.FSharpTests:generated_fsharp_handler_runs_under_static_load— boots a host withTypeLoadMode.Static+ApplicationAssembly= the F# app, sends aBehaviouralPing(42), and asserts the sink recorded42. Wolverine loads the pre-generated F#MessageHandlerby name (BehaviouralPingHandler1244766258) from the app's exported types and executes it — no Roslyn at runtime.generated_fsharp_regenerates_and_compiles— regeneratesGenerated.fsfrom the sharedBehaviouralCodegen.Configureanddotnet builds the app, so the committed F# adapter can't silently drift from the codegen output.Key mechanics discovered
opts.ApplicationAssembly(not justCodeGeneration.ApplicationAssembly) — it cascades toCodeGeneration.ApplicationAssemblyand survives bootstrap (the re-establish step is gated on_applicationAssembly == null), so static load scans the F# app, not the test assembly.assembly.ExportedTypes.FirstOrDefault(x => x.Name == TypeName)finds it, andQuickBuildinstantiates it via its primary constructor — F# generated handlers slot straight into Wolverine's static loader.ExpectedTypeMissingExceptionat startup — a loud signal).Wire-up & verification
wolverine_fsharp.slnx;fsharp.ymlruns the behavioural run-step as its own sequential step.wolverine_fsharp.slnxbuilds clean. No production-code changes (pure test/harness), sowolverine.slnxis unaffected.This upgrades the audit's strongest guarantee from "the generated F# compiles" to "the generated F# compiles and runs," and is the template for run-verifying any future slice.
🤖 Generated with Claude Code