Skip to content

GH-4562: cover the blue/green partial-grandfather placement on Polecat - #4576

Merged
jeremydmiller merged 1 commit into
mainfrom
gh-4562-polecat-coverage
Sep 23, 2026
Merged

jeremydmiller merged 1 commit into
mainfrom
gh-4562-polecat-coverage

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Follow-up to #4563 (GH-4562), which fixed group-affinity grandfathering so a node running part of a capability partition no longer becomes a candidate for the members it can neither declare nor run.

Polecat registers the same EventSubscriptionAgentFamily as Marten and runs through the identical DistributeByGroupAffinity, but PolecatTests had no analogue of MartenTests.MultiTenancy.blue_green_version_bump_assignment. This adds one.

What it covers

A blue/green rollout placed through the real agent family and the real grid, over agent URIs that two real Polecat stores advertise rather than hand-written ones — so it also covers Polecat's own shard-identity and versioning grammar feeding the placement, not just the grid arithmetic.

Blue serves trip v1 + day. Green serves trip v2 + day + distance, where distance is registered on green only and blue is running it without declaring it. That is the Polecat stand-in for the tenant provisioned after the blue nodes captured their capability snapshots, and it is what used to pull blue into the candidate set for a partition it could only partly run.

Why it is a structural twin, not a copy

The Marten version gets a group deep enough to split from several tenants sharing one shard database. Polecat cannot express that — Polecat.Storage.SeparateDatabaseTenancy offers only AddTenant, so Polecat multi-tenancy is one tenant per database. The depth here comes from several projections on one database instead. The mechanism under test is unchanged: a partition holding more than one agent, of which a blue node runs some without declaring them.

Why it is single-database

A multi-tenanted Polecat store reports Cardinality = Single with an empty Databases collection from TryCreateUsage(), while IEventStore.AllDatabases() on that same store returns every tenant database — filed upstream as JasperFx/polecat#675. EventStoreAgents.SupportedAgentsAsync reads the usage descriptor, so every agent collapses onto the main database and there is nothing left to group.

Using one database keeps this test about placement rather than about that gap. The test comment says so and points at #675; when that is fixed, this is worth revisiting as the full multi-database twin of the Marten version.

Fisher

Deliberately not covered. Wolverine.Fisher contains no reference to EventSubscriptionAgentFamily at all and never reaches this code path — by design, per the note in WolverineOptionsFisherExtensions: distributing subscriptions presupposes several nodes sharing one event store, and a Fisher store is a single SQLite file. A group-affinity test there would assert nothing.

Verification

PolecatTests.Distribution green (9 passed, 2 skipped), and wolverine.slnx builds clean in Release on net9.0 with no warnings.

🤖 Generated with Claude Code

Polecat registers the same EventSubscriptionAgentFamily as Marten and runs
through the identical DistributeByGroupAffinity, but PolecatTests had no
analogue of MartenTests' blue_green_version_bump_assignment. This adds one,
built on agent URIs two real Polecat stores advertise rather than hand-written
ones, so it also covers Polecat's own shard-identity and versioning grammar
feeding the placement.

It is a structural twin rather than a copy. The Marten version gets a group
deep enough to split from several tenants sharing a shard database;
Polecat.Storage.SeparateDatabaseTenancy offers only AddTenant, so Polecat
multi-tenancy is one tenant per database and cannot express that. The depth
comes from several projections on one database instead, which leaves the
mechanism under test unchanged: a partition holding more than one agent, of
which a blue node runs some without declaring them.

Single-database on purpose. A multi-tenanted Polecat store reports
Cardinality = Single with an empty Databases collection from TryCreateUsage(),
while IEventStore.AllDatabases() on that same store returns every tenant
database (JasperFx/polecat#675). EventStoreAgents.SupportedAgentsAsync reads
the usage descriptor, so every agent collapses onto the main database and there
is nothing left to group. Worth revisiting as the full multi-database twin once
that is fixed.

Red on main's per-partition predicate -- trip/all/v2 is assigned to the blue
node, which cannot build it -- and green on the per-member one.

Co-Authored-By: Claude Opus 5 <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