Skip to content

Fix Polecat projection agents not starting under managed distribution (#3168)#3169

Merged
jeremydmiller merged 1 commit into
mainfrom
fix/polecat-agent-uri-casing-3168
Jun 19, 2026
Merged

Fix Polecat projection agents not starting under managed distribution (#3168)#3169
jeremydmiller merged 1 commit into
mainfrom
fix/polecat-agent-uri-casing-3168

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Closes #3168.

Root cause

Under UseWolverineManagedEventSubscriptionDistribution, a Polecat-backed store's async projection agents surfaced (AllKnownAgentsAsync returned them) but never started — even single-node — with the node reporting no running agents (node N: []). Every start threw:

AgentStartingException: Failed trying to start agent
  event-subscriptions://sqlserver/Polecat/localhost,1434.master/trip/all
  ---> System.ArgumentOutOfRangeException: Unknown event projection or subscription

EventSubscriptionAgentFamily keyed its store map by EventStoreIdentity.ToString() ("{Name}:{Type}", original casing → "Polecat:SqlServer"), but BuildAgentAsync rebuilt the lookup key from the agent URI: $"{uri.Segments[1]}:{uri.Host}". The store Type rides in the URI authority, which System.Uri lowercases"Polecat:sqlserver" → lookup miss → throw.

Marten was unaffected purely because its Identity.Type is already lowercase ("marten"); it's a latent bug for any provider with an uppercase Type.

Fix

Normalize the store key to one casing (matching System.Uri's authority normalization) at all three sites — the _stores keying, the BuildAgentAsync reverse lookup, and FindStore — via a small documented StoreKey helper in core EventSubscriptionAgentFamily.

Tests

  • New Polecat regression test polecat_managed_distribution_starts_agents_3168 asserts the three async projection agents actually run on one node (mirrors Marten's everything_is_started_up_on_one_node). Fails before the fix (30s timeout, node N: []), passes after (~5s).
  • Existing Polecat surfacing tests + Marten single/multi-node distribution tests still green — confirms no regression and no double-start (the WolverineProjectionCoordinator path is unchanged and identical to Marten's).
  • dotnet build wolverine.slnx -c Release clean.

🤖 Generated with Claude Code

…#3168)

EventSubscriptionAgentFamily keyed its store map by EventStoreIdentity.ToString()
("Name:Type", original casing) but rebuilt the lookup key from the agent URI in
BuildAgentAsync, where the store Type rides in the URI authority — which
System.Uri lowercases. Any store whose Identity.Type has uppercase letters
(Polecat's is "SqlServer") therefore failed the reverse lookup with
"Unknown event projection or subscription", so its projection agents never
started under UseWolverineManagedEventSubscriptionDistribution, even single-node
(node N: []). Marten was unaffected only because its Type is already lowercase
("marten").

Normalize the store key to a single casing at all three sites (keying, the
BuildAgentAsync reverse lookup, and FindStore) via a documented StoreKey helper,
matching System.Uri's own authority normalization.

Adds a Polecat regression test asserting the three async projection agents
actually run on one node (mirrors Marten's everything_is_started_up_on_one_node).
Marten single + multi-node distribution tests still green (no double-start, no
regression).

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

Polecat projection agents don't start under UseWolverineManagedEventSubscriptionDistribution (single-node) — #3133 follow-up

1 participant