NetKingdom facility for tenant management.
Find a file
tegwick d6fd73bd42 Implement tenant update and reversible retirement API (TEN-WP-0005 T01-T04)
Add an explicit tenant lifecycle (active/retired), allow-listed mutable
metadata, record versioning, and lifecycle timestamps to the tenant authority.

- domain: TenantLifecycle, with_metadata/retire/reactivate, immutability and
  transition invariants. Identifier stays immutable -- it is the IAM Profile
  `tenant` claim key-cape mints into tokens.
- store: mutate_tenant() commits idempotency replay, version CAS, mutation,
  and audit event together; durable receipts survive restart. Retired tenants
  refuse new grants and plan changes but keep their history.
- sqlite: forward-only idempotent migration; existing rows default to active
  at version 1. Reads now take the write lock -- the concurrent-writer test
  caught unguarded reads on the shared connection observing mid-transaction
  state as a spurious tenant_not_found.
- api: GET/PATCH /tenants/{id}, POST retire|reactivate. Idempotency-Key and
  If-Match required, distinct flex-auth actions per operation, stable error
  schema, redacted 503s.
- docs/tenant-lifecycle-api.md: consumer contract for user-engine.

Implemented against SQLite, not PostgreSQL as the workplan assumed --
TEN-WP-0004 shipped SQLite on a PVC as the production store.

124 tests pass (was 66); no breaking change to existing endpoints.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 20:00:43 +02:00
.claude/rules Bootstrap repo: State Hub registration, agent docs, TEN-WP-0001/0002 2026-07-23 21:56:07 +02:00
docs Implement tenant update and reversible retirement API (TEN-WP-0005 T01-T04) 2026-08-10 20:00:43 +02:00
registry Bootstrap repo: State Hub registration, agent docs, TEN-WP-0001/0002 2026-07-23 21:56:07 +02:00
src/tenant_engine Implement tenant update and reversible retirement API (TEN-WP-0005 T01-T04) 2026-08-10 20:00:43 +02:00
tests Implement tenant update and reversible retirement API (TEN-WP-0005 T01-T04) 2026-08-10 20:00:43 +02:00
workplans Implement tenant update and reversible retirement API (TEN-WP-0005 T01-T04) 2026-08-10 20:00:43 +02:00
.custodian-brief.md chore(consistency): sync task status from DB [auto] 2026-08-10 18:52:45 +02:00
.gitignore Bootstrap repo: State Hub registration, agent docs, TEN-WP-0001/0002 2026-07-23 21:56:07 +02:00
.repo-classification.yaml Bootstrap repo: State Hub registration, agent docs, TEN-WP-0001/0002 2026-07-23 21:56:07 +02:00
AGENTS.md Bootstrap repo: State Hub registration, agent docs, TEN-WP-0001/0002 2026-07-23 21:56:07 +02:00
CLAUDE.md Bootstrap repo: State Hub registration, agent docs, TEN-WP-0001/0002 2026-07-23 21:56:07 +02:00
Containerfile Deploy durable tenant authority runtime 2026-08-09 01:35:00 +02:00
INTENT.md TEN-WP-0003: FlexAuthWriteAuthorizer -- gate writes through flex-auth 2026-07-23 22:54:44 +02:00
LICENSE Adopt Target Revenue Source License V1C1 (org-wide preliminary rollout) 2026-07-30 01:08:59 +02:00
Makefile TEN-WP-0002 T01-T03: service skeleton, domain model, storage layer 2026-07-23 22:01:23 +02:00
pyproject.toml TEN-WP-0003: FlexAuthWriteAuthorizer -- gate writes through flex-auth 2026-07-23 22:54:44 +02:00
README.md Initial commit 2026-07-23 19:40:36 +00:00
SCOPE.md TEN-WP-0003: FlexAuthWriteAuthorizer -- gate writes through flex-auth 2026-07-23 22:54:44 +02:00
WORK-RECORDS.md Plan tenant update and retirement APIs 2026-08-10 18:54:28 +02:00

tenant-engine

NetKingdom facility for tenant management.