## Summary - enforce the canonical workspace/environment scope contract for workspace hubs and environment-owned surfaces - replace first-party Operations deep links that leaked Filament `tableFilters[...]` internals with stable product-level query behavior - add the sidebar scope indicator and split environment-page navigation into explicit `Workspace-wide` and `Workspace admin` groups - remove redundant tenantless `All environments` scope badges from workspace-wide pages while preserving explicit environment filter affordances - include the Spec 338 artifacts, guard tests, and browser smoke coverage for the new contract ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Navigation/Spec338EnvironmentSidebarSeparationTest.php tests/Feature/Navigation/Spec338OperationRunLinksQueryContractTest.php tests/Feature/Navigation/Spec338SidebarScopeIndicatorTest.php tests/Feature/Filament/PanelNavigationSegregationTest.php` - `cd apps/platform && ./vendor/bin/sail php vendor/bin/pest tests/Browser/Spec338ScopeContractSmokeTest.php --compact` ## Notes - Livewire v4 compliance unchanged - Filament provider registration remains in `bootstrap/providers.php` - no destructive action behavior changed - no migrations, env var changes, or new Filament asset registration Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #409
56 lines
4.2 KiB
PHP
56 lines
4.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Support\Navigation\AdminSurfaceScope;
|
|
use App\Support\Tenants\TenantInteractionLane;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('classifies in-scope admin routes into canonical page categories', function (string $path, AdminSurfaceScope $expected): void {
|
|
expect(AdminSurfaceScope::fromPath($path))->toBe($expected);
|
|
})->with([
|
|
'workspace overview' => ['/admin', AdminSurfaceScope::WorkspaceWideSurface],
|
|
'workspace chooser exception' => ['/admin/choose-workspace', AdminSurfaceScope::WorkspaceChooserException],
|
|
'tenant chooser' => ['/admin/choose-environment', AdminSurfaceScope::WorkspaceScoped],
|
|
'retired tenant resource detail' => ['/admin/tenants/tenant-123', AdminSurfaceScope::WorkspaceScoped],
|
|
'retired tenant panel route' => ['/admin/t/tenant-123', AdminSurfaceScope::WorkspaceScoped],
|
|
'workspace environment detail' => ['/admin/workspaces/acme/environments/tenant-123', AdminSurfaceScope::EnvironmentBound],
|
|
'baseline compare environment route' => ['/admin/workspaces/acme/environments/tenant-123/baseline-compare', AdminSurfaceScope::EnvironmentBound],
|
|
'baseline profiles list' => ['/admin/baseline-profiles', AdminSurfaceScope::WorkspaceOwnedAnalysisSurface],
|
|
'baseline profiles detail' => ['/admin/baseline-profiles/42', AdminSurfaceScope::WorkspaceOwnedAnalysisSurface],
|
|
'baseline profiles edit' => ['/admin/baseline-profiles/42/edit', AdminSurfaceScope::WorkspaceOwnedAnalysisSurface],
|
|
'baseline profiles compare matrix' => ['/admin/baseline-profiles/42/compare-matrix', AdminSurfaceScope::WorkspaceOwnedAnalysisSurface],
|
|
'baseline snapshots list' => ['/admin/baseline-snapshots', AdminSurfaceScope::WorkspaceOwnedAnalysisSurface],
|
|
'baseline snapshots detail' => ['/admin/baseline-snapshots/42', AdminSurfaceScope::WorkspaceOwnedAnalysisSurface],
|
|
'my findings inbox' => ['/admin/findings/my-work', AdminSurfaceScope::WorkspaceOwnedAnalysisSurface],
|
|
'findings intake' => ['/admin/findings/intake', AdminSurfaceScope::WorkspaceOwnedAnalysisSurface],
|
|
'findings hygiene' => ['/admin/findings/hygiene', AdminSurfaceScope::WorkspaceOwnedAnalysisSurface],
|
|
'cross-environment compare' => ['/admin/cross-environment-compare', AdminSurfaceScope::WorkspaceOwnedAnalysisSurface],
|
|
'environment evidence detail' => ['/admin/workspaces/acme/environments/tenant-123/evidence/123', AdminSurfaceScope::EnvironmentBound],
|
|
'evidence overview' => ['/admin/evidence/overview', AdminSurfaceScope::WorkspaceWideSurface],
|
|
'customer review workspace' => ['/admin/reviews/workspace', AdminSurfaceScope::WorkspaceWideSurface],
|
|
'review register' => ['/admin/reviews', AdminSurfaceScope::WorkspaceWideSurface],
|
|
'governance decisions' => ['/admin/governance/decisions', AdminSurfaceScope::WorkspaceWideSurface],
|
|
'alerts' => ['/admin/alerts', AdminSurfaceScope::WorkspaceWideSurface],
|
|
'provider connections' => ['/admin/provider-connections', AdminSurfaceScope::WorkspaceWideSurface],
|
|
'workspace home overview' => ['/admin/workspaces/acme/overview', AdminSurfaceScope::WorkspaceWideSurface],
|
|
'onboarding index' => ['/admin/onboarding', AdminSurfaceScope::OnboardingWorkflow],
|
|
'onboarding draft' => ['/admin/onboarding/42', AdminSurfaceScope::OnboardingWorkflow],
|
|
'operations index' => ['/admin/workspaces/acme/operations', AdminSurfaceScope::WorkspaceWideSurface],
|
|
'retired operation run detail' => ['/admin/operations/44', AdminSurfaceScope::WorkspaceScoped],
|
|
'operation run detail' => ['/admin/workspaces/acme/operations/44', AdminSurfaceScope::CanonicalWorkspaceRecordViewer],
|
|
]);
|
|
|
|
it('keeps workspace owned analysis surfaces tenantless without query hint or remembered environment restore', function (): void {
|
|
$surface = AdminSurfaceScope::WorkspaceOwnedAnalysisSurface;
|
|
|
|
expect($surface->allowsQueryEnvironmentHints())->toBeFalse()
|
|
->and($surface->allowsRememberedEnvironmentRestore())->toBeFalse()
|
|
->and($surface->allowsEnvironmentlessState())->toBeTrue()
|
|
->and($surface->forcesEnvironmentlessShellContext())->toBeTrue()
|
|
->and($surface->requiresExplicitEnvironment())->toBeFalse()
|
|
->and($surface->lane())->toBe(TenantInteractionLane::StandardActiveOperating);
|
|
});
|