Compare commits
No commits in common. "e15940d01f425be09d81dc3db3ea07b929826485" and "cce0904e876b018340963c0846f9a13f0a727a63" have entirely different histories.
e15940d01f
...
cce0904e87
@ -2,12 +2,14 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Filament\Pages\BaselineCompareLanding;
|
||||
use App\Models\BaselineProfile;
|
||||
use App\Models\BaselineSnapshot;
|
||||
use App\Models\BaselineTenantAssignment;
|
||||
use App\Support\Baselines\BaselineCompareStats;
|
||||
use App\Support\Ui\OperatorExplanation\ExplanationFamily;
|
||||
use Filament\Facades\Filament;
|
||||
use Livewire\Livewire;
|
||||
|
||||
it('shows an unavailable explanation before any baseline compare result exists', function (): void {
|
||||
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
||||
@ -41,7 +43,8 @@
|
||||
->and($explanation->family)->toBe(ExplanationFamily::Unavailable)
|
||||
->and($explanation->nextActionText)->toBe('Run the baseline compare to generate a result');
|
||||
|
||||
baselineCompareLandingLivewire($tenant, user: $user)
|
||||
Livewire::actingAs($user)
|
||||
->test(BaselineCompareLanding::class)
|
||||
->assertSee($summary->headline)
|
||||
->assertSee($summary->nextActionLabel())
|
||||
->assertSee($explanation->coverageStatement ?? '');
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Filament\Pages\BaselineCompareLanding;
|
||||
use App\Filament\Resources\BaselineProfileResource\Pages\ViewBaselineProfile;
|
||||
use App\Support\Workspaces\WorkspaceContext;
|
||||
use Filament\Facades\Filament;
|
||||
@ -36,10 +37,12 @@
|
||||
$tenant->makeCurrent();
|
||||
Filament::setTenant($tenant, true);
|
||||
|
||||
baselineCompareLandingLivewire($tenant, user: $readonlyUser)
|
||||
Livewire::actingAs($readonlyUser)
|
||||
->test(BaselineCompareLanding::class)
|
||||
->assertActionDisabled('compareNow');
|
||||
|
||||
baselineCompareLandingLivewire($tenant, user: $ownerUser)
|
||||
Livewire::actingAs($ownerUser)
|
||||
->test(BaselineCompareLanding::class)
|
||||
->assertActionEnabled('compareNow');
|
||||
});
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Filament\Pages\BaselineCompareLanding;
|
||||
use App\Models\BaselineProfile;
|
||||
use App\Models\BaselineSnapshot;
|
||||
use App\Models\BaselineTenantAssignment;
|
||||
@ -11,6 +12,7 @@
|
||||
use App\Support\ReasonTranslation\ReasonPresenter;
|
||||
use App\Support\Ui\OperatorExplanation\ExplanationFamily;
|
||||
use Filament\Facades\Filament;
|
||||
use Livewire\Livewire;
|
||||
|
||||
it('renders suppressed baseline-compare results as explanation-first output instead of an implicit all-clear', function (): void {
|
||||
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
||||
@ -80,7 +82,8 @@
|
||||
expect($explanation->family)->toBe(ExplanationFamily::SuppressedOutput);
|
||||
expect($reasonSemantics)->not->toBeNull();
|
||||
|
||||
baselineCompareLandingLivewire($tenant, user: $user)
|
||||
Livewire::actingAs($user)
|
||||
->test(BaselineCompareLanding::class)
|
||||
->assertSee($summary->headline)
|
||||
->assertSee($explanation->trustworthinessLabel())
|
||||
->assertSee($summary->nextActionLabel())
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Filament\Pages\BaselineCompareLanding;
|
||||
use App\Filament\Widgets\Dashboard\BaselineCompareNow;
|
||||
use App\Filament\Widgets\ManagedEnvironment\BaselineCompareCoverageBanner;
|
||||
use App\Models\BaselineProfile;
|
||||
@ -90,7 +91,7 @@ function createBaselineCompareSummaryConsistencyTenant(): array
|
||||
->assertSee('The last compare finished, but normal result output was suppressed.')
|
||||
->assertDontSee('Aligned');
|
||||
|
||||
baselineCompareLandingLivewire($tenant)
|
||||
Livewire::test(BaselineCompareLanding::class)
|
||||
->assertSee('Needs review')
|
||||
->assertSee('The last compare finished, but normal result output was suppressed.')
|
||||
->assertSee('Limited confidence')
|
||||
@ -140,7 +141,7 @@ function createBaselineCompareSummaryConsistencyTenant(): array
|
||||
->assertSee('overdue finding')
|
||||
->assertSee('Open findings');
|
||||
|
||||
baselineCompareLandingLivewire($tenant)
|
||||
Livewire::test(BaselineCompareLanding::class)
|
||||
->assertSee('Action required')
|
||||
->assertSee('overdue finding')
|
||||
->assertSee('Open findings');
|
||||
@ -173,7 +174,7 @@ function createBaselineCompareSummaryConsistencyTenant(): array
|
||||
->assertSee('Baseline compare is in progress.')
|
||||
->assertSee('Open operation');
|
||||
|
||||
baselineCompareLandingLivewire($tenant)
|
||||
Livewire::test(BaselineCompareLanding::class)
|
||||
->assertSee('In progress')
|
||||
->assertSee('Baseline compare is in progress.')
|
||||
->assertSee('Open operation');
|
||||
|
||||
@ -123,7 +123,7 @@ function structuredGapSurfaceContext(): array
|
||||
'completed_at' => now(),
|
||||
]);
|
||||
|
||||
baselineCompareLandingLivewire($tenant)
|
||||
Livewire::test(BaselineCompareLanding::class)
|
||||
->assertSee('Evidence gap details')
|
||||
->assertSee('Subject class')
|
||||
->assertSee('Outcome')
|
||||
|
||||
@ -2452,7 +2452,8 @@ function actionSurfaceSystemPanelContext(array $capabilities): PlatformUser
|
||||
'baseline_profile_id' => (int) $profile->getKey(),
|
||||
]);
|
||||
|
||||
baselineCompareLandingLivewire($tenant, user: $approver)
|
||||
Livewire::actingAs($approver)
|
||||
->test(BaselineCompareLanding::class)
|
||||
->assertActionExists('compareNow', function (Action $action): bool {
|
||||
return $action->isConfirmationRequired()
|
||||
&& $action->getModalDescription() === 'This will refresh content evidence on demand (redacted) before comparing the current tenant inventory against the assigned baseline snapshot.';
|
||||
|
||||
@ -818,20 +818,12 @@ function createUserWithTenant(
|
||||
return [$user, $tenant];
|
||||
}
|
||||
|
||||
function baselineCompareLandingLivewire(
|
||||
ManagedEnvironment $tenant,
|
||||
array $queryParams = [],
|
||||
?\Illuminate\Contracts\Auth\Authenticatable $user = null,
|
||||
): mixed
|
||||
function baselineCompareLandingLivewire(ManagedEnvironment $tenant, array $queryParams = []): mixed
|
||||
{
|
||||
$manager = \Livewire\Livewire::withHeaders([
|
||||
'Referer' => \App\Support\ManagedEnvironmentLinks::baselineCompareUrl($tenant),
|
||||
]);
|
||||
|
||||
if ($user instanceof \Illuminate\Contracts\Auth\Authenticatable) {
|
||||
$manager = $manager->actingAs($user);
|
||||
}
|
||||
|
||||
if ($queryParams !== []) {
|
||||
$manager = $manager->withQueryParams($queryParams);
|
||||
}
|
||||
|
||||
@ -172,22 +172,3 @@ ## Implementation Evidence
|
||||
- scoped Pint on touched PHP files.
|
||||
- `git diff --check`
|
||||
- Broader `./vendor/bin/sail artisan test --filter=DecisionRegister` surfaced an existing unrelated failure in `FindingExceptionDecisionRegisterNavigationTest` where the expected back URL still includes `managed_environment_id`; no Spec 319 files or Decision Register code were changed for that.
|
||||
|
||||
## Reopened Validation Note
|
||||
|
||||
Spec 322's broader no-drift regression split exposed five Baseline Compare tests that still mounted `BaselineCompareLanding` without route-owned Environment context. That direct Livewire mount contradicted the Spec 319 hard cutover even though the runtime route contract was already canonical.
|
||||
|
||||
Fix applied on the 319 session branch:
|
||||
|
||||
- Extended the existing `baselineCompareLandingLivewire()` test helper so tests can pass an explicit acting user while preserving the canonical Baseline Compare referer and `environment` mount parameter.
|
||||
- Updated Baseline Compare explanation, summary-consistency, authorization, gap-surface, and action-surface tests to mount through explicit Environment ownership instead of remembered/implicit panel tenant state.
|
||||
- Confirmed no direct `Livewire::test(BaselineCompareLanding::class)` Feature/Unit mount remains.
|
||||
|
||||
Validation after reopening:
|
||||
|
||||
- `./vendor/bin/sail artisan test tests/Feature/Baselines/BaselineCompareExplanationFallbackTest.php tests/Feature/Filament/BaselineCompareExplanationSurfaceTest.php tests/Feature/Filament/BaselineCompareSummaryConsistencyTest.php --compact`
|
||||
- Result: 5 passed, 42 assertions.
|
||||
- `./vendor/bin/sail artisan test tests/Feature/Filament/BaselineActionAuthorizationTest.php tests/Feature/Filament/BaselineGapSurfacesDbOnlyRenderTest.php tests/Feature/Guards/ActionSurfaceContractTest.php --filter='baseline|compareNow|full content' --compact`
|
||||
- Result: 20 passed, 199 assertions.
|
||||
- `./vendor/bin/sail artisan test tests/Unit tests/Feature --filter='WorkspaceHub|EnvironmentFilter|ClearFilter|LegacyTenant|BaselineCompare|WorkspaceOwnedAnalysis|AlertsAudit' --compact`
|
||||
- Result: 233 passed, 1826 assertions.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user