gendesign/backend
Light1YT 1a07af028a
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 1m51s
CI / backend-tests (pull_request) Successful in 11m6s
fix(site-finder): harden flats_sold sold-count SQL — fan-out, premise_kind, predicate (#1926)
Code-review #1927 found 2 MAJOR bugs in the initial fix:

1. JOIN fan-out: objective_complex_mapping UNIQUE is (objective_complex_name,
   objective_group), NOT domrf_obj_id (68_schema:321) — one obj_id can map to
   multiple rows (same name, different group), so COUNT(*) over cm JOIN ol
   double-counts lots (GROUP BY collapses output rows but not dups inside the
   aggregate). Fixed with COUNT(DISTINCT ol.objective_lot_id).

2. Missing premise_kind: MarketMetrics._STOCK_SQL filters premise_kind='квартира';
   the new SQL did not, so sold parking/storage/non-residential lots counted as
   sold flats (over-count). Added AND ol.premise_kind = :premise_kind.

3. Aligned the sold predicate to MarketMetrics exactly:
   is_sold IS TRUE OR contract_date IS NOT NULL OR LOWER(status)='продан'
   (Objective populates these inconsistently — OR mirrors _STOCK_SQL:285-289),
   not contract_date alone.

Tests: added static SQL-structure guards (fan-out-safe COUNT(DISTINCT),
premise_kind filter, full predicate) since mock-based API tests bypass real SQL
and cannot detect fan-out; the live-DB fan-out/EXPLAIN check lives in
test_phantom_columns (skipped without TEST_DATABASE_URL). Updated phantom EXPLAIN
to the new SQL.

Full suite: 3530 passed, 51 skipped, 0 failed. Ruff clean.
2026-06-26 23:21:55 +05:00
..
alembic fix(week-review): дожим ревью — #1569, #1590, #1642 + feat #801 MSW-preview 2026-06-17 11:24:34 +05:00
app fix(site-finder): harden flats_sold sold-count SQL — fan-out, premise_kind, predicate (#1926) 2026-06-26 23:21:55 +05:00
db/init ops: alembic baseline, pre-commit, TIGER cleanup, pg_dump scripts 2026-04-26 13:08:51 +03:00
output feat(geo): NSPD bulk-fetcher без Playwright + resume-friendly UI 2026-05-11 08:53:28 +03:00
scripts feat(scripts): Potrace floor-plan vectorization spike (#299) (#1663) 2026-06-17 17:12:48 +00:00
tests fix(site-finder): harden flats_sold sold-count SQL — fan-out, premise_kind, predicate (#1926) 2026-06-26 23:21:55 +05:00
.dockerignore fix(scraper): диагностируем «кнопка не работает» — Redis lock + task_received log 2026-04-28 23:17:42 +03:00
.env.example refactor(security): убрать X-Admin-Token (Caddy basic_auth достаточен) (#437) 2026-05-23 10:41:22 +00:00
.env.runtime.example sprint1: nspd scraper industrialization, per-bucket elasticity, cadastre cross-check, sentry releases 2026-04-30 21:51:19 +03:00
.gitignore fix(financial): парковка price/cost по классу (econom наземная, business Excel) 2026-06-24 16:58:21 +05:00
alembic.ini ops: alembic baseline, pre-commit, TIGER cleanup, pg_dump scripts 2026-04-26 13:08:51 +03:00
debug.log feat(geo): NSPD bulk-fetcher без Playwright + resume-friendly UI 2026-05-11 08:53:28 +03:00
Dockerfile feat(sf): OCR-пайплайн изъятия ЕКБ (Tesseract rus) → land_reservation (#1062) 2026-06-07 18:07:06 +03:00
pyproject.toml ci(infra): coverage-gate (#68) + OpenAPI codegen-assert (#69) + uptime monitoring (#75) 2026-06-13 23:28:06 +05:00
uv.lock ci(infra): coverage-gate (#68) + OpenAPI codegen-assert (#69) + uptime monitoring (#75) 2026-06-13 23:28:06 +05:00