TenantAtlas/apps/platform/tests/Feature/Guards/OperationLifecycleOpsUxGuardTest.php
ahmido a2fdca43fd feat: implement heavy governance cost recovery (#242)
## Summary
- implement Spec 209 heavy-governance cost recovery end to end
- add the heavy-governance contract, hotspot inventory, decomposition, snapshots, budget outcome, and author-guidance surfaces in the shared lane support seams
- slim the baseline and findings hotspot families, harden wrapper behavior, and refresh the spec, quickstart, and contract artifacts

## Validation
- `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent`
- `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Guards/TestLaneCommandContractTest.php tests/Feature/Guards/ActionSurfaceContractTest.php tests/Feature/Guards/OperationLifecycleOpsUxGuardTest.php`
- `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Filament/BaselineProfileCaptureStartSurfaceTest.php tests/Feature/Filament/BaselineProfileCompareStartSurfaceTest.php tests/Feature/Filament/BaselineActionAuthorizationTest.php tests/Feature/Findings/FindingsListFiltersTest.php tests/Feature/Findings/FindingExceptionRenewalTest.php tests/Feature/Findings/FindingWorkflowRowActionsTest.php tests/Feature/Findings/FindingWorkflowViewActionsTest.php tests/Feature/Guards/ActionSurfaceContractTest.php tests/Feature/Guards/OperationLifecycleOpsUxGuardTest.php`
- `./scripts/platform-sail artisan test --compact`

## Outcome
- heavy-governance latest artifacts now agree on an authoritative `330s` threshold with `recalibrated` outcome after the honest rerun
- full suite result: `3760 passed`, `8 skipped`, `23535 assertions`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #242
2026-04-17 13:17:13 +00:00

45 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
use App\Services\Operations\OperationLifecyclePolicyValidator;
use Tests\Support\OpsUx\SourceFileScanner;
use Tests\Support\TestLaneManifest;
it('keeps ops ux governance retained in the heavy-governance inventory', function (): void {
$inventoryRecord = collect(TestLaneManifest::heavyGovernanceHotspotInventory())
->firstWhere('familyId', 'ops-ux-governance');
expect($inventoryRecord)->not->toBeNull()
->and($inventoryRecord['classificationId'])->toBe('surface-guard')
->and($inventoryRecord['status'])->toBe('retained');
});
it('keeps lifecycle bridge ownership and initiator-null notification discipline intact', function (): void {
$validator = app(OperationLifecyclePolicyValidator::class);
$result = $validator->validate();
expect($result['valid'])->toBeTrue();
$root = SourceFileScanner::projectRoot();
$operationRunService = SourceFileScanner::read($root.'/app/Services/OperationRunService.php');
expect($operationRunService)->toContain('if ($run->user instanceof User)')
->and($operationRunService)->toContain('OperationRunCompletedNotification')
->and($operationRunService)->toContain('bridgeFailedJobFailure');
$directBridgeJobs = [
$root.'/app/Jobs/CaptureBaselineSnapshotJob.php',
$root.'/app/Jobs/CompareBaselineToTenantJob.php',
$root.'/app/Jobs/RunInventorySyncJob.php',
$root.'/app/Jobs/SyncPoliciesJob.php',
$root.'/app/Jobs/BulkTenantSyncJob.php',
$root.'/app/Jobs/BulkBackupSetRestoreJob.php',
$root.'/app/Jobs/ComposeTenantReviewJob.php',
];
foreach ($directBridgeJobs as $jobPath) {
expect(SourceFileScanner::read($jobPath))->toContain('BridgesFailedOperationRun');
}
})->group('ops-ux');