Skip to content

#409: consistent dynamic-tenancy management surface (2.6.0)#410

Merged
jeremydmiller merged 1 commit into
mainfrom
feat/409-dynamic-tenancy-admin-surface
Jun 2, 2026
Merged

#409: consistent dynamic-tenancy management surface (2.6.0)#410
jeremydmiller merged 1 commit into
mainfrom
feat/409-dynamic-tenancy-admin-surface

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Closes the JasperFx-side of #409 — standardize runtime tenant management on the existing JasperFx.MultiTenancy.IDynamicTenantSource<T> so a monitoring tool (CritterWatch) can add/disable/enable/remove tenants on any Critter Stack service without sniffing the concrete tenancy type. Part of CritterWatch #209. Additive and non-breaking.

Branches off the 2.5.0 release commit (5f94c0c); this is a single commit and a minor bump to 2.6.0.

Changes

  • IDynamicTenantSource<T> — new auto-assign overload AddTenantAsync(string tenantId, CancellationToken = default), default-implemented to throw NotSupportedException. Resolves the issue's open question: it covers the sharded/partitioned provisioning shape that has no caller-supplied connection value; auto-assigning sources (Marten ShardedTenancy, marten#4598) override it. The value-supplied AddTenantAsync(tenantId, connectionValue) is unchanged.
  • DynamicTenancyAdminExtensions — a uniform IServiceProvider/IHost admin entrypoint that resolves every registered IDynamicTenantSource<string> and dispatches add (value + auto-assign) / disable / enable / remove / all-disabled to each — a graceful no-op when none is registered (store-agnostic pattern). CritterWatch consumes only this.

Out of scope here (other repos): proposal item 1 (ShardedTenancy implementing the interface, marten#4598) and item 3 (Wolverine MartenMessageDatabaseSource).

Verification

  • CoreTests: 447/447 on net9.0 and net10.0 (8 new tests: default-throws, auto-assign override, value + auto-assign dispatch, disable/enable/remove, multi-source fan-out, graceful no-op when unregistered, IHost overloads).
  • Full solution builds clean.

Publish

Version bumped to 2.6.0 in Directory.Build.props. After merge, publish via the "JasperFx NuGet Manual Publish" workflow (workflow_dispatch./build.sh NugetPush, NUGET_API_KEY secret). Package set: JasperFx, JasperFx.Events, JasperFx.Events.SourceGenerator, JasperFx.SourceGenerator, JasperFx.Aspire (RuntimeCompiler versions independently, unchanged).

🤖 Generated with Claude Code

Standardizes the runtime tenant-management surface on the existing
JasperFx.MultiTenancy.IDynamicTenantSource<T> so a monitoring tool (CritterWatch)
can add/disable/enable/remove tenants on any Critter Stack service without
sniffing the concrete tenancy type. JasperFx-side of the issue (ShardedTenancy
conformance and the Wolverine source live in marten/wolverine).

- IDynamicTenantSource<T>: new auto-assign overload
  AddTenantAsync(string tenantId, CancellationToken = default), default-implemented
  to throw NotSupportedException. Covers the sharded/partitioned provisioning shape
  that has no caller-supplied connection value; sources that auto-assign (Marten
  ShardedTenancy, marten#4598) override it. The value-supplied
  AddTenantAsync(tenantId, connectionValue) is unchanged.
- DynamicTenancyAdminExtensions: a uniform IServiceProvider/IHost admin entrypoint
  that resolves all registered IDynamicTenantSource<string> and dispatches
  add (value + auto-assign) / disable / enable / remove / all-disabled to each —
  a graceful no-op when none is registered (store-agnostic pattern). CritterWatch
  consumes only this.

Additive and non-breaking. CoreTests: 447/447 on net9.0 and net10.0 (8 new);
solution builds clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit fdd1ab9 into main Jun 2, 2026
1 check passed
jeremydmiller added a commit that referenced this pull request Jun 2, 2026
…ignment (2.7.0) (#414)

Upstream half split out from #409. Pooled/auto-assign tenancy models (Marten
ShardedTenancy, conjoined managed partitions) have no caller-supplied connection
value — the assignment strategy picks the database/partition. Per the issue's
recommended option (1), the auto-assign overload now reports where the tenant
landed so a store-agnostic tool (CritterWatch) can manage these models uniformly
without sniffing the concrete tenancy type.

- IDynamicTenantSource<T>.AddTenantAsync(string tenantId, CancellationToken) now
  returns Task<string> — the resolved database id (sharded pool) or partition
  suffix (managed partitions). Default still throws NotSupportedException, so the
  change stays additive for caller-supplies-value sources, which keep
  AddTenantAsync(tenantId, connectionValue). (Evolves the void-Task overload added
  in #409/PR #410.)
- DynamicTenancyAdminExtensions: the auto-assign IServiceProvider/IHost entrypoint
  now returns Task<string?> — the resolved assignment from the provisioning source,
  or null when no dynamic source is registered (graceful no-op preserved).

JasperFx-side only; ShardedTenancy/managed-partition conformance and the Wolverine
MartenMessageDatabaseSource surfacing (scope items 2-5) are Marten/Wolverine repos
(depend on marten#4598). CoreTests 447/447 on net9.0 and net10.0; solution builds clean.

Co-authored-by: Claude Opus 4.8 (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