Skip to content

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.

Terminal window
cd starter-projects/support-desk-mini
python3 app.py

The API runs on http://localhost:8080 by default.

Use a different port:

Terminal window
PORT=8090 python3 app.py

Use a different database file:

Terminal window
SUPPORT_DESK_DB=/tmp/support-desk.sqlite3 python3 app.py
Terminal window
python3 -m unittest -v

Health:

Terminal window
curl -i http://localhost:8080/health

Create a ticket:

Terminal window
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:

Terminal window
curl -i http://localhost:8080/tickets

Add a comment:

Terminal window
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:

Terminal window
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:

Terminal window
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 '{}'

Use these only for labs.

Terminal window
VEDYA_BUG_MODE=accept_empty_title python3 app.py
VEDYA_BUG_MODE=approval_bypass python3 app.py
VEDYA_BUG_MODE=duplicate_idempotency python3 app.py

Bug 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.
  • Trace POST /tickets from 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.