gendesign/backend/app/services
Light1YT 7533bc333b
All checks were successful
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Successful in 1m55s
CI / changes (pull_request) Successful in 7s
CI / backend-tests (pull_request) Successful in 12m10s
fix(site_finder): correct best-layouts supply fan-out + objects-first perf
domrf_kn_objects is a snapshot dimension (UNIQUE (obj_id, snapshot_date), ~8
snapshots/obj_id). _SUPPLY_BATCH_SQL joined flats to ALL object-snapshot rows
(no o.snapshot_date filter), counting each flat ~8.5x → supply_units_in_radius
inflated ~8.5x, sold_pct_of_supply deflated ~8.5x, is_oversold under-fired
(all user-facing, best_layouts.py:571-611; sold_pct=deals/supply is a raw
ratio so no canceling).

Fix: dedup objects to one row per obj_id (latest-snapshot coords) via
DISTINCT ON in an objects-first MATERIALIZED CTE, then join domrf_kn_flats via
idx_kn_flats_obj. units now = one count per flat (prod cross-check at radius
1.5km: units == count(*) == count(DISTINCT f.id) == 9612 for 65 objects;
correction factor 8.56x at 1.5km, 9.13x at 1.0km). This also aligns the supply
denominator with the deals numerator (_COMPETITORS_IN_RADIUS_SQL already uses
DISTINCT ON latest snapshot).

Perf bonus: objects-first avoids the parallel seq scan of the ~376k-row flats
snapshot. radius 1.5km / snapshot 2026-05-17: 240ms/~28k buffers/6712 disk
reads -> 49ms/1554 buffers/0 disk reads (~5x).

Tests: add SQL-text fan-out guard (DISTINCT ON + MATERIALIZED, no bare
flats->objects join); update stale EXPLAIN mirror in test_phantom_columns.

USER-FACING: best-layouts supply/sold_pct/is_oversold/sell-out-months shift
~8.5x toward correct (frontend BestLayoutsBlock only; ТЗ recommendation + PDF
unchanged — they derive from sum_deals, not supply). Deep-reviewed (APPROVE).
2026-06-27 10:45:19 +05:00
..
analysis_runs fix(week-review): backend-аудит v2 — 82 фиксов (#1660) 2026-06-17 17:13:38 +00:00
analytics fix(week-review): backend-аудит v2 — 82 фиксов (#1660) 2026-06-17 17:13:38 +00:00
cadastre fix(cadastre): cad_territorial_zones MULTIPOLYGON typmod + ST_Multi coercion (#1344) 2026-06-17 20:23:56 +03:00
chat fix(admin-scrape): ge=1 on count param + enforce LLM finish_reason (#review-followup) 2026-06-17 21:23:13 +03:00
etl feat(etl): housing-class normalization fallback via yandex_realty trigram match (#38) (#1911) 2026-06-26 07:44:25 +00:00
exporters fix(forecasting): honest scenarios collapse when β rate-sensitivity gate fails (audit #1871 P1) 2026-06-22 19:06:22 +05:00
forecasting fix(forecasting): honest scenarios collapse when β rate-sensitivity gate fails (audit #1871 P1) 2026-06-22 19:06:22 +05:00
generative feat(financial/dcf): dormant separate-index inflation capability (default OFF) 2026-06-25 12:12:02 +00:00
llm fix(llm): word-boundary INN match, tighten edge cases (#1640 follow-up) 2026-06-17 21:24:59 +03:00
photos merge: resolve conflicts with main (#1660) into week-review-finish 2026-06-17 20:21:06 +03:00
scrapers fix(scrapers): named BrowserSession concurrency const, fix Semaphore(3) doc drift (#1347) (#1913) 2026-06-26 07:44:29 +00:00
site_finder fix(site_finder): correct best-layouts supply fan-out + objects-first perf 2026-06-27 10:45:19 +05:00
__init__.py init 2026-04-25 13:45:19 +03:00
analytics_queries.py feat(etl): housing-class normalization fallback via yandex_realty trigram match (#38) (#1911) 2026-06-26 07:44:25 +00:00
analytics_refresh.py fix(scrape): SQLAlchemy text() парсил ':00:' regex как named-param 2026-04-30 23:16:11 +03:00
forecast_request_cache.py perf(forecast): per-request memoization cache for §22 cold build (#1129) 2026-06-08 05:26:27 +00:00
insights.py feat(insights): manual-entry Insight entity CRUD + §19 audit (#948 part A) 2026-06-08 12:41:39 +05:00
job_settings.py fix(admin-jobs): UPSERT в PUT /admin/jobs/settings — не терять изменения (#1223) 2026-06-13 08:36:23 +00:00
objective_etl.py fix(week-review): backend-аудит v2 — 82 фиксов (#1660) 2026-06-17 17:13:38 +00:00
objective_sync_config.py fix(objective-sync): log seed failure вместо bare except pass (#1226) 2026-06-13 15:03:34 +05:00
own_projects.py feat(site-finder): own-portfolio data source for §25.3 cannibalization (#1169 PR1) 2026-06-08 16:21:53 +05:00
weather_cache.py fix(weather): wind_d returns None when no valid samples, not fabricated 0.0° (#weather-cache) 2026-06-17 21:22:31 +03:00