feat(velocity): migrate D2 sales source → objective_corpus_room_month #158
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#158
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/migrate-velocity-objective-v2"
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?
Replaces closed PR #157 (had history conflict with squash-merged #155).
Why
D2 velocity returns null для prod cad — `domrf_kn_sale_graph` не обновлялся с 2026-01 (4+ мес stale).
`objective_corpus_room_month` weekly updated (newest 2026-05). Antonov's Objective integration (#94 / event Objective_Integration_May07).
Changes
velocity.py — 2 queries migrated
analytics_queries.py — 4 functions migrated
Frontend — TS union + UI
Pre-push code-reviewer applied
3 findings caught locally до bot review:
Coverage caveat
`objective_complex_mapping` имеет 114 mappings (2.5% от 4548 ЖК ДомРФ). Для test cad — 3/32 конкурентов mapped → velocity вернёт result (confidence=low). Расширение coverage — future task.
E2E test after merge
```bash
curl -X POST "https://gendsgn.ru/api/v1/parcels/66:41:0204016:10/analyze?profile_user_id=admin"
expect velocity != null, competitors_count >= 1
```
Closes #156
Final review (SHA
5c92647, CI ✅)Cross-checked через
general-purposeagent (полный verification 7 пунктов). Verdict: approve + merge.Verified by agent
✅ JOIN semantics:
domrf_kn_objects.obj_id→objective_complex_mapping.domrf_obj_id→objective_complex_name = crm.project_name— корректно perdata/sql/68_schema_objective.sqllines 311-321✅ Per-corpus → per-ЖК collapse:
GROUP BY m.obj_idкорректно агрегирует corpora обратно в signal который callers ждут✅ ЕКБ filter implicit через Objective coverage — documented в docstring
✅ Frontend contract preserved:
obj_id,name,obj_class,distance_m,total_sqm_periodвсё spread черезcompetitor_meta(velocity.py:248-263). Никакой регрессии vs PR #147 area✅ TS union extended корректно:
"objective" | "sale_graph" | "rosreestr_fallback"+ UI handles обе labels✅ SAVEPOINT integrity: все 3
db.executeблока в velocity.py обёрнутыwith db.begin_nested():. NOdb.rollback()calls (PR #155 fix сохранён). Inline comment at lines 87-88 документирует.✅ analytics_queries.py 4 функции: plain reads, не savepoint-critical path — отсутствие begin_nested правильно (matches pre-PR pattern)
✅ Schema deps:
objective_corpus_room_month+objective_complex_mappingуже в prod через migration 68. NO new SQL в этом PR ✓✅ Zero-mapped fallback: empty
sales_rows→months_observed=0→ cleanreturn None, matches existing test✅ NULL safety:
COALESCE(deals_total_vol_m2, deals_total_count * 45.0)для DKP-only rowsMinor (не блокеры)
region_coderetained в signatures как_ = region_code— slightly ugly но pragmatic backward-compatAuthor quality
Автор сам прогнал code-reviewer pre-push и поймал 3 issue до open PR — высокий стандарт.
approve merge