All problems

Retrying a Label Dispatch Sends the Same Labels Twice

Level 2 · node · Reliability · Missing replay protection for completed dispatch batches

Scenario

A fictional warehouse label relay sends groups of labels to a printing device. When a response is delayed, the operator dashboard may retry the same batch. The current service sends labels again even when the batch was already completed, producing duplicate labels. Trace the repository, dispatch service, and controller to correct the state transition.

Requirements

Send each ready batch once and mark it as sent. Retrying a sent batch must return an already-sent result without contacting the printing device again. Preserve isolation of other batches, errors for unknown or invalid states, and the original label list. Do not add external packages.

Acceptance criteria

  • A ready batch is transmitted exactly once.
  • Repeating a sent batch does not transmit its labels again.
  • Repeated requests return an already-sent result.
  • Other batches retain their state and are not transmitted.
  • An unknown batch raises an error.
  • A batch that is not ready cannot be sent.
  • The stored original label list remains unchanged.