From 1daac954a322ad55525698cfd3f1dfe1aaf10058 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 1 Oct 2026 14:58:51 +0000 Subject: [PATCH] fix(uplifts): return stored evidence after a concurrent create Map the saved request from the evidence-file lookup, and teach the shared-dispatch conflict test to return that lookup so a winning insert still produces a response. Co-authored-by: Arthur Bassi --- .../WorkOrderUpliftServiceConflictTests.cs | 4 ++++ SeaHaven.Services/Implementation/WorkOrderUpliftService.cs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Api.SeaHavenIndustries.Tests/WorkOrderUpliftServiceConflictTests.cs b/Api.SeaHavenIndustries.Tests/WorkOrderUpliftServiceConflictTests.cs index 9325b3d..d9a503c 100644 --- a/Api.SeaHavenIndustries.Tests/WorkOrderUpliftServiceConflictTests.cs +++ b/Api.SeaHavenIndustries.Tests/WorkOrderUpliftServiceConflictTests.cs @@ -56,6 +56,10 @@ public sealed class WorkOrderUpliftServiceConflictTests .ReturnsAsync(0m); upliftData.Setup(x => x.StageAsync(It.IsAny(), It.IsAny())) .Returns(Task.CompletedTask); + upliftData.Setup(x => x.GetEvidenceFilesAsync( + It.IsAny>(), + It.IsAny())) + .ReturnsAsync(new Dictionary>()); upliftData.Setup(x => x.SaveChangesAsync(It.IsAny())) .Returns(async () => { diff --git a/SeaHaven.Services/Implementation/WorkOrderUpliftService.cs b/SeaHaven.Services/Implementation/WorkOrderUpliftService.cs index 9421182..0e3af52 100644 --- a/SeaHaven.Services/Implementation/WorkOrderUpliftService.cs +++ b/SeaHaven.Services/Implementation/WorkOrderUpliftService.cs @@ -469,7 +469,8 @@ namespace SeaHaven.Services.Implementation Dispatch dispatch, CancellationToken cancellationToken) { - var files = await _upliftData.GetEvidenceFilesAsync(new[] { request.Id }, cancellationToken); + var files = await _upliftData.GetEvidenceFilesAsync(new[] { request.Id }, cancellationToken) + ?? new Dictionary>(); if (!files.TryGetValue(request.Id, out var attachments)) attachments = Array.Empty();