TenantAtlas/apps/platform/tests/Feature/Guards/FixtureLaneImpactBudgetTest.php
ahmido 0d5d1fc9f4 Spec 208: finalize heavy suite segmentation (#241)
## Summary
- add the checked-in Spec 208 heavy-suite classification and family manifest with config-driven lane generation, attribution, and budget reporting
- update Pest grouping, guard coverage, wrapper/report contracts, and spec artifacts for the segmented lane model
- complete the targeted follow-up pass that re-homes the remaining in-scope confidence hotspots into explicit heavy-governance families

## Acceptance
- confidence is repaired and now measures 389.613832s, down from 587.446894s and below the 450s lane budget
- confidence is also slightly below the post-Spec-207 baseline of 394.383441s (delta -4.769609s)
- this closes the central Spec 208 acceptance issue that had kept the spec open

## Intentionally Re-homed Families
- finding-bulk-actions-workflow
- drift-bulk-triage-all-matching
- baseline-profile-start-surfaces
- workspace-settings-slice-management
- findings-workflow-surfaces
- workspace-only-admin-surface-independence

## Explicit Residual Risk
- heavy-governance now measures 318.296962s, above its documented 300s threshold
- the cost was not removed; it was moved into the correct lane and made visible on clearly named heavy families
- this is documented residual debt, not an open Spec 208 failure

## Validation
- focused guard/support validation: 206 passed (3607 assertions)
- lane wrapper/report validation completed for confidence and heavy-governance
- no full-suite run was performed in this pass by request

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #241
2026-04-17 09:53:55 +00:00

99 lines
4.8 KiB
PHP

<?php
declare(strict_types=1);
use Tests\Support\TestLaneManifest;
use Tests\Support\TestLaneReport;
it('keeps the shared fixture slimming pre-migration baselines recorded for the standard lanes', function (): void {
$fastFeedback = TestLaneManifest::comparisonBaseline('shared-test-fixture-slimming', 'fast-feedback');
$confidence = TestLaneManifest::comparisonBaseline('shared-test-fixture-slimming', 'confidence');
expect($fastFeedback)->toMatchArray([
'laneId' => 'fast-feedback',
'wallClockSeconds' => 176.73623,
'targetImprovementPercent' => 10,
'maxRegressionPercent' => 5,
])
->and($confidence)->toMatchArray([
'laneId' => 'confidence',
'wallClockSeconds' => 394.383441,
'targetImprovementPercent' => 10,
'maxRegressionPercent' => 5,
]);
});
it('classifies lane-impact comparison status against the recorded fixture slimming baseline', function (): void {
$improved = TestLaneReport::buildReport(
laneId: 'fast-feedback',
wallClockSeconds: 150.0,
slowestEntries: [],
durationsByFile: [],
comparisonProfile: 'shared-test-fixture-slimming',
);
$stable = TestLaneReport::buildReport(
laneId: 'fast-feedback',
wallClockSeconds: 180.0,
slowestEntries: [],
durationsByFile: [],
comparisonProfile: 'shared-test-fixture-slimming',
);
$regressed = TestLaneReport::buildReport(
laneId: 'fast-feedback',
wallClockSeconds: 190.0,
slowestEntries: [],
durationsByFile: [],
comparisonProfile: 'shared-test-fixture-slimming',
);
expect(data_get($improved, 'sharedFixtureSlimmingComparison.status'))->toBe('improved')
->and(data_get($stable, 'sharedFixtureSlimmingComparison.status'))->toBe('stable')
->and(data_get($regressed, 'sharedFixtureSlimmingComparison.status'))->toBe('regressed');
});
it('defines lane, classification, and family budget targets for heavy-governance attribution', function (): void {
$budgetTargets = collect(TestLaneManifest::budgetTargets());
expect($budgetTargets->contains(static fn (array $target): bool => $target['targetType'] === 'lane' && $target['targetId'] === 'heavy-governance'))->toBeTrue()
->and($budgetTargets->contains(static fn (array $target): bool => $target['targetType'] === 'classification' && $target['targetId'] === 'surface-guard'))->toBeTrue()
->and($budgetTargets->contains(static fn (array $target): bool => $target['targetType'] === 'classification' && $target['targetId'] === 'discovery-heavy'))->toBeTrue()
->and($budgetTargets->contains(static fn (array $target): bool => $target['targetType'] === 'family' && $target['targetId'] === 'action-surface-contract'))->toBeTrue()
->and($budgetTargets->contains(static fn (array $target): bool => $target['targetType'] === 'family' && $target['targetId'] === 'ops-ux-governance'))->toBeTrue();
});
it('evaluates heavy-governance budgets against named class and family totals', function (): void {
$durationsByFile = [
'tests/Feature/Guards/ActionSurfaceContractTest.php' => 31.2,
'tests/Feature/Filament/PolicyResourceAdminSearchParityTest.php' => 17.4,
'tests/Feature/Filament/PolicyVersionAdminSearchParityTest.php' => 16.1,
'tests/Feature/Filament/Alerts/AlertsKpiHeaderTest.php' => 9.8,
'tests/Feature/Guards/OperationLifecycleOpsUxGuardTest.php' => 8.7,
];
$slowestEntries = collect($durationsByFile)
->map(static fn (float $seconds, string $file): array => [
'label' => $file.'::synthetic',
'subject' => $file.'::synthetic',
'filePath' => $file,
'durationSeconds' => $seconds,
'wallClockSeconds' => $seconds,
'laneId' => 'heavy-governance',
])
->values()
->all();
$report = TestLaneReport::buildReport(
laneId: 'heavy-governance',
wallClockSeconds: 110.0,
slowestEntries: $slowestEntries,
durationsByFile: $durationsByFile,
);
expect(collect($report['budgetEvaluations'])->pluck('targetType')->unique()->values()->all())
->toEqualCanonicalizing(['lane', 'classification', 'family'])
->and(collect($report['budgetEvaluations'])->contains(static fn (array $evaluation): bool => $evaluation['targetType'] === 'lane' && $evaluation['targetId'] === 'heavy-governance'))->toBeTrue()
->and(collect($report['budgetEvaluations'])->contains(static fn (array $evaluation): bool => $evaluation['targetType'] === 'classification' && $evaluation['targetId'] === 'surface-guard'))->toBeTrue()
->and(collect($report['budgetEvaluations'])->contains(static fn (array $evaluation): bool => $evaluation['targetType'] === 'family' && $evaluation['targetId'] === 'action-surface-contract'))->toBeTrue();
});