feat(tradein/estimator): deal_city_price_bands по ключу (region_code, city) — миграция 298, refresh per-region (#3051 sub-PR B) #3431
No reviewers
Labels
No labels
Fable 5 ревью
GG-форсайт
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
feedback/max
generative
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#3431
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/3051-bands-region-key"
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?
Sub-PR B трека «Москва» (#3051). Предпосылка: в
dealsтеперь 212 937 московских ДКП (region 77) рядом со 108 623 строками 66. Refresh bands считалregion_stats(p1 → floor tierregion_fallback) по всем не-ЕКБ сделкам — с Москвой в пуле floor ~250 малых городов области уехал бы вверх и их сделки вырезались бы из коридоров. Расписаниеdeal_city_price_bands_refreshна проде выключено main-сессией до деплоя этого PR (следующий запуск был бы 07:04 UTC 09.09).Что
deal_city_price_bands_region.sql:ADD COLUMN IF NOT EXISTS region_code int NOT NULL DEFAULT 66; смена PK(city)→(region_code, city)через DO-guard поpg_get_constraintdef(идемпотентно при обоих состояниях); страховочныйDELETEстрокиМосквав регионе 66; re-seed той же derivation, что 194, ноGROUP BY region_code[, city],region_statsJOIN по региону вместо CROSS JOIN, исключение ЕКБ только какNOT (region_code=66 AND city='Екатеринбург'),doc_type='ДКП';SET LOCAL lock_timeout.app/tasks/deal_city_price_bands_refresh.py:_REDERIVE_SQL= тот же SQL (сверено построчно), counters +regions.estimator.py:_load_city_price_bands→{(region_code, city): (min, max)};_is_plausible_deal(..., region_code=DEFAULT_REGION_CODE)(позиционные вызовы не тронуты);_fetch_dealsберётregion_codeиз строки (NULL → 66); обаLEFT JOIN deal_city_price_bandsв_fetch_dkp_corridor—ON b.region_code = d.region_code AND b.city = d.city.scripts/backtest_estimator.py: band по региону (дефолт 66, CLI-флага нет — out of scope).Регрессия 66
Набор
(city, ppm2_min, ppm2_max, n_deals, tier)для 66 байт-идентичен прежнему: те же фильтры/пороги 30/10/клампы 8000/800000/700000;doc_type='ДКП'не сужает (backfill 288 — 100% строк); Москва больше не подмешивается в pooled p1. После деплоя: разовый refresh и сверка со snapshotdeal_city_price_bands_bak_0908(383 строки, снят до правок).ruffчисто;pytest76 passed / 2 skipped по затронутым тестам. Ревью: две линзы (регрессия 66; миграция + потребители) — ✅ APPROVE обе. Тесты по новому ключу — отдельным заходом после живого refresh.Refs #3051. Связано: #3422, #3423, #3430.
🤖 Generated with Claude Code