Nobody has started this yet — be first.
Business impact
Settings.job_max_duration_seconds exists so an operator can cap how long a single simulated job is allowed to run, independent of the schema's own hard 600-second ceiling -- e.g. lowering it during a capacity-constrained window, or because a real transcoder backing this API in production has its own SLA-driven duration limit. Right now that setting does nothing useful: the check compares the wrong field, so any operator who lowers it for capacity reasons and trusts it to actually protect their instance is unprotected -- clients can still submit jobs right up to the schema's 600-second hard ceiling regardless of what this setting says.
Problem
The check compares req.steps (an integer, hard-capped at 50 by the schema) against settings.job_max_duration_seconds (a duration, typically in the hundreds). The error message still correctly says duration_seconds -- it's the check itself that's wrong, not the message.
Current behavior
create_job() checks if req.steps > settings.job_max_duration_seconds, comparing the step count against a duration cap, instead of req.duration_seconds > settings.job_max_duration_seconds.
Expected behavior
A request whose duration_seconds exceeds settings.job_max_duration_seconds must be rejected with 422. A request within that cap must be accepted.
Steps to reproduce
pytest practice_tickets/tests/test_ticket_04_duration_cap_checks_wrong_field.py -vSettings(job_max_duration_seconds=30.0), then with .Why this matters
This reads like a copy-paste/refactor slip -- two request fields (duration_seconds, steps) and two settings fields (job_max_duration_seconds, job_max_steps) exist side by side, and the wrong pairing got wired up. Nothing type-checks this: both sides of the comparison are numeric, so it's perfectly valid Python that just compares two unrelated quantities. The error message string (still correctly naming duration_seconds) is actually a useful clue -- it tells you what the check was supposed to compare.
Suggested approach
Look at the four related names involved: req.duration_seconds, req.steps, settings.job_max_duration_seconds, settings.job_max_steps. The check currently pairs one request field with the other field's cap.
Acceptance criteria
Verification
pytest practice_tickets/tests/test_ticket_04_duration_cap_checks_wrong_field.py -v
Hints (0/2)
Try it without hints first — the reading is the exercise.
Working on this ticket
Work on a branch named for the ticket — that's what you'll submit.
Branch off your fork
Sign in to create it automatically, or do it yourself:
$git checkout -b fix/duration-cap-checks-wrong-fieldFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin fix/duration-cap-checks-wrong-fieldSubmit it below
Paste your fork URL and the branch name, with a short write-up of the root cause.
Questions
Ask about anything unclear in the ticket — the maintainer and anyone who has solved it can answer. Please don't post full solutions.
Sign in to ask a question or reply.
Sign inPOST /jobs{"duration_seconds": 100.0, "steps": 5}202 accepted, even though duration_seconds (100) is well past the configured cap (30) -- create_job() compares req.steps (5) against the duration cap instead.http://localhost:8000localhost:6379curl localhost:8000/healthz{"status": "ok", "redis": true}Work the tickets in practice_tickets/tickets/ (ordered easy → hard); each names one dedicated pytest file in practice_tickets/tests/:
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements-dev.txt
pytest practice_tickets/tests/test_ticket_01_completed_jobs_counted_as_failed.py -v # a single ticket
./practice_tickets/run_tickets.sh # all 15, clean pass/fail summary
Each ticket test runs in its own pytest process with a 60s timeout, so one hung/crashed ticket can't take down the whole run or hide another ticket's result. Run pytest tests/ (the project's own suite, against fakeredis, hermetic and fast) after each fix to check for regressions -- the README documents exactly which fixes are expected to change that suite's results.
Level 1
Fix a bug
Read existing behaviour, correct it.