[Feature] Move tenant registry, tenant settings, tenant lifecycle, tenant switching, and tenant deletion orchestration into tenancy #82

Closed
opened 2026-07-06 15:06:08 +02:00 by zemion · 4 comments
Owner

Imported from a backlog-like text file.

  • Source: /mnt/DATA/Nextcloud/ADD ideas UG/Products/govoplan/split-concept-action-plan.md
  • Line: 175
  • Source kind: product
  • Section: GovOPlaN Split Concept and Action Plan > Staged Refactor Plan > Phase 3: Extract Tenancy

Imported item:

Move tenant registry, tenant settings, tenant lifecycle, tenant switching, and tenant deletion orchestration into tenancy.
<!-- codex-generic-backlog-fingerprint:e38480c3f8bfaf8fab922d78 --> Imported from a backlog-like text file. - Source: `/mnt/DATA/Nextcloud/ADD ideas UG/Products/govoplan/split-concept-action-plan.md` - Line: `175` - Source kind: `product` - Section: `GovOPlaN Split Concept and Action Plan > Staged Refactor Plan > Phase 3: Extract Tenancy` Imported item: ```text Move tenant registry, tenant settings, tenant lifecycle, tenant switching, and tenant deletion orchestration into tenancy. ```
zemion added this to the Phase 3: Extract Tenancy milestone 2026-07-06 15:06:08 +02:00
zemion added the
type
feature
priority
p2
source/backlog-import
codex/ready
labels 2026-07-07 23:25:28 +02:00
zemion added the
status
triage
label 2026-07-08 02:52:48 +02:00
Author
Owner

Codex State: checked 2026-07-09

Work remains. Tenancy now owns the Tenant model and admin routes for tenant list/create/update/settings, but tenant switching is still implemented through access auth (/auth/switch-tenant) and access session helpers. Tenant deletion/lifecycle orchestration is also not implemented as a tenancy-owned workflow.

Keep open. A good next slice is moving tenant switching behind a tenancy-owned capability/API contract, then adding explicit tenant deletion/suspension orchestration.

## Codex State: checked 2026-07-09 Work remains. Tenancy now owns the Tenant model and admin routes for tenant list/create/update/settings, but tenant switching is still implemented through access auth (/auth/switch-tenant) and access session helpers. Tenant deletion/lifecycle orchestration is also not implemented as a tenancy-owned workflow. Keep open. A good next slice is moving tenant switching behind a tenancy-owned capability/API contract, then adding explicit tenant deletion/suspension orchestration.
Author
Owner

Review 2026-07-10: keeping this open. Tenancy owns tenant list/create/update/settings routes and has capability integration for tenant provisioning/resolution, but tenant switching still lives under access auth (govoplan_access/backend/api/v1/auth.py, /switch-tenant, switch_auth_session_tenant). I also found no tenancy-owned tenant deletion/retirement route or lifecycle orchestrator; tenancy routes currently expose create/update/settings/delta, not delete/retire. Close path: add a tenancy lifecycle service for suspend/delete/retire plans, module veto/retirement checks, audit/rollback hooks, and move or wrap tenant switching through a tenancy-owned capability/API.

Review 2026-07-10: keeping this open. Tenancy owns tenant list/create/update/settings routes and has capability integration for tenant provisioning/resolution, but tenant switching still lives under access auth (`govoplan_access/backend/api/v1/auth.py`, `/switch-tenant`, `switch_auth_session_tenant`). I also found no tenancy-owned tenant deletion/retirement route or lifecycle orchestrator; tenancy routes currently expose create/update/settings/delta, not delete/retire. Close path: add a tenancy lifecycle service for suspend/delete/retire plans, module veto/retirement checks, audit/rollback hooks, and move or wrap tenant switching through a tenancy-owned capability/API.
Author
Owner

Progress 2026-07-10: added tenancy-owned lifecycle groundwork for tenant deletion orchestration. New tenancy API surface provides GET /api/v1/admin/tenants/{tenant_id}/deletion-plan and DELETE /api/v1/admin/tenants/{tenant_id} with non-destructive retire mode. The plan uses tenant summary counts, blocks retiring the currently active tenant, runs registered tenant delete-veto providers, reports retained-data warnings, records tenant.retired audit events, updates change tracking, and stores lifecycle metadata in tenant settings. Destructive destroy mode returns 422 by design. Keeping this open because tenant switching still lives under access auth and destructive tenant retirement/deletion still needs an explicit design/provider model.

Progress 2026-07-10: added tenancy-owned lifecycle groundwork for tenant deletion orchestration. New tenancy API surface provides `GET /api/v1/admin/tenants/{tenant_id}/deletion-plan` and `DELETE /api/v1/admin/tenants/{tenant_id}` with non-destructive `retire` mode. The plan uses tenant summary counts, blocks retiring the currently active tenant, runs registered `tenant` delete-veto providers, reports retained-data warnings, records `tenant.retired` audit events, updates change tracking, and stores lifecycle metadata in tenant settings. Destructive destroy mode returns 422 by design. Keeping this open because tenant switching still lives under access auth and destructive tenant retirement/deletion still needs an explicit design/provider model.
Author
Owner

Implemented the remaining tenancy lifecycle/switching work: tenancy now contributes tenant registry/settings/lifecycle routes, deletion plans, non-destructive retirement, guarded empty-tenant destructive deletion, and a tenancy-owned /api/v1/tenancy/switch-tenant route backed by the auth.tenantContextSwitcher capability. The existing /api/v1/auth/switch-tenant route remains as compatibility. Focused module permutation tests pass. Closing.

Implemented the remaining tenancy lifecycle/switching work: tenancy now contributes tenant registry/settings/lifecycle routes, deletion plans, non-destructive retirement, guarded empty-tenant destructive deletion, and a tenancy-owned `/api/v1/tenancy/switch-tenant` route backed by the `auth.tenantContextSwitcher` capability. The existing `/api/v1/auth/switch-tenant` route remains as compatibility. Focused module permutation tests pass. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-core#82
No description provided.