fix(site_finder): SAVEPOINT-isolate gate-lookup db.execute swallows (#2464 Wave 2) #2468
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#2468
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "worktree-agent-ad881375834cdfd40"
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?
Что
Волна 2 эпика #2464, часть 2/3 — gate-lookups + разное (10 swallow-сайтов в 8 файлах). Найдено completeness-sweep'ом.
Баг-класс
Каждый сайт на общей analyze/report-сессии ловил сбой
db.executeи возвращал фолбэк без rollback → транзакцияaborted→ следующийdb.executeв запросе падает. Фикс — SAVEPOINTwith db.begin_nested():на swallow-сайте.krt_lookup.pyparcel_krt_requisites(×2: exact + fallback query)begin_nestedokn_lookup.pyparcel_okn_objectsbegin_nestedppt_tep_lookup.pyparcel_ppt_tepbegin_nestedriasurt_lookup.pyparcel_riasurt_gatebegin_nestedpremises_lookup.pyresolve_cad_for_domrfbegin_nestedird_analyze.py_krt_atbegin_nested(row-shaping вынесен заwith)product_scoring.py_poi_weight_sum(×2: centroid +compute_poi_weighted_top7)begin_nestedlocations.pycompute_location_indicespass-1 infra/POIdb.rollback()— ownedlocations.py— плоскийrollback(), не savepoint: единственная цепочкаcompute_location_indices←refresh_locations←workers/tasks/location_refresh.py, который открывает свойSessionLocal()(owned, недельный Celery-refresh, не shared). Pass-1 read-only (нечего терять); pass-2 UPSERT-цикл уже правильно используетbegin_nested(там bare rollback затёр бы уже-upsert'нутые районы). Reviewer независимо подтвердил цепочку grep'ом.product_scoring._poi_weight_sum— два swallow-сайта в одной функции (centroid-lookup + вызовcompute_poi_weighted_top7, чей calleepoi_score.pyделает незащищённыйdb.executeи пропагирует). Оба обёрнуты. Единственный другой callercompute_poi_weighted_top7(parcels.py:4609) — POST-роут, пропагирует в 500, не swallow.Фолбэки и типы
exceptбайт-в-байт неизменны.Тесты
Регресс-тест на каждый сайт: сбой
db.execute→ фолбэк сохранён →begin_nested(или для locations —rollback, иbegin_nestedНЕ вызван) → следующийdb.executeна той же сессии успешен. Фейки с реальнымbegin_nested-CM (не наивный мок).tests/services/site_finder+forecasting= 1718+ passed, ruff чисто.Ревью
code-reviewer: ⚠️ MINOR (оба минора закрыты в этом PR) → по сути ✅. Проверены shape SAVEPOINT, независимая верификация
locations.pyowned-цепочки,_krt_atrow-shaping-move, второй poi-сайт (был живой gap в целевой функции), отсутствие:x::type, отсутствие tradein.Refs #2464 (cluster A, Wave 2 · 2/3).