NetKingdom facility for tenant management.
Find a file
tegwick adb74d2443 TEN-WP-0002 T04-T07: cache-read, live-lookup (fail-closed), write API, close
- authz.py: WriteAuthorizer Protocol + DefaultDenyWriteAuthorizer. Every
  write endpoint calls it before touching the store; denial maps to
  403 write_denied via an exception handler.
- app.py: GET /tenants/{id}/roles (cache-read, key-cape) and
  GET /tenants/{id}/roles/live (live-lookup, flex-auth) share one handler
  that fails closed (503) on StoreUnavailableError -- deliberately made
  identical rather than giving cache-read weaker guarantees than the task
  strictly required. POST /tenants, /roles/grant, /roles/revoke, /plan --
  all four gated by the WriteAuthorizer seam, domain/store errors mapped to
  400/404/409 after authorization passes.
- store.py: new StoreUnavailableError for the fail-closed test double.

43 tests passing: default-deny on every write endpoint, an
_AllowAllAuthorizer test double proving the seam actually gates (full
create->grant->read->revoke->read->assign-plan lifecycle over real HTTP),
and a _BrokenStore double proving outage never looks like "zero roles".
Verified live over real HTTP, not just TestClient.

TEN-WP-0002 closed: all 7 tasks done, boundary-contract ownership checked
against the implementation with no drift found. Follow-ups recorded in the
closure note (real flex-auth WriteAuthorizer, key-cape wiring, guardrail
policy design, Binky as first real tenant record, durable persistence).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 22:24:09 +02:00
.claude/rules Bootstrap repo: State Hub registration, agent docs, TEN-WP-0001/0002 2026-07-23 21:56:07 +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 TEN-WP-0002 T04-T07: cache-read, live-lookup (fail-closed), write API, close 2026-07-23 22:24:09 +02:00
tests TEN-WP-0002 T04-T07: cache-read, live-lookup (fail-closed), write API, close 2026-07-23 22:24:09 +02:00
workplans TEN-WP-0002 T04-T07: cache-read, live-lookup (fail-closed), write API, close 2026-07-23 22:24:09 +02:00
.custodian-brief.md chore(consistency): sync task status from DB [auto] 2026-07-23 22:01:44 +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
INTENT.md Bootstrap repo: State Hub registration, agent docs, TEN-WP-0001/0002 2026-07-23 21:56:07 +02:00
LICENSE Initial commit 2026-07-23 19:40:36 +00: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-0002 T01-T03: service skeleton, domain model, storage layer 2026-07-23 22:01:23 +02:00
README.md Initial commit 2026-07-23 19:40:36 +00:00
SCOPE.md Bootstrap repo: State Hub registration, agent docs, TEN-WP-0001/0002 2026-07-23 21:56:07 +02:00
WORK-RECORDS.md chore(consistency): sync WORK-RECORDS.md for TEN-WP-0002 T01-T03 [auto] 2026-07-23 22:01:51 +02:00

tenant-engine

NetKingdom facility for tenant management.