STATE / PRACTICE
Same support ticket.
Different rules at each stage.
Transfer the order lifecycle idea to a support desk. Keep command handling with the current state, and make transitions affect the next command.
YOUR MISSION / SUPPORT DESK
Assign before resolving.
Resolve only once.
Open accepts assign. Assigned accepts resolve and becomes Closed. Other commands must leave the ticket unchanged. Build the rules, test their limits, then add reopening.
Order → Ticket · OrderState → TicketState. The context keeps the data; its current state decides what is allowed. No external support service is called.
01 / BUILD THE LIFECYCLE
Make three design choices.
Decide who handles a command, how the ticket moves on, and what Closed permits.
Try your own design first. Hints and retries are unlimited.
02 / PREDICT · SEND · OBSERVE
Same command. Different stage.
A new ticket must be assigned before it can be resolved.
SAME TICKET / #204
Support deskInstalled state · retained by Ticket
- OpenCurrent state
- AssignedNot current
- ClosedNot current
- 1 resolve
- 2 assign
- 3 resolve
Choose your pieces, then start a trace. Your choices drive the result.
Verify all three tests with the same design. Changing a piece clears the evidence; replaying a step never sends a command twice.
See the code behind your design TypeScript
03 / THE FINAL CHALLENGE
Extend the lifecycle: reopen a ticket
A customer reports the issue is back. Closed must accept reopen and return Open. A new resolution still requires assignment first.
Choose the three required edits, then press Apply edits & trace. Follow the six-command trace to complete the practice.
Verify all three base scenarios with one assembly to unlock this extension.
0 of 3 edits selected
Compare with a complete solution
Hints and retries are unlimited. Revealing the answer does not mark scenarios verified.