Implements Spec 096 ops polish bundle: - Persist durable OperationRun.summary_counts for assignment fetch/restore (final attempt wins) - Server-side dedupe for assignment jobs (15-minute cooldown + non-canonical skip) - Track ReconcileAdapterRunsJob via workspace-scoped OperationRun + stable failure codes + overlap prevention - Seed DX: ensure seeded tenants use UUID v4 external_id and seed satisfies workspace_id NOT NULL constraints Verification (local / evidence-based): - `vendor/bin/sail artisan test --compact tests/Feature/Operations/AssignmentRunSummaryCountsTest.php tests/Feature/Operations/AssignmentJobDedupeTest.php tests/Feature/Operations/ReconcileAdapterRunsJobTrackingTest.php tests/Feature/Seed/PoliciesSeederExternalIdTest.php` - `vendor/bin/sail bin pint --dirty` Spec artifacts included under `specs/096-ops-polish-assignment-dedupe-system-tracking/` (spec/plan/tasks/checklists). Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #115
30 lines
961 B
PHP
30 lines
961 B
PHP
<?php
|
|
|
|
use App\Models\Tenant;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Str;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
test('policies seeder assigns uuid v4 external_id to seeded tenant', function (): void {
|
|
config()->set('tenantpilot.supported_policy_types', []);
|
|
|
|
$_ENV['INTUNE_TENANT_ID'] = 'seed-tenant-id';
|
|
$_SERVER['INTUNE_TENANT_ID'] = 'seed-tenant-id';
|
|
putenv('INTUNE_TENANT_ID=seed-tenant-id');
|
|
|
|
$this->artisan('db:seed', ['--class' => Database\Seeders\PoliciesSeeder::class])
|
|
->assertExitCode(0);
|
|
|
|
$tenant = Tenant::query()->first();
|
|
|
|
expect($tenant)->not->toBeNull();
|
|
expect($tenant?->tenant_id)->toBe('seed-tenant-id');
|
|
|
|
$externalId = (string) ($tenant?->external_id ?? '');
|
|
|
|
expect(Str::isUuid($externalId))->toBeTrue();
|
|
expect(substr($externalId, 14, 1))->toBe('4');
|
|
expect(in_array(strtolower(substr($externalId, 19, 1)), ['8', '9', 'a', 'b'], true))->toBeTrue();
|
|
});
|