@startuml
skinparam backgroundColor white
skinparam defaultFontColor #000000
skinparam ArrowColor #000000
skinparam packageStyle rectangle
skinparam shadowing false
skinparam rectangle {
  BorderColor #000000
  FontColor #000000
}

title Runtime Dispatch Coverage (After DB Persistence Assertions)

rectangle "DB-backed Dispatch Test\n(dispatch_auth_request_persists_email_failure_in_resolved_tenant_schema)" as db_test #DDEEFF {
  rectangle "Provision tenant-a schema tables" as provision_a #E8F6FF
  rectangle "Provision default schema tables" as provision_default #E8F6FF
  rectangle "Seed Admin Session (tenant-a schema)" as seed_a #E8F6FF
  rectangle "Seed Admin Session (default schema)" as seed_default #E8F6FF
  rectangle "POST /admin/email-failure/create" as create_failure #E8F6FF
  rectangle "GET /admin/email-failure/list" as list_failures #E8F6FF
  rectangle "GET /admin/audit-log/list" as list_audit #E8F6FF
  rectangle "Drop tenant test schemas" as cleanup #E8F6FF
}

rectangle "TenantRuntimeRegistry" as registry #FFF4CC
rectangle "AthenaAuth<SqlxAdapter>\n(schema=tenant_dispatch_a_*)" as runtime_a #F5E6FF
rectangle "AthenaAuth<SqlxAdapter>\n(schema=tenant_dispatch_default_*)" as runtime_default #F5E6FF
rectangle "admin.email_failure.create" as admin_create #E8FFE8
rectangle "tenant_a.email_send_failures" as table_a #CCFFCC
rectangle "default.email_send_failures" as table_default #FFE5E5
rectangle "tenant_a.admin_audit_logs" as audit_a #CCFFCC
rectangle "default.admin_audit_logs" as audit_default #FFE5E5

provision_a --> seed_a
provision_default --> seed_default
seed_a --> runtime_a
seed_default --> runtime_default
create_failure --> registry : x-athena-tenant=tenant-a
registry --> runtime_a : resolved runtime
runtime_a --> admin_create
admin_create --> table_a : insert failure row
admin_create --> audit_a : insert success audit row

list_failures --> registry : tenant-a + default queries
registry --> runtime_a
registry --> runtime_default
runtime_a --> table_a : list -> 1 row
runtime_default --> table_default : list -> 0 rows

list_audit --> registry : action filter + target id
runtime_a --> audit_a : list -> 1 row
runtime_default --> audit_default : list -> 0 rows

cleanup --> runtime_a : close pool
cleanup --> runtime_default : close pool
cleanup --> table_a : DROP SCHEMA CASCADE
cleanup --> table_default : DROP SCHEMA CASCADE

note bottom
Coverage now proves dispatch resolution drives real per-schema persistence
for admin email-failure writes and audit logs, with isolation assertions.
end note
@enduml