Repository navigation
fix(api): validate traffic response containers - #125
Conversation
HafidIdrissi
left a comment
There was a problem hiding this comment.
Reviewed the complete API/container change and regression tests against #25. The helper converts malformed successful JSON to endpoint-specific TrafficError without the original decoder context, requires object roots plus explicit list metrics for views/clones, and list roots for referrers/paths. Explicit empty lists and extra valid response fields remain accepted. Unsupported aggregation values are still rejected before requests; request headers, timeout/retry behavior and individual row handling are unchanged. Tests exercise the actual mocked HTTP-success decoding path, response closure and absence of sentinel body/token values in errors and formatted traceback. Individual daily-row validation and doctor behavior remain outside this PR as agreed.
Independent Windows/Python 3.11.9 verification on this exact head: python -m pytest tests/test_api.py -q passes 61 tests; python -m pytest -q passes 126 tests. All data/network responses are synthetic. Inspected current-head CI run 38871704188: 126 tests pass in each Windows/Ubuntu Python 3.9/3.12 job. No new runtime dependency or blocking correctness/security finding. No unresolved review thread. Approved.
Closes #25
Summary
Validation
python -m pytest tests/test_api.py— 61 passed.python -m pytestwith a fresh checkout-local pytest temp directory — 126 passed, no skips.git diff --check— passed.AI disclosure: OpenAI Codex assisted with implementation and validation. The contributor reviewed and approved the change.