tenant-engine/tests
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
..
test_api_reads.py TEN-WP-0002 T04-T07: cache-read, live-lookup (fail-closed), write API, close 2026-07-23 22:24:09 +02:00
test_api_writes.py TEN-WP-0002 T04-T07: cache-read, live-lookup (fail-closed), write API, close 2026-07-23 22:24:09 +02:00
test_app.py TEN-WP-0002 T01-T03: service skeleton, domain model, storage layer 2026-07-23 22:01:23 +02:00
test_domain.py TEN-WP-0002 T01-T03: service skeleton, domain model, storage layer 2026-07-23 22:01:23 +02:00
test_store.py TEN-WP-0002 T01-T03: service skeleton, domain model, storage layer 2026-07-23 22:01:23 +02:00