This API processes purchase-order confirmations. Some requests fail. Investigate and fix the problem.
Option A – Browser (recommended, no installation): Open https://codespaces.new/jakob-fankhauser/python-incident-exercise, click Create codespace and wait until the setup has finished.
Option B – Local (Python 3.10+):
git clone https://github.com/jakob-fankhauser/python-incident-exercise.git
cd python-incident-exerciseWithout Git: use Code → Download ZIP and unzip it.
Windows (PowerShell):
py -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txtmacOS/Linux:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txtOn Ubuntu/WSL you may first need: sudo apt install python3-venv
Check: python -m pytest -v must show 2 passed.
Run the existing tests:
python -m pytest -vThen inspect incident.log and app.py.
- Accept delivery dates in
YYYY-MM-DDandDD.MM.YYYY. - Return successful dates as
YYYY-MM-DD. - Return HTTP 422 for invalid dates without changing the order.
- Keep HTTP 404 for unknown purchase orders.
Example request body:
{
"po_number": "4500012345",
"delivery_date": "15.11.2026"
}Other example dates: 2026-11-15 and 31.02.2026.
- Reproduce and explain the failure.
- Implement a small fix.
- Add tests for a German date and an invalid date.
Please think aloud. No major refactoring is needed.
Timebox: 15–20 minutes. If time permits, explain how you would safely release the fix.