TenantAtlas/apps/platform/tests/Feature/OperationalControls/NoAdHocOperationalControlBypassTest.php
ahmido 2fa8fc0f87
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 51s
refactor: remove findings lifecycle backfill runtime surfaces (#294)
## Summary
- decommission the legacy findings lifecycle backfill substrate across command, job, service, and UI layers
- remove related platform capabilities, operation catalog entries, and action surface exemptions
- add regression and removal verification tests to ensure runtime integrity and surface absence
- include spec, plan, tasks, and data-model artifacts for the removal slice

## Scope
- active spec: specs/253-remove-findings-backfill-runtime-surfaces
- target branch: dev

## Validation
- integrated regression and removal verification tests for console, findings, and system ops surfaces
- audit log and capability trace verification for the removal path

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #294
2026-04-28 22:00:51 +00:00

82 lines
3.0 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' => [],
'forbidden' => [
'FindingsLifecycleBackfillRunbookService',
'FindingsLifecycleBackfillScope',
'Backfill findings lifecycle',
'backfill_lifecycle',
"config('tenantpilot.allow_admin_maintenance_actions'",
'allow_admin_maintenance_actions',
'OperationalControlActivation::',
],
],
[
'file' => $root.'/app/Filament/System/Pages/Ops/Runbooks.php',
'required' => [],
'forbidden' => [
'FindingsLifecycleBackfillRunbookService',
'FindingsLifecycleBackfillScope',
'findings.lifecycle.backfill',
'Rebuild Findings Lifecycle',
'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);
}
}
foreach ([
$root.'/app/Console/Commands/TenantpilotBackfillFindingLifecycle.php',
$root.'/app/Console/Commands/TenantpilotRunDeployRunbooks.php',
$root.'/app/Services/Runbooks/FindingsLifecycleBackfillRunbookService.php',
$root.'/app/Services/Runbooks/FindingsLifecycleBackfillScope.php',
$root.'/app/Jobs/BackfillFindingLifecycleJob.php',
$root.'/app/Jobs/BackfillFindingLifecycleWorkspaceJob.php',
$root.'/app/Jobs/BackfillFindingLifecycleTenantIntoWorkspaceRunJob.php',
] as $removedPath) {
expect(file_exists($removedPath))->toBeFalse("Removed findings lifecycle backfill artifact still exists: {$removedPath}");
}
})->group('surface-guard');