Commit graph

3 commits

Author SHA1 Message Date
6a554b559e fix(best-layouts): знаменатель покрытия в комплексах, не в сырых obj_id (#2177)
Some checks failed
CI / changes (pull_request) Successful in 8s
CI / frontend-tests (pull_request) Successful in 1m21s
CI / openapi-codegen-check (pull_request) Failing after 2m6s
CI / backend-tests (pull_request) Successful in 14m35s
domrf_kn_objects дробит один ЖК на несколько obj_id (очереди, дубли
snapshot-строк, безымянные корпуса) — §4.2 показывала «покрытие 17%
(2 из 12 ЖК)» вместо честного счёта комплексов.

- group_radius_objects: именованные группируются по (застройщик, ядро
  имени) — нормализация ёлочек/«N очередь»/generic-префиксов/повторов
  токенов («Квартал Депо» сохраняется); безымянные — single-linkage
  гео-кластеры ≤300 м per застройщик (кластер в 600 м от именованного —
  отдельная честная группа)
- coverage по группам: группа с данными = хоть один её obj_id с velocity;
  прод-кейс 66:41:0204016:10: 12 obj_id → 6 комплексов → 33% вместо 17%
- raw_objects_total в LayoutDataQuality для прозрачности; подпись
  «N из M ЖК» → «N из M комплексов» (бейдж + PDF)

Шаг 1 из 3 issue #2177 (mapping-расширение и lots-fallback — следом).
Follow-up: npm run codegen после деплоя (нужен живой OpenAPI).
2026-07-02 23:59:00 +05:00
c8ab3e8be9 fix(analyze): district KeyError 500 in #994 persist + revive by-bbox tests
All checks were successful
Deploy / changes (push) Successful in 5s
Deploy / build-frontend (push) Has been skipped
Deploy / build-backend (push) Successful in 1m31s
Deploy / build-worker (push) Successful in 2m28s
Deploy / deploy (push) Successful in 1m44s
LIVE BUG (from #994, already merged): the analysis_runs persist call-site in
analyze_parcel extracted district via result_payload["district"]["district_name"]
— but a district dict without that key (real data: partial district lookup)
raised KeyError OUTSIDE the best-effort SAVEPOINT (extraction is at the call
site, not inside persist_analysis_run) → 500 on the LIVE /analyze endpoint.
Fix: .get("district_name") → None instead of raising. Caught by reviving the
analyze test suite (below).

Test-infra (the suite was un-runnable, which is why the bug shipped):
- Lazy-import WeasyPrint in layout_tz_pdf.py + trade_in_pdf.py (matches the
  existing report_pdf.py / snapshot_pdf.py pattern). The eager top-level imports
  made `app.main` (→ parcels/trade_in routers) un-importable on hosts without
  WeasyPrint native libs (e.g. macOS dev), breaking pytest COLLECTION of the
  whole api/v1 suite. WeasyPrint is still imported when a PDF is actually rendered.
- tests/conftest.py: autouse fixture clears app.dependency_overrides after each
  test (anti-leak — a leaked get_db override caused real-DB connection attempts).
- test_parcel_by_bbox.py: rewrite get_db mocking from patch("...get_db") (a no-op
  — FastAPI Depends holds the original ref) to app.dependency_overrides[get_db],
  add explicit X-Authenticated-User header (RBAC gate), patch latest_run_dates,
  + a new test asserting last_analysis_date from a latest run (#994). 5/5 green.

NOTE: reviving collectability exposes PRE-EXISTING rot in other api/v1 suites
(analyze/admin/best_layouts: RBAC-header + stale-assertion/mock drift) — those
are NOT regressions from this PR (they were uncollectable before) and are
tracked separately for a deliberate suite-rehab + CI test-gate effort.

Refs #994.
2026-06-03 18:04:37 +05:00
256909d28b feat(layouts): PDF ТЗ endpoint + BestLayoutsBlock UI (#113 PR D) (#199)
All checks were successful
Deploy / changes (push) Successful in 5s
Deploy / build-backend (push) Successful in 1m38s
Deploy / build-worker (push) Successful in 3m3s
Deploy / build-frontend (push) Successful in 2m8s
Deploy / deploy (push) Successful in 38s
2026-05-16 09:53:05 +00:00