# Testing and troubleshooting

Run `vendor/bin/pint --dirty --format agent`, focused tenancy tests, the full `php artisan test --compact` suite, and `git diff --check` before release.

Tenant tests must create a tenant and initialize context before using store models. Tests should cover missing context, forged ownership, duplicate tenant-local identities, relationship isolation, permissions, sessions, password resets, activity logs, and context restoration between jobs.

If provisioning fails, inspect `TenantProvisioningRun.error_message` and retry with `php artisan tenant:provision <tenant-id>`. Database-creation credentials and per-tenant migration commands are no longer used.

If a store returns 404, verify its resolved domain, verification status, tenant lifecycle state, and feature gates. If records appear missing, verify tenant context was initialized before the query; the ownership scope deliberately returns no store records without context.
