Skip to content

fix: marten 9 — declare conventional projections partial for source-gen dispatch#32

Merged
erikshafer merged 3 commits into
mainfrom
fix/marten9-projection-source-gen
Jun 13, 2026
Merged

fix: marten 9 — declare conventional projections partial for source-gen dispatch#32
erikshafer merged 3 commits into
mainfrom
fix/marten9-projection-source-gen

Conversation

@erikshafer

Copy link
Copy Markdown
Owner

Un-reds main. The 2f83e66 package bump moved the project to Marten 9 / JasperFx 2.0, which removed runtime codegen for conventional projections — Apply/Create are now dispatched by the compile-time JasperFx.Events.SourceGenerator, with no runtime fallback. The generator only augments partial classes, and CritterCab's three projection subclasses weren't partial, so every test died at host startup with InvalidProjectionException: No source-generated dispatcher found ….

This is pre-existing main breakage, not a regression from PR #31 (Aspire): main's CI for 2f83e66 (run 27477344974) is already failure. PR #31 was just the first PR-triggered CI run to surface it.

The fix

Declare the three conventional projection subclasses partial:

  • ActiveRequestsByRiderProjection : MultiStreamProjection<ActiveRideRequest, Guid>
  • RequestTimelineProjection : SingleStreamProjection<RequestTimeline, Guid>
  • FareQuoteAttemptsProjection : SingleStreamProjection<FareQuoteAttempts, Guid>

RideRequest (the self-aggregating LiveStreamAggregation<RideRequest> target) does not need partial per the exception message and is left untouched.

Verification

dotnet test CritterCab.slnx (Docker-backed Testcontainers Postgres): 7/8 failing → 8/8 passing. The source generator's analyzer asset flows transitively through WolverineFx.MartenMarten — no .csproj change and nothing registered in Program.cs; partial was the complete fix.

Sequencing

Merge this first to green main; then PR #31 (tidy: aspire) rebases onto the fixed main and its CI goes green.

Scope

Narrow on purpose. The remaining Marten 9 / Wolverine 6 migration audit (IRevisioned/ILongVersioned, inline-lambda projection removal, ServiceLocationPolicy flip, etc.) and the version doc-drift stay deferred to their own session — none currently reds CI.


Prompt: docs/prompts/fix-marten9-projection-source-gen.md · Retro: docs/retrospectives/fix-marten9-projection-source-gen.md · Null spec-delta.

…en dispatch

Marten 9 / JasperFx 2.0 removed runtime codegen for conventional projections; Apply/Create are now dispatched by the compile-time JasperFx.Events.SourceGenerator, which only augments partial classes (no runtime fallback). Declaring ActiveRequestsByRiderProjection, RequestTimelineProjection, and FareQuoteAttemptsProjection partial restores dispatcher generation. dotnet test CritterCab.slnx: 7/8 failing -> 8/8 green. The analyzer flows transitively via WolverineFx.Marten -> Marten; no csproj change needed. RideRequest (self-aggregating LiveStreamAggregation target) does not need partial and is untouched.
@erikshafer erikshafer merged commit d3aebb9 into main Jun 13, 2026
1 check passed
@erikshafer erikshafer deleted the fix/marten9-projection-source-gen branch June 13, 2026 21:58
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