## Summary - introduce a shared reason-translation contract with envelopes, presenter helpers, fallback handling, and provider translation support - adopt translated operator-facing reason presentation across operation runs, notifications, provider guidance, tenant operability, and RBAC-related surfaces - add Spec 157 design artifacts and targeted regression coverage for translation quality, diagnostics retention, and authorization-safe guidance ## Validation - `vendor/bin/sail bin pint --dirty --format agent` - `vendor/bin/sail artisan test --compact tests/Architecture/ReasonTranslationPrimarySurfaceGuardTest.php tests/Unit/Support/ReasonTranslation/ReasonResolutionEnvelopeTest.php tests/Unit/Support/ReasonTranslation/ExecutionDenialReasonTranslationTest.php tests/Unit/Support/ReasonTranslation/TenantOperabilityReasonTranslationTest.php tests/Unit/Support/ReasonTranslation/RbacReasonTranslationTest.php tests/Unit/Support/ReasonTranslation/ProviderReasonTranslationTest.php tests/Feature/Notifications/OperationRunNotificationTest.php tests/Feature/Operations/OperationRunBlockedExecutionPresentationTest.php tests/Feature/Operations/TenantlessOperationRunViewerTest.php tests/Feature/ReasonTranslation/GovernanceReasonPresentationTest.php tests/Feature/Authorization/ReasonTranslationScopeSafetyTest.php tests/Feature/Monitoring/OperationRunBlockedSpec081Test.php tests/Feature/ProviderConnections/ProviderOperationBlockedGuidanceSpec081Test.php tests/Feature/ProviderConnections/ProviderGatewayRuntimeSmokeSpec081Test.php` ## Notes - Livewire v4.0+ compliance remains unchanged within the existing Filament v5 stack. - No new panel was added; provider registration remains in `bootstrap/providers.php`. - No new globally searchable resource was introduced. - No new destructive action family was introduced. - No new assets were added; the existing `filament:assets` deployment behavior remains unchanged. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #187
53 lines
2.1 KiB
PHP
53 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Tenant;
|
|
use App\Services\OperationRunService;
|
|
use App\Support\OperationRunOutcome;
|
|
use App\Support\OperationRunStatus;
|
|
use App\Support\Providers\ProviderReasonCodes;
|
|
|
|
it('Spec081 stores blocked operation runs with sanitized reason and link-only next steps', function (): void {
|
|
$tenant = Tenant::factory()->create();
|
|
$service = app(OperationRunService::class);
|
|
|
|
$run = $service->ensureRunWithIdentity(
|
|
tenant: $tenant,
|
|
type: 'provider.connection.check',
|
|
identityInputs: [
|
|
'provider_connection_id' => 99,
|
|
],
|
|
context: [
|
|
'provider' => 'microsoft',
|
|
'provider_connection_id' => 99,
|
|
'target_scope' => [
|
|
'entra_tenant_id' => $tenant->graphTenantId(),
|
|
],
|
|
],
|
|
);
|
|
|
|
$finalized = $service->finalizeBlockedRun(
|
|
run: $run,
|
|
reasonCode: ProviderReasonCodes::ProviderCredentialMissing,
|
|
nextSteps: [
|
|
['label' => 'Update Credentials', 'url' => '/admin/tenants/demo/provider-connections'],
|
|
['label' => '', 'url' => '/invalid'],
|
|
],
|
|
message: 'client_secret=super-secret',
|
|
);
|
|
|
|
$finalized->refresh();
|
|
|
|
expect($finalized->status)->toBe(OperationRunStatus::Completed->value)
|
|
->and($finalized->outcome)->toBe(OperationRunOutcome::Blocked->value)
|
|
->and($finalized->context['reason_code'] ?? null)->toBe(ProviderReasonCodes::ProviderCredentialMissing)
|
|
->and(data_get($finalized->context, 'reason_translation.operator_label'))->toBe('Credentials missing')
|
|
->and(data_get($finalized->context, 'reason_translation.short_explanation'))->toContain('credentials required to authenticate')
|
|
->and($finalized->context['next_steps'] ?? [])->toBe([
|
|
['label' => 'Update Credentials', 'url' => '/admin/tenants/demo/provider-connections'],
|
|
])
|
|
->and($finalized->failure_summary[0]['reason_code'] ?? null)->toBe(ProviderReasonCodes::ProviderCredentialMissing)
|
|
->and((string) ($finalized->failure_summary[0]['message'] ?? ''))->not->toContain('secret');
|
|
});
|