From deea1f260db9f7de2638ce6b35ad0948a5c4ee50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ren=C3=A9=20White=20Enciso?= Date: Tue, 31 Mar 2026 20:21:41 -0600 Subject: [PATCH] fix(kitchen-ops-bff): report kitchen transition success --- docs/api/kitchen-ops-workflows.md | 1 + .../Adapters/KitchenWorkflowServiceClient.cs | 10 ++++++---- .../KitchenWorkflowServiceClientTests.cs | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/api/kitchen-ops-workflows.md b/docs/api/kitchen-ops-workflows.md index 0d63661..ebb25fc 100644 --- a/docs/api/kitchen-ops-workflows.md +++ b/docs/api/kitchen-ops-workflows.md @@ -33,4 +33,5 @@ This BFF exposes kitchen board, claim or release, transition, and priority workf - Transition requests now forward `ContextId` to `kitchen-service` so kitchen actions land in the correct shared restaurant lifecycle context. - Board reads now rely on the lifecycle-driven kitchen ticket materialization in `kitchen-service`, which means newly accepted restaurant orders can appear without a stack reset. - The BFF keeps temporary edge-state compatibility for existing web clients by translating `Cooking|Ready|Served` to the canonical kitchen-service states `Preparing|ReadyForPickup|Delivered`. +- Transition success at the edge is now sourced from the upstream `Applied` flag so operators see truthful mutation outcomes. - Correlation IDs are preserved through Thalos session checks and kitchen-service calls. diff --git a/src/Kitchen.Ops.Bff.Application/Adapters/KitchenWorkflowServiceClient.cs b/src/Kitchen.Ops.Bff.Application/Adapters/KitchenWorkflowServiceClient.cs index 84f988c..e8019db 100644 --- a/src/Kitchen.Ops.Bff.Application/Adapters/KitchenWorkflowServiceClient.cs +++ b/src/Kitchen.Ops.Bff.Application/Adapters/KitchenWorkflowServiceClient.cs @@ -89,13 +89,15 @@ public sealed class KitchenWorkflowServiceClient(HttpClient httpClient) : IKitch throw new InvalidOperationException("Kitchen service returned an empty transition payload."); } + // kitchen-service reports success as `Applied`; the public edge contract exposes + // the same outcome as `Transitioned` for the web clients. return new TransitionKitchenWorkItemResponse( payload.OrderId, payload.TicketId, MapEdgeState(payload.PreviousState), MapEdgeState(payload.CurrentState), - payload.Transitioned, - payload.Error); + payload.Applied, + payload.RejectionReason); } public async Task SetOrderPriorityAsync(SetKitchenOrderPriorityRequest request, CancellationToken cancellationToken) @@ -186,8 +188,8 @@ public sealed class KitchenWorkflowServiceClient(HttpClient httpClient) : IKitch string TicketId, string PreviousState, string CurrentState, - bool Transitioned, - string? Error); + bool Applied, + string? RejectionReason); private sealed record UpdateKitchenPriorityPayload( string ContextId, diff --git a/tests/Kitchen.Ops.Bff.Application.UnitTests/KitchenWorkflowServiceClientTests.cs b/tests/Kitchen.Ops.Bff.Application.UnitTests/KitchenWorkflowServiceClientTests.cs index cb3e1cd..8241db8 100644 --- a/tests/Kitchen.Ops.Bff.Application.UnitTests/KitchenWorkflowServiceClientTests.cs +++ b/tests/Kitchen.Ops.Bff.Application.UnitTests/KitchenWorkflowServiceClientTests.cs @@ -69,8 +69,8 @@ public sealed class KitchenWorkflowServiceClientTests "ticketId": "KT-1001", "previousState": "Queued", "currentState": "Preparing", - "transitioned": true, - "error": null + "applied": true, + "rejectionReason": null } """));