From 9e66a974b436be69f1d64ae0e89245f87177bdb4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 13:29:14 +0000 Subject: [PATCH 1/3] Initial plan From 622ed2d048e7dad17fe7f1cc121eb60c1e895f80 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 13:36:40 +0000 Subject: [PATCH 2/3] Fix: Persist missing object removal on early return in CreateDatAsync Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com> --- ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs index 8174ef7c..c82985b2 100644 --- a/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs @@ -252,6 +252,8 @@ static async Task CreateDatAsync(DtoObjectPost request, [FromServices] if (db.DoesObjectExist(hdrs.S5.Name, hdrs.S5.Checksum, out var existingObject)) { // todo: if we get here - the object doesn't exist but the dat object does - we should then link them + // save changes first to persist any missing object removal + _ = await db.SaveChangesAsync(); return Results.Accepted($"Object already exists in the database. DatName={hdrs.S5.Name} DatChecksum={hdrs.S5.Checksum} UploadedDate={existingObject!.UploadedDate}"); } From 8120f7bd9424fd7927f8f0f8b3ff029c32c638f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 13:41:18 +0000 Subject: [PATCH 3/3] Optimize: Only call SaveChangesAsync when a missing entry was actually removed Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com> --- .../RouteHandlers/TableHandlers/ObjectRouteHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs index c82985b2..19144a69 100644 --- a/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs @@ -253,7 +253,11 @@ static async Task CreateDatAsync(DtoObjectPost request, [FromServices] { // todo: if we get here - the object doesn't exist but the dat object does - we should then link them // save changes first to persist any missing object removal - _ = await db.SaveChangesAsync(); + if (missingEntry != null) + { + _ = await db.SaveChangesAsync(); + } + return Results.Accepted($"Object already exists in the database. DatName={hdrs.S5.Name} DatChecksum={hdrs.S5.Checksum} UploadedDate={existingObject!.UploadedDate}"); }