## Summary - stabilize the active spec 293 post-cutover suite baseline around the current admin-panel and workspace-first runtime - align operations, provider, required-permissions, and action-surface expectations to canonical workspace-aware routes - add the monitoring operations workspace-membership guard and update the spec 293 classification artifacts - include the browser smoke screenshots captured during verification ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Filament/PanelNavigationSegregationTest.php tests/Feature/ManagedEnvironment/LegacyTenantCoreGuardTest.php` - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/OpsUx/CanonicalViewRunLinksTest.php tests/Feature/OpsUx/OperateHubShellTest.php tests/Feature/OpsUx/FailureSanitizationTest.php tests/Feature/OpsUx/NonLeakageWorkspaceOperationsTest.php` - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Guards/ActionSurfaceContractTest.php tests/Feature/ProviderConnections/NavigationPlacementTest.php tests/Feature/ProviderConnections/ProviderConnectionListAuthorizationTest.php tests/Feature/Verification/VerificationAuthorizationTest.php` - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Guards/Spec288NoLegacyRouteAndHelperGuardTest.php tests/Feature/Guards/Spec288ProviderCoreAndRoleAuthorityGuardTest.php tests/Feature/Guards/AdminWorkspaceRoutesGuardTest.php tests/Feature/Guards/ProviderBoundaryPlatformCoreGuardTest.php tests/Feature/ProviderConnections/LegacyRedirectTest.php tests/Feature/ManagedEnvironment/LegacyTenantCoreGuardTest.php tests/Feature/Spec080WorkspaceManagedTenantAdminMigrationTest.php tests/Feature/Rbac/ProviderConnectionWorkspaceFirstPolicyTest.php tests/Feature/Filament/ManagedEnvironmentAccessScopeManagementTest.php tests/Feature/Guards/BrowserLaneIsolationTest.php tests/Feature/Guards/CiLaneFailureClassificationContractTest.php tests/Feature/Guards/CiHeavyBrowserWorkflowContractTest.php tests/Unit/Auth/NoRoleStringChecksTest.php` - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Browser/Spec281ProviderConnectionScopeSmokeTest.php tests/Browser/Spec285WorkspaceRbacEnvironmentAccessSmokeTest.php` - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` ## Notes - remaining provider/verification failures are classified in `specs/293-post-cutover-suite-stabilization/failure-classification.md` as unrelated existing debt and are not folded into this slice Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #348
125 lines
4.1 KiB
PHP
125 lines
4.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\OperationRun;
|
|
use App\Models\ProviderConnection;
|
|
use App\Models\ProviderCredential;
|
|
use App\Models\ManagedEnvironment;
|
|
use App\Services\Verification\StartVerification;
|
|
use Illuminate\Auth\Access\AuthorizationException;
|
|
use Illuminate\Support\Facades\Queue;
|
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|
|
|
it('returns 404 for non-members on verification view and start', function (): void {
|
|
Queue::fake();
|
|
|
|
$tenant = ManagedEnvironment::factory()->create();
|
|
$otherTenant = ManagedEnvironment::factory()->create();
|
|
|
|
[$user] = createUserWithTenant($otherTenant, role: 'readonly');
|
|
|
|
$run = OperationRun::factory()->create([
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'type' => 'provider.connection.check',
|
|
'status' => 'completed',
|
|
'outcome' => 'failed',
|
|
'context' => [
|
|
'verification_report' => json_decode(
|
|
(string) file_get_contents(repo_path('specs/074-verification-checklist/contracts/examples/fail.json')),
|
|
true,
|
|
512,
|
|
JSON_THROW_ON_ERROR,
|
|
),
|
|
],
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get(route('admin.operations.view', [
|
|
'workspace' => (int) $tenant->workspace_id,
|
|
'run' => (int) $run->getKey(),
|
|
]))
|
|
->assertStatus(404);
|
|
|
|
$connection = ProviderConnection::factory()->create([
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
]);
|
|
|
|
expect(fn () => app(StartVerification::class)->providerConnectionCheck(
|
|
tenant: $tenant,
|
|
connection: $connection,
|
|
initiator: $user,
|
|
))->toThrow(NotFoundHttpException::class);
|
|
});
|
|
|
|
it('allows readonly members to view verification reports but forbids starting verification', function (): void {
|
|
Queue::fake();
|
|
|
|
[$user, $tenant] = createUserWithTenant(role: 'readonly');
|
|
|
|
$run = OperationRun::factory()->create([
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'user_id' => (int) $user->getKey(),
|
|
'type' => 'provider.connection.check',
|
|
'status' => 'completed',
|
|
'outcome' => 'failed',
|
|
'context' => [
|
|
'verification_report' => json_decode(
|
|
(string) file_get_contents(repo_path('specs/074-verification-checklist/contracts/examples/fail.json')),
|
|
true,
|
|
512,
|
|
JSON_THROW_ON_ERROR,
|
|
),
|
|
],
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get(route('admin.operations.view', [
|
|
'workspace' => (int) $tenant->workspace_id,
|
|
'run' => (int) $run->getKey(),
|
|
]))
|
|
->assertOk()
|
|
->assertSee('Verification report');
|
|
|
|
$connection = ProviderConnection::factory()->create([
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
]);
|
|
|
|
expect(fn () => app(StartVerification::class)->providerConnectionCheck(
|
|
tenant: $tenant,
|
|
connection: $connection,
|
|
initiator: $user,
|
|
))->toThrow(AuthorizationException::class);
|
|
});
|
|
|
|
it('allows members with start capability to start verification', function (): void {
|
|
Queue::fake();
|
|
|
|
[$user, $tenant] = createUserWithTenant(role: 'operator');
|
|
|
|
$connection = ProviderConnection::factory()->consentGranted()->create([
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
'provider' => 'microsoft',
|
|
'entra_tenant_id' => fake()->uuid(),
|
|
'consent_status' => 'granted',
|
|
]);
|
|
ProviderCredential::factory()->create([
|
|
'provider_connection_id' => (int) $connection->getKey(),
|
|
]);
|
|
|
|
$result = app(StartVerification::class)->providerConnectionCheck(
|
|
tenant: $tenant,
|
|
connection: $connection,
|
|
initiator: $user,
|
|
);
|
|
|
|
expect($result->status)->toBe('started');
|
|
expect($result->run->type)->toBe('provider.connection.check');
|
|
expect($result->run->managed_environment_id)->toBe((int) $tenant->getKey());
|
|
expect($result->run->context)->toMatchArray([
|
|
'provider_connection_id' => (int) $connection->getKey(),
|
|
]);
|
|
});
|