TenantAtlas/apps/platform/tests/Feature/OperationalControls/NoAdHocOperationalControlBypassTest.php
ahmido d96abc65fb
Some checks failed
Main Confidence / confidence (push) Failing after 1m23s
Remove Findings lifecycle backfill operational surface (controls slice) (#280)
Removes the Findings lifecycle backfill from the Operational Controls UI and OperationalControlCatalog.

This patch is a safe, controls-only change; runbooks, jobs and other runtime artifacts are NOT removed yet. Follow-up work will delete the runbook service/scope, jobs, commands, and update tests.

Files changed:
- apps/platform/app/Filament/System/Pages/Ops/Controls.php
- apps/platform/app/Support/OperationalControls/OperationalControlCatalog.php
- apps/platform/tests/Feature/System/OpsControls/OperationalControlManagementTest.php
- apps/platform/tests/Unit/Support/OperationalControls/OperationalControlCatalogTest.php
- apps/platform/tests/Unit/Support/OperationalControls/OperationalControlScopeResolutionTest.php

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #280
2026-04-26 15:43:47 +00:00

69 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
use Tests\Support\OpsUx\SourceFileScanner;
it('keeps the in-scope operational controls on the shared service and evaluator paths', function (): void {
$root = SourceFileScanner::projectRoot();
$checks = [
[
'file' => $root.'/app/Filament/Resources/FindingResource/Pages/ListFindings.php',
'required' => [
'FindingsLifecycleBackfillRunbookService',
'OperationalControlBlockedException',
'FindingsLifecycleBackfillScope::singleTenant(',
],
'forbidden' => [
"config('tenantpilot.allow_admin_maintenance_actions'",
'allow_admin_maintenance_actions',
'OperationalControlActivation::',
],
],
[
'file' => $root.'/app/Filament/System/Pages/Ops/Runbooks.php',
'required' => [
'FindingsLifecycleBackfillRunbookService',
'OperationalControlBlockedException',
'$runbookService->start(',
],
'forbidden' => [
'OperationalControlActivation::',
"config('tenantpilot.allow_admin_maintenance_actions'",
],
],
[
'file' => $root.'/app/Filament/Resources/RestoreRunResource.php',
'required' => [
'guardRestoreExecutionOperationalControl(',
'OperationalControlEvaluator::class',
'OperationalControlBlockedException',
],
'forbidden' => [
'OperationalControlActivation::',
"config('tenantpilot.allow_admin_maintenance_actions'",
],
],
[
'file' => $root.'/config/tenantpilot.php',
'required' => [],
'forbidden' => [
'allow_admin_maintenance_actions',
'ALLOW_ADMIN_MAINTENANCE_ACTIONS',
],
],
];
foreach ($checks as $check) {
$source = SourceFileScanner::read($check['file']);
foreach ($check['required'] as $needle) {
expect($source)->toContain($needle);
}
foreach ($check['forbidden'] as $needle) {
expect($source)->not->toContain($needle);
}
}
})->group('surface-guard');