Skip to content

Marten#4471: Inventory test-library projections (audit report)#4485

Merged
jeremydmiller merged 1 commit into
masterfrom
feat/4471-projection-audit
May 19, 2026
Merged

Marten#4471: Inventory test-library projections (audit report)#4485
jeremydmiller merged 1 commit into
masterfrom
feat/4471-projection-audit

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Summary

Refs #4471 — pre-9.0 audit of every projection-shaped type across Marten's test libraries against the source-generator-only dispatch path introduced by #276 Phase 2 (PR #4475).

This PR lands the inventory document only. The companion automated dispatcher-coverage regression guard (extending Marten.AotSmoke) is tracked as a follow-up so it can land in its own PR.

What's in the inventory

audit/projections-inventory.md — 239 dispatcher emission sites across the in-scope test projects + samples + DocSamples, classified by SG emission pattern:

  • 221 projection-subclass types (Pattern A — partial merge) — SG emits a partial declaration that merges into the user's class
    • 189 are partial (SG dispatcher expected)
    • 30 are non-partial with no Apply/Create methods (lookup-only — no SG emission expected)
    • 2 implement IProjection.ApplyAsync directly (SignalRProducer, KafkaProducer — low-level handlers, no SG emission expected)
    • 29 override Evolve / EvolveAsync (deliberate SG bypass)
    • 8 override DetermineAction / DetermineActionAsync (deliberate SG bypass)
  • 18 self-aggregating aggregate types (Pattern B — sibling XEvolver) — SG emits a separate evolver class plus an [assembly: GeneratedEvolver(typeof(X), typeof(XEvolver))] registration. The aggregate type itself does not need partial.

SG gaps surfaced

Zero. A representative SG-emit dump (-p:EmitCompilerGeneratedFiles=true on EventSourcingTests) produced 191 .g.cs dispatcher files for that project alone. Combined with the green build (CS0260 would surface any non-partial Pattern-A source) and green test runs (any Pattern-B-expected aggregate missing emission would throw InvalidProjectionException at host build), Phase 2's adoption is complete across the test libraries.

What this PR does NOT include

  • The automated dispatcher-coverage regression guard — per acceptance criteria, this should extend Marten.AotSmoke so future SG regressions trip CI. Filed as a follow-up issue.
  • Any rewrites — none are needed; zero gaps surfaced.
  • Test-suite re-run — Phase 2's baseline (EventSourcingTests 1320/0/7, DaemonTests 183/0/1, CoreTests 444/0/1) remains the source of truth.

Refs #4471. Do NOT auto-close — the follow-up regression-guard work is the actual close trigger for the issue.

🤖 Generated with Claude Code

Phase 2 (PR #4475) made JasperFx.Events.SourceGenerator the only
projection-apply path. This audit walks every projection-shaped
type across src/EventSourcingTests, src/DaemonTests, src/CoreTests,
src/DocumentDbTests, src/MultiTenancyTests, src/PatchingTests,
src/samples, and src/DocSamples, and inventories the SG dispatch
shape per type.

Two SG emission patterns surfaced from a representative dump
(-p:EmitCompilerGeneratedFiles=true on EventSourcingTests):

  Pattern A — projection subclass: SG emits a partial declaration
  that merges into the user's class. Source must be partial. This
  is the source of Phase 2's ~80 partial annotations on test-library
  projection subclasses.

  Pattern B — self-aggregating aggregate: SG emits a separate sibling
  `XEvolver` class plus an [assembly: GeneratedEvolver(typeof(X),
  typeof(XEvolver))] registration. Aggregate type does NOT need
  partial — the evolver is an independent type calling the
  aggregate's public methods.

Headline counts:

  221 projection-subclass types (Pattern-A emit)
  - 189 partial (SG-merged dispatcher expected)
  - 30 non-partial with no Apply/Create (no SG emission expected)
  - 2 non-partial implementing IProjection.ApplyAsync directly
    (SignalRProducer / KafkaProducer; low-level handlers, no SG
    emission expected)
  - 29 explicit Evolve/EvolveAsync override (deliberate SG bypass)
  - 8 explicit DetermineAction/DetermineActionAsync override
    (deliberate SG bypass)

  18 self-aggregating aggregate types (Pattern-B emit)

  Total dispatcher emission sites: 239
  SG gaps surfaced: 0

Inventory landed under audit/projections-inventory.md. No code
changes; this commit is documentation-only. Follow-up: extend
Marten.AotSmoke with an automated dispatcher-coverage assertion so
future SG regressions trip CI immediately (tracked separately).

Refs #4471.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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