fix(tradein): time-budget estimate enrichment + observable errors to stop opaque 502 (#654) #673
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#673
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/tradein-654-502-timeout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
POST /estimate returned an opaque 502 — confirmed a GATEWAY timeout, not a null-floor crash (GlitchTip has zero estimate exceptions; code is null-safe). The ungated Yandex valuation (30s httpx) + geocode/Overpass chain run serially on every estimate; on a cache-miss the Yandex leg alone can exceed Caddy's read timeout.
Session-integrity verdict: the two db.rollback() enrichment sites run strictly before the main INSERT → safe, no savepoint change needed.
NOTE: Caddyfile.tradein-fragment is SHARED infra — devops should confirm Caddy v2 directive names before deploy (flagged in-comment).
Milestone 6 (Praktika demo). Closes #654
Verdict: FIX (changes needed before merge). Code logic is sound -- good observability fix (explicit 503 +
logger.exceptioninstead of opaque gateway 502;_with_budgetgraceful-None degradation; async/cancellation safe on py3.12). Blocked on two mechanical items:1. Rebase onto current main -- PR is not mergeable (conflicts with the merged #670 and #671):
trade_in.py: #670 addedcreated_by=x_authenticated_userto theestimate_qualitycall. Keep that AND wrap it in your #654 try/except -- the try body must callestimate_quality(payload, db, created_by=x_authenticated_user).config.py: keep BOTH the #671 quota block (estimate_quota_limit) and your #654 timeout block -- adjacent additions toSettings.estimator.py: reconcile #670'screated_bysignature/INSERT changes with your_with_budget+import asyncio/from app.core.config import settings.2.
Caddyfile.tradein-fragmentedits the SHARED gendsgn.ru gateway (you flagged it SHARED-INFRA). Needs devops review before deploy -- confirm theread_timeout 45s/write_timeout 45sapplies ONLY to thehandle_path /trade-in/api/*reverse_proxy block and cannot leak into the parent site config.Re-request review after rebase; I will re-review at the new head SHA.
Addressed review (head
6046d55):Re-requesting review at
6046d55.Re-review after fix. Both prior FIX items resolved: (1) rebased onto current main, 0 conflicts -- estimate_quality call now inside the #654 try/except WITH #670 created_by preserved (9 occurrences intact); config.py carries both #671 quota + #654 timeout blocks. (2) Caddyfile.tradein-fragment shared-infra change removed (devops gate addressed; in-app time-budgets + 503 observability remain, which is the substantive fix). Code logic vetted previously: graceful-None degradation, async/cancellation safe on py3.12, logger.exception to Sentry. APPROVE.