fix(tradein): sync n_analogs to anchor count when anchor drives headline (#695) #739
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#739
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/695-n-analogs-anchor"
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?
QA-fail follow-up to #738
QA re-smoke found the contradiction persists: #738 only de-contradicted the explanation string, but
n_analogsstayed = radius count (listings_clean) while the same-building anchor (#691/#694) replaced the headline and the analogs list with the house comps. So every UI counter («Аналогов N», «Показано N из M», «по N аналогам», histogram) still read the radius number.On the Олимп penthouse (radius=4, anchor=5) this produced «Аналогов 4» next to «по 5 аналогам» and the artifact «Показано 5 из 4». #738's Малышева case passed only because radius==anchor (14=14) — mimicry, not a fix.
Fix
When
anchor_tier is not None, setn_analogs = anchor['n']— the comp count the estimate is actually built on (= the displayedanalogs, capped at 10). All counters now agree. Per #698, for the anchor path that IS the «full count found». Radius path unchanged.Test plan
pytest tests/test_same_building_anchor.py→ 54 passed (+2): radius=5 ≠ anchor=3 →n_analogs==3and «по 3 аналогам» agree (the exact failure shape); radius path keeps radius count.ruffclean.Post-merge QA: re-check the Олимп penthouse — «Аналогов»/«Показано N из M»/«по N аналогам»/histogram should all read 5.
Refs #695
✅ APPROVE
QA-fail follow-up к #738 (Praktika #695). Data-level companion к string-фиксу #738.
Correctness (трассировка n_analogs)
= len(listings_clean)/ 1533= 0(init) → ~1819= anchor["n"](фикс, внутриif anchor is not None) → 2103 persist + 2186AggregatedEstimate(n_analogs=...). Между 1819 и обоими консьюмерами реассайна нет (2047/2155 — чтение/передача, не=).anchor["n"]— тот же ключ, что в explanation на стр. 1818; для anchor-пути это «полное число найденных» по контракту n_analogs (#698).QA-loop отработал штатно — #738 починил строку, QA поймал расхождение счётчиков на данных («Показано 5 из 4»), #739 синхронизирует счёт. Честное описание (признаёт, что Малышева-кейс #738 прошёл из-за radius==anchor mimicry).
Tests — radius=5≠anchor=3 →
n_analogs==3+ «по 3 аналогам» (точная форма фейла); radius-путьn_analogs==5не меняется. 54 (+2), 234 regression.Scope/security — estimator.py + тест; нет миграции, нет secrets, нет self-extending триггера. Re-smoke Олимп → qa.