fix(kitchen-ops-bff): report kitchen transition success

This commit is contained in:
José René White Enciso 2026-03-31 20:21:41 -06:00
parent 6d4251b3b3
commit deea1f260d
3 changed files with 9 additions and 6 deletions

View File

@ -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. - 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. - 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`. - 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. - Correlation IDs are preserved through Thalos session checks and kitchen-service calls.

View File

@ -89,13 +89,15 @@ public sealed class KitchenWorkflowServiceClient(HttpClient httpClient) : IKitch
throw new InvalidOperationException("Kitchen service returned an empty transition payload."); 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( return new TransitionKitchenWorkItemResponse(
payload.OrderId, payload.OrderId,
payload.TicketId, payload.TicketId,
MapEdgeState(payload.PreviousState), MapEdgeState(payload.PreviousState),
MapEdgeState(payload.CurrentState), MapEdgeState(payload.CurrentState),
payload.Transitioned, payload.Applied,
payload.Error); payload.RejectionReason);
} }
public async Task<SetKitchenOrderPriorityResponse> SetOrderPriorityAsync(SetKitchenOrderPriorityRequest request, CancellationToken cancellationToken) public async Task<SetKitchenOrderPriorityResponse> SetOrderPriorityAsync(SetKitchenOrderPriorityRequest request, CancellationToken cancellationToken)
@ -186,8 +188,8 @@ public sealed class KitchenWorkflowServiceClient(HttpClient httpClient) : IKitch
string TicketId, string TicketId,
string PreviousState, string PreviousState,
string CurrentState, string CurrentState,
bool Transitioned, bool Applied,
string? Error); string? RejectionReason);
private sealed record UpdateKitchenPriorityPayload( private sealed record UpdateKitchenPriorityPayload(
string ContextId, string ContextId,

View File

@ -69,8 +69,8 @@ public sealed class KitchenWorkflowServiceClientTests
"ticketId": "KT-1001", "ticketId": "KT-1001",
"previousState": "Queued", "previousState": "Queued",
"currentState": "Preparing", "currentState": "Preparing",
"transitioned": true, "applied": true,
"error": null "rejectionReason": null
} }
""")); """));