Generate a batch of promotion codes
What It Does
Staff generate a bounded batch of claim codes. A directly invoked worker resumes from saved progress, records partial failures and supports CSV export.
The Flow
When Something Fails
Reject an insufficient template space or invalid quantity with readable feedback. No batch is retained. Reject automatic or retired campaigns and invalid parent-bounded dates. No new batch is retained. Mark invocation failure on the batch; Lambda retries only executions that actually fail. A failed batch remains available for staff inspection. Retain saved codes and a batch failure explanation when generation stops. A failed batch can contain active codes below the requested quantity. Log a failed restart and return the current batch rather than failing its read. The batch awaits another recovery request or stale read.
Open Design Questions
The implemented recovery and concurrency behaviour above defines the current boundary. Any change to transaction scope or product authority requires a recorded decision.