gendesign/backend
lekss361 54cff64109 fix(bug-22a): fill ON CONFLICT gaps for flat_number/living_area/wall_type/energy_eff in kn scraper
Audit of kn-API payload for issue #297 sub-task 22a:

Object-level (/kn/object list endpoint):
- wallType, energyEff, objClass: absent from API payload (0/1516 objects).
  obj_class already fixed in SF#15 via aiDescription regex.
  wall_type/energy_eff: no data source exists.

Flat-level (/portal-kn/api/sales/portal/table):
- number → flat_number: mapped correctly in _norm_flat().
- livingArea → living_area: mapped correctly in _norm_flat().
- Root cause for 0% DB coverage: UPSERT_FLAT_SQL ON CONFLICT did not include
  flat_number, living_area, is_studio, total_area, rooms, floor, num_floors —
  existing rows (hash-id, inserted before direct flatId became available)
  were never updated on subsequent scrapes.

Fix:
- UPSERT_FLAT_SQL ON CONFLICT: add COALESCE updates for all 7 flat fields.
- UPSERT_OBJECT_SQL ON CONFLICT: add COALESCE for wall_type + energy_eff
  (obj_class was already updating, now also COALESCE to preserve existing value).
- Add migration 108 (idempotent DDL guard + coverage NOTICE).

Coverage will improve on next scrape; no backfill possible (flat raw not stored).

Closes #297 sub-task 22a.
2026-05-17 17:54:18 +03:00
..
alembic ops: alembic baseline, pre-commit, TIGER cleanup, pg_dump scripts 2026-04-26 13:08:51 +03:00
app fix(bug-22a): fill ON CONFLICT gaps for flat_number/living_area/wall_type/energy_eff in kn scraper 2026-05-17 17:54:18 +03: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
tests fix(sf-09): capacity-aware redistribute (round 2) — bounded + correct invariant 2026-05-17 15:30:50 +03:00
.dockerignore fix(scraper): диагностируем «кнопка не работает» — Redis lock + task_received log 2026-04-28 23:17:42 +03:00
.env.example feat(backend): sentry-sdk init для FastAPI + Celery (#204 backend) (#207) 2026-05-16 15:09:16 +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
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 fix(scraper): диагностируем «кнопка не работает» — Redis lock + task_received log 2026-04-28 23:17:42 +03:00
pyproject.toml feat(backend): sentry-sdk init для FastAPI + Celery (#204 backend) (#207) 2026-05-16 15:09:16 +00:00
uv.lock feat(backend): sentry-sdk init для FastAPI + Celery (#204 backend) (#207) 2026-05-16 15:09:16 +00:00