## Summary - rebuild the public Tenantial homepage around an evidence-first Microsoft tenant governance narrative - replace the old hero visual with a new static dashboard preview and add dedicated Trust Bar and Feature Pillars sections - update the shared public shell, navigation, footer, dark design tokens, assets, and homepage content to match the new brand direction - align website smoke coverage and Spec 400 artifacts with the rebuilt homepage ## Testing - not run in this pass - updated website smoke specs under apps/website/tests/smoke ## Note - `website-dev` was pushed to `origin` so the requested PR base exists remotely - the remote `website-dev` branch is an ancestor of `origin/dev`, so this PR may also show upstream `dev` history relative to that base Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #387
115 lines
4.7 KiB
PHP
115 lines
4.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\BaselineProfile;
|
|
use App\Models\BaselineSnapshot;
|
|
use App\Models\BaselineSnapshotItem;
|
|
use App\Models\OperationRun;
|
|
use App\Models\Workspace;
|
|
use App\Support\Baselines\BaselineReasonCodes;
|
|
use App\Support\Baselines\BaselineSnapshotLifecycleState;
|
|
use App\Support\OperationRunOutcome;
|
|
use App\Support\OperationRunType;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
function classifyLegacySnapshotForTest(BaselineSnapshot $snapshot): array
|
|
{
|
|
/** @var Migration $migration */
|
|
$migration = require base_path('database/migrations/2026_03_23_000001_add_lifecycle_state_to_baseline_snapshots_table.php');
|
|
|
|
$reflection = new ReflectionMethod($migration, 'classifyLegacySnapshot');
|
|
$reflection->setAccessible(true);
|
|
|
|
return $reflection->invoke(
|
|
$migration,
|
|
(object) [
|
|
'id' => (int) $snapshot->getKey(),
|
|
'workspace_id' => (int) $snapshot->workspace_id,
|
|
'baseline_profile_id' => (int) $snapshot->baseline_profile_id,
|
|
'captured_at' => $snapshot->captured_at,
|
|
'created_at' => $snapshot->created_at,
|
|
'updated_at' => $snapshot->updated_at,
|
|
'summary_jsonb' => json_encode($snapshot->summary_jsonb),
|
|
],
|
|
is_array($snapshot->summary_jsonb) ? $snapshot->summary_jsonb : [],
|
|
BaselineSnapshotItem::query()->where('baseline_snapshot_id', (int) $snapshot->getKey())->count(),
|
|
);
|
|
}
|
|
|
|
it('classifies legacy snapshots as complete when summary counts prove completion', function (): void {
|
|
$workspace = Workspace::factory()->create();
|
|
$profile = BaselineProfile::factory()->active()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
]);
|
|
|
|
$snapshot = BaselineSnapshot::factory()->complete()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'baseline_profile_id' => (int) $profile->getKey(),
|
|
'summary_jsonb' => ['total_items' => 2],
|
|
]);
|
|
|
|
BaselineSnapshotItem::factory()->count(2)->create([
|
|
'baseline_snapshot_id' => (int) $snapshot->getKey(),
|
|
]);
|
|
|
|
$classification = classifyLegacySnapshotForTest($snapshot);
|
|
|
|
expect($classification['lifecycle_state'])->toBe(BaselineSnapshotLifecycleState::Complete->value)
|
|
->and(data_get($classification, 'completion_meta.expected_items'))->toBe(2)
|
|
->and(data_get($classification, 'completion_meta.persisted_items'))->toBe(2);
|
|
});
|
|
|
|
it('classifies proven empty legacy captures as incomplete no-data snapshots when the producer run confirms zero subjects', function (): void {
|
|
$workspace = Workspace::factory()->create();
|
|
$profile = BaselineProfile::factory()->active()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
]);
|
|
|
|
$snapshot = BaselineSnapshot::factory()->complete()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'baseline_profile_id' => (int) $profile->getKey(),
|
|
'summary_jsonb' => ['total_items' => 0],
|
|
]);
|
|
|
|
OperationRun::factory()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'type' => OperationRunType::BaselineCapture->value,
|
|
'outcome' => OperationRunOutcome::Succeeded->value,
|
|
'context' => [
|
|
'baseline_profile_id' => (int) $profile->getKey(),
|
|
'result' => ['snapshot_id' => (int) $snapshot->getKey()],
|
|
'baseline_capture' => ['subjects_total' => 0],
|
|
],
|
|
'completed_at' => now(),
|
|
]);
|
|
|
|
$classification = classifyLegacySnapshotForTest($snapshot);
|
|
|
|
expect($classification['lifecycle_state'])->toBe(BaselineSnapshotLifecycleState::Incomplete->value)
|
|
->and(data_get($classification, 'completion_meta.was_empty_capture'))->toBeTrue()
|
|
->and(data_get($classification, 'completion_meta.finalization_reason_code'))->toBe(BaselineReasonCodes::CAPTURE_ZERO_SUBJECTS);
|
|
});
|
|
|
|
it('classifies ambiguous legacy snapshots as incomplete with a conservative reason code', function (): void {
|
|
$workspace = Workspace::factory()->create();
|
|
$profile = BaselineProfile::factory()->active()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
]);
|
|
|
|
$snapshot = BaselineSnapshot::factory()->complete()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'baseline_profile_id' => (int) $profile->getKey(),
|
|
'summary_jsonb' => ['total_items' => 2],
|
|
]);
|
|
|
|
BaselineSnapshotItem::factory()->create([
|
|
'baseline_snapshot_id' => (int) $snapshot->getKey(),
|
|
]);
|
|
|
|
$classification = classifyLegacySnapshotForTest($snapshot);
|
|
|
|
expect($classification['lifecycle_state'])->toBe(BaselineSnapshotLifecycleState::Incomplete->value)
|
|
->and(data_get($classification, 'completion_meta.finalization_reason_code'))->toBe(BaselineReasonCodes::SNAPSHOT_LEGACY_CONTRADICTORY);
|
|
});
|