TenantAtlas/app/Services/Providers/ProviderConfigurationRequiredException.php
ahmido 1acbf8cc54 feat(spec-088): remove tenant graphOptions legacy path (#105)
## Summary
- remove tenant-based Graph options access from runtime service paths and enforce provider-only resolution
- add `MicrosoftGraphOptionsResolver` and `ProviderConfigurationRequiredException` for centralized, actionable provider-config errors
- turn `Tenant::graphOptions()` into a fail-fast kill switch to prevent legacy runtime usage
- add and update tests (including guardrail) to enforce no reintroduction in `app/`
- update Spec 088 artifacts (`spec`, `plan`, `research`, `tasks`, checklist)

## Validation
- `vendor/bin/sail bin pint --dirty`
- `vendor/bin/sail artisan test --compact --filter=NoLegacyTenantGraphOptions`
- `vendor/bin/sail artisan test --compact tests/Feature/Filament`
- `CI=1 vendor/bin/sail artisan test --compact`

## Notes
- Branch includes the guardrail test for legacy callsite detection in `app/`.
- Full suite currently green: 1227 passed, 5 skipped.

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@MacBookPro.fritz.box>
Reviewed-on: #105
2026-02-12 10:14:44 +00:00

31 lines
964 B
PHP

<?php
namespace App\Services\Providers;
use App\Models\Tenant;
use RuntimeException;
final class ProviderConfigurationRequiredException extends RuntimeException
{
public function __construct(
public readonly int $tenantId,
public readonly string $provider,
public readonly string $reasonCode,
public readonly ?string $extensionReasonCode = null,
string $message = 'Provider configuration is required.',
) {
parent::__construct($message);
}
public static function forTenant(Tenant $tenant, string $provider, ProviderConnectionResolution $resolution): self
{
return new self(
tenantId: (int) $tenant->getKey(),
provider: $provider,
reasonCode: $resolution->effectiveReasonCode(),
extensionReasonCode: $resolution->extensionReasonCode,
message: $resolution->message ?? 'Provider configuration is required.',
);
}
}