## Summary - add Spec 288 no-legacy route/helper and provider-core/role-authority guard coverage - extend the pinned Spec 281 and Spec 285 browser smokes plus lane/report classification wording for classification-only fallout handling - add the Spec 288 artifact package and contributor-facing quality-gate guidance while keeping Package Execution deferred to Spec 289 ## Validation - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && REPO_ROOT="$(git rev-parse --show-toplevel)" && (cd "$REPO_ROOT/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)` - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && REPO_ROOT="$(git rev-parse --show-toplevel)" && (cd "$REPO_ROOT/apps/platform" && ./vendor/bin/sail artisan test --compact tests/Browser/Spec281ProviderConnectionScopeSmokeTest.php tests/Browser/Spec285WorkspaceRbacEnvironmentAccessSmokeTest.php)` - `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && REPO_ROOT="$(git rev-parse --show-toplevel)" && (cd "$REPO_ROOT/apps/platform" && ./vendor/bin/sail bin pint --dirty --format agent)` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #347
140 lines
5.5 KiB
PHP
140 lines
5.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
it('keeps cutover-owned route emission seams free of retired management paths', function (): void {
|
|
$root = base_path();
|
|
|
|
$forbiddenPatternsByFile = [
|
|
'routes/web.php' => [
|
|
'/\/admin\/tenants\/[^\'"\n]*\/provider-connections(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/provider-connections(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/required-permissions(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/memberships(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/t\//',
|
|
],
|
|
'app/Providers/Filament/AdminPanelProvider.php' => [
|
|
'/panel:\s*[\'\"]tenant[\'\"]/',
|
|
'/\/admin\/tenants\/[^\'"\n]*\/provider-connections(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/provider-connections(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/required-permissions(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/memberships(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/t\//',
|
|
],
|
|
'app/Filament/Resources/TenantResource.php' => [
|
|
'/panel:\s*[\'\"]tenant[\'\"]/',
|
|
'/\/admin\/tenants\/[^\'"\n]*\/provider-connections(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/provider-connections(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/required-permissions(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/memberships(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/t\//',
|
|
],
|
|
'app/Support/OperationRunLinks.php' => [
|
|
'/panel:\s*[\'\"]tenant[\'\"]/',
|
|
'/\/admin\/tenants\/[^\'"\n]*\/provider-connections(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/provider-connections(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/required-permissions(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/memberships(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/t\//',
|
|
],
|
|
'app/Support/Verification/VerificationLinkBehavior.php' => [
|
|
'/panel:\s*[\'\"]tenant[\'\"]/',
|
|
'/\/admin\/tenants\/[^\'"\n]*\/provider-connections(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/provider-connections(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/required-permissions(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/[^\'"\n]*\/memberships(?:[\/?"\']|$)/',
|
|
'/\/admin\/t\/t\//',
|
|
],
|
|
];
|
|
|
|
$hits = [];
|
|
|
|
foreach ($forbiddenPatternsByFile as $relativePath => $patterns) {
|
|
$absolutePath = $root.'/'.$relativePath;
|
|
|
|
expect(is_file($absolutePath))->toBeTrue("Expected guard-owned seam [{$relativePath}] to exist.");
|
|
|
|
$contents = file_get_contents($absolutePath);
|
|
|
|
if (! is_string($contents) || $contents === '') {
|
|
continue;
|
|
}
|
|
|
|
$lines = preg_split('/\R/', $contents) ?: [];
|
|
|
|
foreach ($patterns as $pattern) {
|
|
foreach ($lines as $index => $line) {
|
|
if (preg_match($pattern, $line) !== 1) {
|
|
continue;
|
|
}
|
|
|
|
$hits[] = $relativePath.':'.($index + 1).' -> '.trim($line);
|
|
}
|
|
}
|
|
}
|
|
|
|
expect($hits)->toBeEmpty("Retired management path or tenant-panel route emission detected on a Spec 288 seam:\n".implode("\n", $hits));
|
|
});
|
|
|
|
it('keeps spec 288 proof seams free of retired tenant-panel helper bootstrapping', function (): void {
|
|
$root = base_path();
|
|
|
|
$forbiddenPatternsByFile = [
|
|
'tests/Pest.php' => [
|
|
'/Filament::setCurrentPanel\(\s*[\'\"]tenant[\'\"]\s*\)/',
|
|
'/Filament::getPanel\(\s*[\'\"]tenant[\'\"]\s*\)/',
|
|
],
|
|
'tests/Browser/Spec281ProviderConnectionScopeSmokeTest.php' => [
|
|
'/setTenantPanelContext\s*\(/',
|
|
'/panel:\s*[\'\"]tenant[\'\"]/',
|
|
'/Filament::setCurrentPanel\(\s*[\'\"]tenant[\'\"]\s*\)/',
|
|
'/Filament::getPanel\(\s*[\'\"]tenant[\'\"]\s*\)/',
|
|
],
|
|
'tests/Browser/Spec285WorkspaceRbacEnvironmentAccessSmokeTest.php' => [
|
|
'/setTenantPanelContext\s*\(/',
|
|
'/panel:\s*[\'\"]tenant[\'\"]/',
|
|
'/Filament::setCurrentPanel\(\s*[\'\"]tenant[\'\"]\s*\)/',
|
|
'/Filament::getPanel\(\s*[\'\"]tenant[\'\"]\s*\)/',
|
|
],
|
|
'tests/Feature/ProviderConnections/LegacyRedirectTest.php' => [
|
|
'/setTenantPanelContext\s*\(/',
|
|
'/panel:\s*[\'\"]tenant[\'\"]/',
|
|
],
|
|
'tests/Feature/ManagedEnvironment/LegacyTenantCoreGuardTest.php' => [
|
|
'/setTenantPanelContext\s*\(/',
|
|
'/panel:\s*[\'\"]tenant[\'\"]/',
|
|
],
|
|
'tests/Feature/Spec080WorkspaceManagedTenantAdminMigrationTest.php' => [
|
|
'/setTenantPanelContext\s*\(/',
|
|
'/panel:\s*[\'\"]tenant[\'\"]/',
|
|
],
|
|
];
|
|
|
|
$hits = [];
|
|
|
|
foreach ($forbiddenPatternsByFile as $relativePath => $patterns) {
|
|
$absolutePath = $root.'/'.$relativePath;
|
|
|
|
expect(is_file($absolutePath))->toBeTrue("Expected Spec 288 proof seam [{$relativePath}] to exist.");
|
|
|
|
$contents = file_get_contents($absolutePath);
|
|
|
|
if (! is_string($contents) || $contents === '') {
|
|
continue;
|
|
}
|
|
|
|
$lines = preg_split('/\R/', $contents) ?: [];
|
|
|
|
foreach ($patterns as $pattern) {
|
|
foreach ($lines as $index => $line) {
|
|
if (preg_match($pattern, $line) !== 1) {
|
|
continue;
|
|
}
|
|
|
|
$hits[] = $relativePath.':'.($index + 1).' -> '.trim($line);
|
|
}
|
|
}
|
|
}
|
|
|
|
expect($hits)->toBeEmpty("Retired tenant-panel helper or bootstrapping detected on a Spec 288 proof seam:\n".implode("\n", $hits));
|
|
}); |