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:
@@ -24,8 +24,9 @@ final class PersonIdentityMatchFactory extends Factory
|
||||
'person_id' => Person::factory(),
|
||||
'matched_user_id' => User::factory(),
|
||||
'matched_on' => IdentityMatchMethod::EMAIL,
|
||||
'confidence' => IdentityMatchConfidence::EXACT,
|
||||
'confidence' => IdentityMatchConfidence::HIGH,
|
||||
'status' => IdentityMatchStatus::PENDING,
|
||||
'match_details' => null,
|
||||
'resolved_by_user_id' => null,
|
||||
'resolved_at' => null,
|
||||
];
|
||||
@@ -35,6 +36,8 @@ final class PersonIdentityMatchFactory extends Factory
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'status' => IdentityMatchStatus::CONFIRMED,
|
||||
'confirmed_by_user_id' => User::factory(),
|
||||
'confirmed_at' => now(),
|
||||
'resolved_by_user_id' => User::factory(),
|
||||
'resolved_at' => now(),
|
||||
]);
|
||||
@@ -44,6 +47,29 @@ final class PersonIdentityMatchFactory extends Factory
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'status' => IdentityMatchStatus::DISMISSED,
|
||||
'dismissed_by_user_id' => User::factory(),
|
||||
'dismissed_at' => now(),
|
||||
'resolved_by_user_id' => User::factory(),
|
||||
'resolved_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function fuzzyName(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'matched_on' => IdentityMatchMethod::NAME_FUZZY,
|
||||
'confidence' => IdentityMatchConfidence::MEDIUM,
|
||||
]);
|
||||
}
|
||||
|
||||
public function manual(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'matched_on' => IdentityMatchMethod::MANUAL,
|
||||
'confidence' => IdentityMatchConfidence::HIGH,
|
||||
'status' => IdentityMatchStatus::CONFIRMED,
|
||||
'confirmed_by_user_id' => User::factory(),
|
||||
'confirmed_at' => now(),
|
||||
'resolved_by_user_id' => User::factory(),
|
||||
'resolved_at' => now(),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user