Implements Spec 116 baseline drift engine v1 (meta fidelity) with coverage guard, stable finding identity, and Filament UI surfaces. Highlights - Baseline capture/compare jobs and supporting services (meta contract hashing via InventoryMetaContract + DriftHasher) - Coverage proof parsing + compare partial outcome behavior - Filament pages/resources/widgets for baseline compare + drift landing improvements - Pest tests for capture/compare/coverage guard and UI start surfaces - Research report: docs/research/golden-master-baseline-drift-deep-analysis.md Validation - `vendor/bin/sail bin pint --dirty` - `vendor/bin/sail artisan test --compact --filter="Baseline"` Notes - No destructive user actions added; compare/capture remain queued jobs. - Provider registration unchanged (Laravel 11+/12 uses bootstrap/providers.php for panel providers; not touched here). Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #141
63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\BaselineProfile;
|
|
use App\Models\User;
|
|
use App\Models\Workspace;
|
|
use App\Support\Baselines\BaselineProfileStatus;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<BaselineProfile>
|
|
*/
|
|
class BaselineProfileFactory extends Factory
|
|
{
|
|
protected $model = BaselineProfile::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'workspace_id' => Workspace::factory(),
|
|
'name' => fake()->unique()->words(3, true),
|
|
'description' => fake()->optional()->sentence(),
|
|
'version_label' => fake()->optional()->numerify('v#.#'),
|
|
'status' => BaselineProfileStatus::Draft->value,
|
|
'scope_jsonb' => ['policy_types' => [], 'foundation_types' => []],
|
|
'active_snapshot_id' => null,
|
|
'created_by_user_id' => null,
|
|
];
|
|
}
|
|
|
|
public function active(): static
|
|
{
|
|
return $this->state(fn (): array => [
|
|
'status' => BaselineProfileStatus::Active->value,
|
|
]);
|
|
}
|
|
|
|
public function archived(): static
|
|
{
|
|
return $this->state(fn (): array => [
|
|
'status' => BaselineProfileStatus::Archived->value,
|
|
]);
|
|
}
|
|
|
|
public function withScope(array $policyTypes): static
|
|
{
|
|
return $this->state(fn (): array => [
|
|
'scope_jsonb' => ['policy_types' => $policyTypes, 'foundation_types' => []],
|
|
]);
|
|
}
|
|
|
|
public function createdBy(User $user): static
|
|
{
|
|
return $this->state(fn (): array => [
|
|
'created_by_user_id' => $user->getKey(),
|
|
]);
|
|
}
|
|
}
|