Support Desk Mini
This is Vedya’s runnable practice system. It is intentionally small, but it has real engineering surfaces:
- HTTP API.
- SQLite database.
- Validation.
- Idempotency.
- Audit log.
- Draft generation simulation.
- Human approval gate.
- Tests.
- Intentional bug modes for debugging drills.
No third-party packages are required.
cd starter-projects/support-desk-minipython3 app.pyThe API runs on http://localhost:8080 by default.
Use a different port:
PORT=8090 python3 app.pyUse a different database file:
SUPPORT_DESK_DB=/tmp/support-desk.sqlite3 python3 app.pyRun Tests
Section titled “Run Tests”python3 -m unittest -vAPI Examples
Section titled “API Examples”Health:
curl -i http://localhost:8080/healthCreate a ticket:
curl -i -X POST http://localhost:8080/tickets \ -H 'Content-Type: application/json' \ -H 'X-User-Id: user-1' \ -H 'Idempotency-Key: demo-1' \ -d '{"title":"Login broken","description":"Cannot access account"}'List tickets:
curl -i http://localhost:8080/ticketsAdd a comment:
curl -i -X POST http://localhost:8080/tickets/1/comments \ -H 'Content-Type: application/json' \ -H 'X-User-Id: agent-1' \ -d '{"body":"Asked user for screenshot"}'Create a draft response:
curl -i -X POST http://localhost:8080/tickets/1/draft \ -H 'Content-Type: application/json' \ -H 'X-User-Id: agent-1' \ -d '{}'Approve a draft:
curl -i -X POST http://localhost:8080/drafts/1/approve \ -H 'Content-Type: application/json' \ -H 'X-User-Id: agent-1' \ -H 'X-User-Role: agent' \ -d '{}'Intentional Bug Modes
Section titled “Intentional Bug Modes”Use these only for labs.
VEDYA_BUG_MODE=accept_empty_title python3 app.pyVEDYA_BUG_MODE=approval_bypass python3 app.pyVEDYA_BUG_MODE=duplicate_idempotency python3 app.pyBug modes:
accept_empty_title: server accepts empty ticket titles.approval_bypass: non-agents can approve drafts.duplicate_idempotency: repeated create requests with the same idempotency key create duplicate tickets.
Learning Tasks
Section titled “Learning Tasks”- Trace
POST /ticketsfrom HTTP handler to database row. - Add a new ticket status.
- Add a test for an invalid status transition.
- Add a new endpoint that returns audit events.
- Enable one bug mode, reproduce the failure, write a postmortem, then fix or disable the bug mode.