Some checks failed
Main Confidence / confidence (push) Failing after 57s
## Summary - add a read-first governance inbox page at `/admin/governance/inbox` - aggregate assigned findings, intake, stale operations, alert-delivery failures, and review follow-up into one canonical routing surface - add focused coverage for inbox authorization, navigation context, page behavior, and section builder logic - include the Spec Kit artifacts for spec 250 ## Notes - branch is synced with `dev` - this PR supersedes #290 for the governance inbox work Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #291
64 lines
2.2 KiB
PHP
64 lines
2.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Pages\Findings\MyFindingsInbox;
|
|
use App\Filament\Pages\Governance\GovernanceInbox;
|
|
use App\Models\Finding;
|
|
use App\Models\OperationRun;
|
|
use App\Models\Tenant;
|
|
use App\Support\Navigation\CanonicalNavigationContext;
|
|
use App\Support\OperationRunLinks;
|
|
use App\Support\OperationRunOutcome;
|
|
use App\Support\OperationRunStatus;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Filament\Facades\Filament;
|
|
|
|
it('embeds canonical governance inbox navigation context into source links', function (): void {
|
|
$tenant = Tenant::factory()->create([
|
|
'status' => 'active',
|
|
'name' => 'Alpha Tenant',
|
|
'external_id' => 'alpha-tenant',
|
|
]);
|
|
[$user, $tenant] = createUserWithTenant($tenant, role: 'owner', workspaceRole: 'owner');
|
|
|
|
$finding = Finding::factory()
|
|
->for($tenant)
|
|
->assignedTo((int) $user->getKey())
|
|
->create();
|
|
|
|
$run = OperationRun::factory()
|
|
->forTenant($tenant)
|
|
->create([
|
|
'status' => OperationRunStatus::Completed->value,
|
|
'outcome' => OperationRunOutcome::Failed->value,
|
|
'completed_at' => now()->subMinute(),
|
|
]);
|
|
|
|
$context = new CanonicalNavigationContext(
|
|
sourceSurface: 'governance.inbox',
|
|
canonicalRouteName: GovernanceInbox::getRouteName(Filament::getPanel('admin')),
|
|
backLinkLabel: 'Back to governance inbox',
|
|
backLinkUrl: GovernanceInbox::getUrl(panel: 'admin'),
|
|
);
|
|
|
|
$response = $this->actingAs($user)
|
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
|
->get(GovernanceInbox::getUrl(panel: 'admin'));
|
|
|
|
$response->assertOk();
|
|
|
|
$expectedMyFindingsUrl = htmlspecialchars(
|
|
MyFindingsInbox::getUrl(panel: 'admin').'?'.http_build_query($context->toQuery()),
|
|
ENT_QUOTES,
|
|
);
|
|
$expectedOperationUrl = htmlspecialchars(
|
|
OperationRunLinks::tenantlessView($run, $context),
|
|
ENT_QUOTES,
|
|
);
|
|
|
|
$response->assertSee($expectedMyFindingsUrl, false)
|
|
->assertSee($expectedOperationUrl, false)
|
|
->assertSee((string) $finding->getKey())
|
|
->assertSee('nav%5Bback_label%5D=Back+to+governance+inbox', false);
|
|
}); |