fix(22k): quartirography — use f.flat_type not f.type (column doesn't exist) #312
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#312
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/22k-quartirography-column"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Post-#310 hotfix.
GET /api/v1/analytics/object/{obj_id}/quartirographyвозвращал HTTP 500 на live (verified: gendsgn.ru/api/v1/analytics/object/65136/quartirography).Root cause
analytics_queries.py:988-989использовалLOWER(f.type), но вdomrf_kn_flatsнет колонкиtype— реальная колонкаflat_type(verified черезinformation_schema.columns).PostgreSQL → 42703 undefined_column → FastAPI → 500.
Fix
2-line change в
object_flats_quartirography():Verification (постgres-gendesign MCP)
Запрос отдаёт 4 bucket'a для Малевич obj=65136:
Why not caught earlier
22k worker не запускал endpoint против live DB — только статический lint pass. Pre-merge нет integration test для analytics endpoints.
Test plan
curl https://gendsgn.ru/api/v1/analytics/object/65136/quartirography→ HTTP 200 + JSON массив./analytics/objects/65136— Квартирография table render'ит 4 строки.POST-merge bug — /api/v1/analytics/object/{id}/quartirography returned 500 because SQL referenced f.type, but domrf_kn_flats has flat_type column. Verified via DB: query now returns 4 buckets (Нежилые/1-3-комн.) for obj=65136. Affected endpoint: GET /api/v1/analytics/object/{obj_id}/quartirographyDeep Code Review — verdict: APPROVE
Verified:
domrf_kn_flatscolumns (postgres MCP): естьflat_type(text),f.typeотсутствует — fix корректен.grep "f\.type"по backend → пусто. Других вхождений нет..type(analytics_queries.py:1427, 2624) — этоa.typeдля алиасаapartments, не related.CASE WHEN(строки 988-989) заменены.Smoke (Малевич obj=65136): 4 bucket'a (Нежилые/1-комн./2-комн./3-комн.), free/total/area/price корректны.
Lesson learned: static lint (ruff/mypy) не валидирует SQL column existence в
text("""..."""). Для analytics endpoints стоит integration test с реальной (или fixture) DB, который дёргает endpoint и проверяет non-500. Тогда такие 42703 ловились бы в CI, а не на live.Merged as hotfix.