feat: complete person identity matching system with fuzzy detection, revert, and manual link

Implements the full identity matching engine: email matching (HIGH confidence),
fuzzy name matching with Levenshtein distance (MEDIUM confidence, upgradable to
HIGH with DOB tiebreaker), manual link/unlink, revert confirmed matches, and
automatic detection via PersonObserver. Includes 33 comprehensive tests, frontend
integration with confirm/dismiss/unlink UI, and match indicators in the persons list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 08:44:24 +02:00
parent 7932e53daf
commit eb1a0ac666
30 changed files with 1941 additions and 399 deletions

View File

@@ -28,6 +28,12 @@ final class PersonResource extends JsonResource
'created_at' => $this->created_at->toIso8601String(),
'crowd_type' => new CrowdTypeResource($this->whenLoaded('crowdType')),
'company' => new CompanyResource($this->whenLoaded('company')),
'has_user_account' => (bool) $this->user_id,
'user_account' => $this->when($this->user_id && $this->relationLoaded('user') && $this->user, fn () => [
'id' => $this->user->id,
'email' => $this->user->email,
'full_name' => $this->user->full_name,
]),
'pending_identity_match' => $this->when(
$this->relationLoaded('pendingIdentityMatch') && $this->pendingIdentityMatch,
function () {
@@ -41,9 +47,13 @@ final class PersonResource extends JsonResource
'last_name' => $match->matchedUser->last_name,
'full_name' => $match->matchedUser->full_name,
'email' => $match->matchedUser->email,
'date_of_birth' => $match->matchedUser->date_of_birth?->toDateString(),
],
'matched_on' => $match->matched_on->value,
'matched_on_label' => $match->matched_on->label(),
'confidence' => $match->confidence->value,
'confidence_label' => $match->confidence->label(),
'match_details' => $match->match_details,
];
}
),