fix(tradein): time-budget estimate enrichment + observable errors to stop opaque 502 (#654) #673

Merged
bot-reviewer merged 3 commits from fix/tradein-654-502-timeout into main 2026-05-29 17:22:03 +00:00

3 commits

Author SHA1 Message Date
lekss361
6046d55419 chore(tradein): drop shared Caddyfile timeout from #654 — defer to devops
Review-bot flagged Caddyfile.tradein-fragment as shared gendsgn.ru gateway
infra needing devops review. The app-level asyncio.wait_for budgets already
bound the slow enrichment chain, so the 502 fix stands without the gateway
timeout. Caddy read/write timeout to be applied separately under devops review.
2026-05-29 20:07:04 +03:00
lekss361
55e1dd1303 Merge remote-tracking branch 'forgejo/main' into fix/tradein-654-502-timeout
# Conflicts:
#	tradein-mvp/backend/app/api/v1/trade_in.py
#	tradein-mvp/backend/app/core/config.py
2026-05-29 19:10:58 +03:00
lekss361
2a3281d2d1 fix(tradein): time-budget estimate enrichment + observable errors to stop opaque 502 (#654)
POST /estimate returned an opaque 502 (gateway timeout), not a null-floor
crash: the ungated Yandex valuation (30s httpx) + geocode/Overpass chain run
serially on every estimate. Wraps slow enrichments in asyncio.wait_for budgets
(config) so a slow upstream degrades to None instead of exceeding the gateway
read timeout. Handler try/except -> logger.exception + 503 so future real
errors are visible (GlitchTip) not masked. Explicit Caddy read/write timeout.
Tests: null-floor skips IMV/Cian (no 5xx); Yandex timeout degrades. 65 regr pass.
NOTE: Caddyfile.tradein-fragment is shared infra — devops review required.

Closes #654
2026-05-29 18:58:40 +03:00