## Summary - cut over workspace-owned analysis and library surfaces to workspace shell ownership instead of inheriting remembered environment shell context - update the affected findings pages, scope resolution, navigation helpers, and related Blade views to keep environment focus explicit instead of implicit - add and update Spec 320 artifacts plus focused regression coverage for findings navigation context, workspace hub registration, and admin surface scope behavior ## Guardrails - Filament remains on v5 with Livewire v4 compliance unchanged - provider registration remains in apps/platform/bootstrap/providers.php - no new globally searchable resources were introduced or changed - no new destructive actions were introduced or changed - no Filament assets were added or changed, so the deploy requirement for filament:assets is unchanged ## Testing - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Findings/FindingsAssignmentHygieneReportTest.php tests/Feature/Findings/FindingsIntakeQueueNavigationContextTest.php tests/Feature/Findings/FindingsIntakeQueueTest.php tests/Feature/Findings/MyFindingsInboxNavigationContextTest.php tests/Feature/Findings/MyWorkInboxTest.php tests/Feature/Navigation/WorkspaceHubRegistryTest.php tests/Unit/Support/OperateHub/OperateHubShellResolutionTest.php tests/Unit/Tenants/AdminSurfaceScopeTest.php` - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #375
71 lines
4.0 KiB
PHP
71 lines
4.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Support\Navigation\WorkspaceHubRegistry;
|
|
|
|
it('Spec314 lists workspace hubs and explicit exclusions', function (): void {
|
|
expect(array_keys(WorkspaceHubRegistry::entries()))
|
|
->toContain(
|
|
'workspace_home',
|
|
'workspace_overview',
|
|
'operations',
|
|
'provider_connections',
|
|
'finding_exceptions_queue',
|
|
'evidence_overview',
|
|
'review_register',
|
|
'customer_review_workspace',
|
|
'governance_inbox',
|
|
'decision_register',
|
|
'audit_log',
|
|
'alerts',
|
|
'alert_deliveries',
|
|
'alert_rules',
|
|
'alert_destinations',
|
|
'workspace_settings',
|
|
'manage_workspaces',
|
|
'managed_environments_landing',
|
|
)
|
|
->and(array_keys(WorkspaceHubRegistry::exclusions()))
|
|
->toContain(
|
|
'environment_dashboard',
|
|
'stored_reports_environment_routes',
|
|
'support_request_action_surface',
|
|
);
|
|
});
|
|
|
|
it('Spec314 classifies workspace hubs without classifying environment-owned pages', function (): void {
|
|
expect(WorkspaceHubRegistry::isWorkspaceHubPath('/admin'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/overview'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/operations'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/environments'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/environments/2'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isExplicitlyExcludedPath('/admin/workspaces/1/environments/2'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/environments/2/baseline-compare'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isExplicitlyExcludedPath('/admin/workspaces/1/environments/2/baseline-compare'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/baseline-compare-landing'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/baseline-profiles'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/baseline-profiles/42/compare-matrix'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/baseline-snapshots'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/findings/my-work'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/findings/intake'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/findings/hygiene'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/cross-environment-compare'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/environments/2/stored-reports'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isExplicitlyExcludedPath('/admin/workspaces/1/environments/2/stored-reports'))->toBeTrue();
|
|
});
|
|
|
|
it('Spec314 owns forbidden query keys and environment-like filter keys', function (): void {
|
|
expect(WorkspaceHubRegistry::forbiddenQueryKeys())
|
|
->toBe(['tenant', 'tenant_id', 'managed_environment_id', 'environment_id', 'environment', 'tenant_scope', 'tableFilters'])
|
|
->and(WorkspaceHubRegistry::environmentLikeFilterKeys())
|
|
->toBe(['tenant', 'tenant_id', 'managed_environment_id', 'environment_id', 'environment', 'tenant_scope']);
|
|
});
|
|
|
|
it('Spec314 strips forbidden workspace hub query keys without touching unrelated navigation state', function (): void {
|
|
$url = WorkspaceHubRegistry::cleanUrl('/admin/provider-connections?tenant=a&tenant_id=1&managed_environment_id=2&environment_id=3&tenant_scope=all&tableFilters%5Btenant%5D=x&activeTab=failed&family=alerts');
|
|
|
|
expect($url)->toBe('/admin/provider-connections?activeTab=failed&family=alerts')
|
|
->and(WorkspaceHubRegistry::hasForbiddenQuery($url))->toBeFalse();
|
|
});
|