Xác minh mỗi thao tác Tenant sinh đúng AuditEvent. Không thay đổi audit model — chỉ dùng AuditEvent (append-only).
AuditEvent bất biến, append-only; ghi qua PrismaAuditRepository.append (chỉ INSERT). Metadata sanitize ở domain (drop secret/PHI).AuditEvent.tenantId = tenantId; entityRef = tenantId; actor {kind:"authenticated", source:"ops_cli", role:"ops"}.partnerId; tenant.* scope theo tenantId.| Thao tác | Audit action | Emit tại |
|---|---|---|
| Tenant created | tenant.created | ProvisioningService.provisionTenant |
| Tenant activated | tenant.activated | activateTenant → transitionTenant |
| Tenant suspended | tenant.suspended | suspendTenant → transitionTenant |
| Tenant re-activated | tenant.reactivated | reactivateTenant → transitionTenant |
| Tenant archived | tenant.archived | archiveTenant → transitionTenant |
tenant-provisioning-e2e.test.ts chạy trọn luồng rồi assert cả 5 action tồn tại (scope tenantId).ops-tenant.test.ts xác minh chuỗi qua CLI (show-audit --tenant).npm run test:infra → cổng CI platform-ci.yml.npm run ops -- show-audit --tenant <tenantId> --json
Kỳ vọng: events chứa đủ 5 action trên (theo thứ tự thời gian), metadata chỉ fromStatus/toStatus/reason/partnerId/name — không secret.
tenants.status (append ngay sau update). Cửa sổ hẹp; Beta-6: gói prisma.$transaction (chung với cùng vấn đề của Beta-4 partner audit). Xem Release Report.