── Investor scenarios ── ✓ alone investor: is_duplicate=false ✓ alice group A pre-collision: false
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'alice@example.com' for key 'investors_email_unique' (Connection: mysql, Host: 127.0.0.1, Port: 3306, Database: angels_dev, SQL: insert into `investors` (`monday_item_id`, `group_id`, `email`, `phone_number`, `source`, `is_active`, `last_synced_at`, `updated_at`, `created_at`) values (8100000003, 11, alice@example.com, +966 500000003, monday, 1, 2026-09-29 20:04:22, 2026-09-29 20:04:22, 2026-09-29 20:04:22))
Illuminate\Database\Connection->runQueryCallback(string, array, object(Closure))Illuminate\Database\Connection->runQueryCallback(string, array, object(Closure))Illuminate\Database\Connection->run(string, array, object(Closure))Illuminate\Database\MySqlConnection->insert(string, array, string)Illuminate\Database\Query\Processors\MySqlProcessor->processInsertGetId(object(Illuminate\Database\Query\Builder), string, array, string)Illuminate\Database\Query\Builder->insertGetId(array, string)Illuminate\Database\Eloquent\Builder->__call(string, array)Illuminate\Database\Eloquent\Model->insertAndSetId(object(Illuminate\Database\Eloquent\Builder), array)Illuminate\Database\Eloquent\Model->performInsert(object(Illuminate\Database\Eloquent\Builder))Illuminate\Database\Eloquent\Model->save()Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent\{closure}(object(App\Models\Investor))tap(object(App\Models\Investor), object(Closure))Illuminate\Database\Eloquent\Builder->create(array)Illuminate\Database\Eloquent\Model->forwardCallTo(object(Illuminate\Database\Eloquent\Builder), string, array)Illuminate\Database\Eloquent\Model->__call(string, array)Illuminate\Database\Eloquent\Model::__callStatic(string, array)74$a->refresh();75$a->is_duplicate === false76 ? ok('alice group A pre-collision: false')77 : bad('alice prematurely flagged');7879$b = Investor::create([80 'monday_item_id' => $baseMid + 3,81 'group_id' => $investorGroupB->id,82 'name' => 'Alice (group B)',83 'email' => 'alice@example.com', // ← collision on email84 'phone_number' => '+966 500000003',85 'source' => Investor::SOURCE_MONDAY,86 'is_active' => true,87 'last_synced_at' => now(),88]);89$flagger->flag($b);90$a->refresh(); $b->refresh();91select * from `groups` where `type` = 'investor' and `name` = 'new' and `groups`.`deleted_at` is null limit 1select * from `groups` where `type` = 'investor' and `name` != 'new' and `groups`.`deleted_at` is null limit 1select * from `groups` where `type` = 'startup' and `name` = 'new' and `groups`.`deleted_at` is null limit 1select * from `groups` where `type` = 'startup' and `name` != 'new' and `groups`.`deleted_at` is null limit 1delete from `investors` where `monday_item_id` >= 8100000000delete from `startups` where `monday_item_id` >= 8100000000insert into `investors` (`monday_item_id`, `group_id`, `email`, `phone_number`, `source`, `is_active`, `last_synced_at`, `updated_at`, `created_at`) values (8100000001, 10, 'alone@example.com', '+966 500000001', 'monday', 1, '2026-09-29 20:04:22', '2026-09-29 20:04:22', '2026-09-29 20:04:22')select * from `investors` where `id` = 732 limit 1select * from `investors` where `deleted_at` is null and `id` != 732 and (`email` = 'alone@example.com' or `phone_number` LIKE '%966500000001') and `investors`.`deleted_at` is nullselect * from `investors` where `id` = 732 limit 1insert into `investors` (`monday_item_id`, `group_id`, `email`, `phone_number`, `source`, `is_active`, `last_synced_at`, `updated_at`, `created_at`) values (8100000002, 10, 'alice@example.com', '+966 500000002', 'monday', 1, '2026-09-29 20:04:22', '2026-09-29 20:04:22', '2026-09-29 20:04:22')select * from `investors` where `id` = 733 limit 1select * from `investors` where `deleted_at` is null and `id` != 733 and (`email` = 'alice@example.com' or `phone_number` LIKE '%966500000002') and `investors`.`deleted_at` is nullselect * from `investors` where `id` = 733 limit 1