Skip to content

refactor(api)!: remove the tenant concept entirely - single-network ban backend#105

Merged
TheMeinerLP merged 2 commits into
mainfrom
worktree-snappy-weaving-nebula
Jul 8, 2026
Merged

refactor(api)!: remove the tenant concept entirely - single-network ban backend#105
TheMeinerLP merged 2 commits into
mainfrom
worktree-snappy-weaving-nebula

Conversation

@TheMeinerLP

@TheMeinerLP TheMeinerLP commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Blackhole is now a single-network ban backend with no multi-tenancy anywhere - not even as a URL parameter (an interim step in this same PR briefly moved tenant resolution to be purely URL-based; the tenant concept has since been removed outright, per the repo owner's follow-up direction).

  • Removes TenantEntity/TenantHandler/TenantDTO/TenantStatus, TenantEloSettings (entity/repository/controller/DTO/service, replaced with static application.yml config), and every tenantId field/column/parameter across entities, repositories, services, and controllers.
  • Collapses PunishmentProfileEntity/EloProfileEntity's (tenantId, owner) composite key down to a plain owner primary key; deletes PunishmentProfileId.
  • Adds 14 new Liquibase changeSets to db.changelog-master.xml (this PR was rebased past refactor(database)!: replace Flyway with Liquibase XML changelogs #101's Flyway→Liquibase swap) dropping the tenants/tenant_elo_settings tables and every tenant_id column/index/composite-PK.
  • Collapses the PLATFORM_ADMIN/TENANT_ADMIN role split into a single ADMIN role - they were never used to gate different behavior anywhere except tenant CRUD, which is now gone.
  • WebhookDispatchConsumer now fans every domain event out to every active connector subscription matching its event type, network-wide, instead of filtering by tenant.
  • Regenerates the OpenAPI client from a new blackhole-api-0.0.6.yml spec and updates the Velocity proxy's BlackholeConfig/listeners/commands/Redis mirror to the tenant-free call shapes.

Why

The repo owner explicitly wanted Blackhole simplified into a single-network ban backend: if multiple networks are ever needed, that's handled by running separate deployments, not by sharing one deployment across them. This removes the multi-tenancy data model entirely rather than just its enforcement (the prior state of this PR).

Breaking changes

  • Every tenant-scoped REST endpoint drops tenantId from its URL/body/response entirely (see the updated OpenAPI spec).
  • JWTs no longer carry any tenant claim, and PLATFORM_ADMIN/TENANT_ADMIN no longer exist as roles - only ADMIN.
  • The database migration drops all tenant-related tables/columns with no data preservation (dev-stage, no production data affected).

Test plan

  • ./gradlew clean build passes across all modules (backend, client, velocity, phoca)
  • ./gradlew :client:openApiGenerate regenerates cleanly from the new spec
  • Verified all 47 Liquibase changeSets (33 original + 14 new) apply cleanly against a fresh scratch database; confirmed punishment_profiles/elo_profiles end up with owner as sole PK and no tenants/tenant_elo_settings/tenant_id remnants
  • Manually verified end-to-end against local Docker infra: bootstrap → mint ADMIN/SERVICE tokens (decoded JWT confirms no tenant claim, role is ADMIN not PLATFORM_ADMIN) → exercised create/list endpoints (report, template, punishment, profile, elo) with fully tenant-free URLs

…claim enforcement

Removes TenantContext and the tenantId JWT claim entirely - every tenant-scoped
endpoint now takes tenantId as a URL path variable and trusts it directly instead
of verifying it against the caller's token. This is a deliberate simplification:
a role's JWT (STAFF, SERVICE, etc.) now works identically against every tenant,
since nothing on the token distinguishes which tenant it belongs to anymore.

- Standardizes tenant-scoped create/list endpoints to take {tenantId} from the
  URL path instead of a JWT claim, request body field, or loaded-entity lookup.
- Splits PunishTemplateDTO/PunishProfileDTO/ReportDTO into tenantId-free
  *RequestDTO request types; response types are unchanged.
- Removes the tenantId claim from minted JWTs (AuthController, ConnectorAuthController)
  and the TENANT_ADMIN-own-tenant restriction on token minting.
- Regenerates the OpenAPI client from a new blackhole-api-0.0.4.yml spec and
  updates the Velocity proxy's call sites to the new path-based signatures.

BREAKING CHANGE: tenant-scoped REST endpoints change shape (tenantId moves from
body/claim to a URL path variable on several routes - see updated OpenAPI spec).
JWTs no longer carry a tenantId claim, so tenant isolation is no longer enforced
by the API - callers must not treat a role token as tenant-restricted anymore.
…an backend

Blackhole is now a single-network ban backend with no multi-tenancy anywhere -
not even as a URL parameter. Removes TenantEntity/TenantHandler/TenantDTO,
TenantEloSettings (entity/repository/controller/DTO/service, replaced with
static application.yml config), and every tenantId field/column/parameter
across entities, repositories, services and controllers.

- Collapses PunishmentProfileEntity/EloProfileEntity's (tenantId, owner)
  composite key down to a plain owner primary key; deletes PunishmentProfileId.
- New V9__remove_tenants.sql migration drops the tenants/tenant_elo_settings
  tables and every tenant_id column/index/composite-PK, since tenantId was
  baked into V1__baseline.sql and can't be edited.
- Collapses the PLATFORM_ADMIN/TENANT_ADMIN role split into a single ADMIN
  role - they were never used to gate different behavior anywhere except
  tenant CRUD, which is now gone.
- WebhookDispatchConsumer now fans every domain event out to every active
  connector subscription matching its event type, network-wide, instead of
  filtering by tenant.
- Regenerates the OpenAPI client from a new blackhole-api-0.0.6.yml spec and
  updates the Velocity proxy's BlackholeConfig/listeners/commands/Redis mirror
  to the tenant-free call shapes.

BREAKING CHANGE: every tenant-scoped REST endpoint drops tenantId from its
URL/body/response entirely (see the updated OpenAPI spec). JWTs no longer
carry any tenant claim, and PLATFORM_ADMIN/TENANT_ADMIN no longer exist as
roles - only ADMIN. The database migration drops all tenant-related tables
and columns with no data preservation.
@TheMeinerLP
TheMeinerLP force-pushed the worktree-snappy-weaving-nebula branch from 80b5544 to 91f9271 Compare July 8, 2026 15:42
@TheMeinerLP TheMeinerLP changed the title refactor(api)!: resolve tenants purely from the URL, drop JWT tenant-claim enforcement refactor(api)!: remove the tenant concept entirely - single-network ban backend Jul 8, 2026
@TheMeinerLP
TheMeinerLP merged commit 4f67cbd into main Jul 8, 2026
8 checks passed
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