From e704877f244f3ff2346c23719c07db41b78adbb6 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Sat, 10 Oct 2026 20:15:14 +0200 Subject: [PATCH] fix(app): RegisterFaceHandler adds to both person.Faces and DbContext Set for test compatibility - Added person.AddFace(face) to maintain in-memory consistency for domain logic - Also added _db.GetSet().Add(face) to avoid EF Core phantom UPDATE - Both Application.Tests and IntegrationTests pass --- .../Persons/Commands/RegisterFace/RegisterFaceCommand.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Heimdall.Application/Persons/Commands/RegisterFace/RegisterFaceCommand.cs b/src/Heimdall.Application/Persons/Commands/RegisterFace/RegisterFaceCommand.cs index f8cd7fd..0984abb 100644 --- a/src/Heimdall.Application/Persons/Commands/RegisterFace/RegisterFaceCommand.cs +++ b/src/Heimdall.Application/Persons/Commands/RegisterFace/RegisterFaceCommand.cs @@ -32,7 +32,10 @@ public async Task> Handle(RegisterFaceCommand r var face = new KnownFace(request.PersonId, request.Embedding, request.ThumbnailUrl, request.SourceEventId); - // Add directly to DbContext to avoid EF Core change tracking confusion + // Add to person's navigation for in-memory consistency (tests, domain logic) + person.AddFace(face); + + // Also add directly to DbContext to avoid EF Core change tracking confusion // when adding to a collection navigation property _db.GetSet().Add(face);