gendesign/backend/tests/services
Light1YT 74f1ffb500
All checks were successful
CI / changes (pull_request) Successful in 6s
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Successful in 1m49s
CI / backend-tests (pull_request) Successful in 13m58s
perf(objective): request-path consumers dedup inline, not via whole-table view (#1964)
deep-review #1964: v_objective_lots_latest has NO premise/district filter inside,
so a consumer's outer WHERE cannot push below DISTINCT ON → the view materializes
the WHOLE table (Parallel Seq Scan + external Sort 1.76M rows, ~55MB spill) on
every query. For REQUEST-PATH consumers inside analyze_parcel this is a ~19x latency
regression vs the pre-#1964 raw-table plan.

DISPROVEN remedy (NOT applied): a full index on the physflat-key does NOT help —
DISTINCT ON selects ol.* (51 cols, width≈945) so index-only-unique is impossible;
the planner ignores the index (seq-scan+sort still cheaper) and even forced it is
~3.9 s. A 142MB index for zero request-path benefit + slower bulk-INSERT during
objective-scrape is wrong. Honors original #1964 decision "no new index".

Prod EXPLAIN (Академический / 3km radius, 2026-06-28):
  consumer            via view      inline (this commit)
  concepts median     5854 ms       1640 ms   (bitmap district + sort)
  parcels district    5854 ms       1640 ms
  parcels geo-median  6443 ms        122 ms   (NestedLoop geo->complex bitmap)
  parcels obj_pricing 5721 ms        441 ms   (project bitmap per nearby ЖК)

FIX: keep v_objective_lots_latest ONLY for batch/background/cached consumers
(supply_layers L1, competitors._SOLD_COUNT_SQL, special_indices [/forecast bg task
30-180s], admin, landing). Revert the 4 request-path consumers inside analyze_parcel
to inline DISTINCT ON (physflat-key, latest snapshot) with the filter pushed INTO the
CTE so the district/spatial/project index applies:
- concepts._OBJECTIVE_MEDIAN_SQL
- parcels.py district price block
- parcels.py geo-radius median (complex_id-scoped)
- parcels.py obj_pricing CTE (project_name-scoped; aggregates over deduped set)

Migration 175 header CORRECTED: accurately states the partial mig-173 index does NOT
serve the view (qual can't push below DISTINCT ON), the full index is disproven/not
added, and which consumers use the view vs inline. No DDL change (still view-only).

Tests: +guards (concepts/obj_pricing dedup inline, not view; obj_pricing physflat
DISTINCT ON; perf-pushdown scope preserved). 965 passed.
2026-06-28 05:00:47 +05:00
..
analysis_runs feat(parcels): typed AnalyzeResponse + run-history read endpoints (#961) 2026-06-06 18:13:34 +00:00
cadastre fix(#265 review): CRS 3857→4326 + stable zone_id hash + rename 102 + tx comment 2026-05-17 10:45:52 +03:00
chat feat(chat): LLM tool-loop + §19 redaction wiring for #957 (Step 2+3) 2026-06-08 17:45:01 +05:00
exporters fix(exporters): annotate scenario deficit horizon in excel too (#1590 follow-up) 2026-06-17 21:23:57 +03:00
forecasting fix(objective): physflat-dedup current-state consumers + honest n_sold window (#1964) 2026-06-28 04:27:43 +05:00
generative perf(objective): request-path consumers dedup inline, not via whole-table view (#1964) 2026-06-28 05:00:47 +05:00
llm fix(llm): word-boundary INN match, tighten edge cases (#1640 follow-up) 2026-06-17 21:24:59 +03:00
scrapers fix(scrapers): narrow domrf Level-1 status badge-class regex (#1609 follow-up) 2026-06-17 21:21:56 +03:00
site_finder fix(objective): physflat-dedup current-state consumers + honest n_sold window (#1964) 2026-06-28 04:27:43 +05:00
__init__.py feat(cadastre): bulk_harvest worker + grid-walker + admin API (#168 PR3/5) (#171) 2026-05-15 13:31:32 +03:00
test_cadastre_bulk.py fix(cadastre): NSPD 500-retry + per-layer skip (#252) + disable dead pzz-beat (#259) + geom backfill (#200) 2026-06-13 20:45:05 +05:00
test_ekburg_permits.py feat(sf): geocode geom для ekburg_construction_permits из МСК-66 (#1124) 2026-06-07 11:16:45 +00:00
test_forecast_request_cache.py perf(forecast): per-request memoization cache for §22 cold build (#1129) 2026-06-08 05:26:27 +00:00
test_functional_zone_lookup.py feat(sf): ingest функц.зон генплана ЕКБ-2045 из ГИСОГД-СО WFS → ekb_genplan_functional_zone (#1137) 2026-06-07 12:03:39 +00:00
test_granddoc_lookup.py feat(sf): граддокументация (статус+ПАГЕ-реквизиты) из planning_projects в analyze (#1154) 2026-06-07 15:15:03 +00:00
test_ird_analyze.py fix(site-finder): optimize zone-regulation resolve in /analyze (#1850) 2026-06-25 09:12:41 +00:00
test_ird_overlay_lookup.py fix(site-finder): расширить except в parcel_ird_overlaps до DataError (#1095) 2026-06-13 15:02:50 +05:00
test_job_settings.py fix(admin-jobs): UPSERT в PUT /admin/jobs/settings — не терять изменения (#1223) 2026-06-13 08:36:23 +00:00
test_krt_lookup.py feat(sf): КРТ-реквизиты (ekb_krt_sites) в ИРД-блок analyze (#1131) 2026-06-07 11:50:29 +00:00
test_newbuilding_crossload.py fix(sf): psql stdin-bootstrap пароля gendesign_reader + COALESCE-protect внешних id (review fixup, #976) 2026-06-12 11:26:40 +03:00
test_nspd_denorm.py fix(week-review): backend-аудит v2 — 82 фиксов (#1660) 2026-06-17 17:13:38 +00:00
test_obj_class_backfill.py feat(etl): housing-class normalization fallback via yandex_realty trigram match (#38) (#1911) 2026-06-26 07:44:25 +00:00
test_objective_backfill.py test(etl): fix stale assert in objective_backfill dry_run test (#1709) 2026-06-17 22:38:44 +03:00
test_own_developer_ids_config.py feat(site-finder): own-portfolio data source for §25.3 cannibalization (#1169 PR1) 2026-06-08 16:21:53 +05:00
test_planning_lookup.py feat(sf): wire ППТ/ПМТ planning_projects в analyze ird-блок (#1105) 2026-06-06 20:50:34 +00:00
test_ppt_tep_lookup.py fix(sf): ekb_ppt_tep post-фильтры + врезка в analyze (#1136) 2026-06-13 09:32:52 +00:00
test_quarter_dump_lookup.py fix(report): площадь/обновлено EGRN, forecast-confidence dedup, ЗОУИТ типизация (#1953) 2026-06-27 14:14:40 +05:00
test_recommend_mix_velocity.py fix(analytics): recommend_mix success-boost regression from view 172 (#1955) 2026-06-27 15:49:40 +05:00
test_reservation_lookup.py feat(sf): ПАГЕ-парсер изъятия/резервирования → land_reservation (#1118) 2026-06-07 10:15:03 +00:00
test_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
test_zone_regulation_backfill.py feat(site-finder): backfill ЕКБ зон-регламента — разблокировать видимость финмодели (#1881) 2026-06-24 02:11:41 +05:00
test_zone_regulation_extract.py feat(sf): zone_regulation_cache — ПЗЗ-регламент по zone_index + числовой экстракт (#1099) 2026-06-06 19:31:28 +00:00
test_zone_regulation_memo.py fix(site-finder): optimize zone-regulation resolve in /analyze (#1850) 2026-06-25 09:12:41 +00:00
test_zone_regulation_write_session.py fix(site-finder): isolate zone-regulation cache write off the request session (#1850 item 4) 2026-06-25 11:16:26 +00:00