Skip to content

Honor shared JasperFx.IdentityAttribute in Polecat aggregate id resolution (closes #3117) - #3118

Merged
jeremydmiller merged 2 commits into
mainfrom
fix-3117-polecat-shared-identity-attribute
Jun 16, 2026
Merged

jeremydmiller merged 2 commits into
mainfrom
fix-3117-polecat-shared-identity-attribute

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Problem

Wolverine.Polecat's aggregate-handler codegen only recognized its own Wolverine.Polecat.IdentityAttribute when resolving which command member is the aggregate stream id. Because the bare IdentityAttribute reference in AggregateHandling.cs resolves to the Polecat-local type (the file lives in the Wolverine.Polecat namespace), the shared JasperFx.IdentityAttribute used across the rest of the Critter Stack — and honored by Wolverine.Marten — was ignored.

This broke store-agnostic command/aggregate models meant to compile and codegen against both Marten and Polecat from a single shared source, throwing:

System.InvalidOperationException: Unable to determine the aggregate id for aggregate type ServiceSummary
on command type UpdateLabelName. ...

The identical model codegens fine under Marten, whose resolver picks up JasperFx.IdentityAttribute (Marten has no namespace-local IdentityAttribute, so using JasperFx; wins).

Fix

AggregateHandling.DetermineAggregateIdMember now recognizes both Wolverine.Polecat.IdentityAttribute and the shared JasperFx.IdentityAttribute, matching Marten's behavior. A single shared [Identity] source now codegens against both stores without the per-project global using IdentityAttribute = Wolverine.Polecat.IdentityAttribute; alias workaround. The "unable to determine" error message also names both attributes.

Tests

Added determine_aggregate_id_with_shared_jasperfx_identity_attribute to PolecatTests.AggregateHandlerWorkflow.AggregateHandlerAttributeTests, using a command record decorated with the fully-qualified [property: JasperFx.Identity] attribute. All 15 tests in the suite pass.

Closes #3117

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits June 16, 2026 10:57
…ution (closes #3117)

Wolverine.Polecat's aggregate-handler codegen only recognized its own
Wolverine.Polecat.IdentityAttribute when resolving the aggregate stream id
member. Because the file's bare `IdentityAttribute` resolves to the
Polecat-local type, the shared JasperFx.IdentityAttribute used by the rest
of the Critter Stack (and honored by Wolverine.Marten) was ignored, breaking
store-agnostic command/aggregate models meant to codegen against both stores.

DetermineAggregateIdMember now recognizes both attributes, matching Marten's
behavior so a single shared source can target Marten and Polecat without a
per-store attribute alias. The error message also names both attributes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…gate identity

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jeremydmiller
jeremydmiller merged commit 74e154b into main Jun 16, 2026
24 checks passed
This was referenced Jun 16, 2026
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.

Wolverine.Polecat aggregate-handler id resolution ignores the shared JasperFx.IdentityAttribute

1 participant