fix(tradein): confidence_explanation no longer contradicts counters (#695) #738
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#738
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/695-explanation-counts"
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
When the same-building (Tier A) or micro-radius (Tier C) anchor built the headline,
confidence_explanationconcatenated three fragments about different populations:_compute_confidence, describes the radius listings, count =n_analogs),analog_tiernote (S/H/widened),anchor['n']аналогам из того же дома».Since
n_analogs(radius) ≠anchor['n'](same-building comps) and the tiers differ, the text reads contradictorily — e.g. «Найдено 4 аналогов … построено по 5 аналогам из того же дома» and «разных адресов» vs «того же дома».Fix
When the anchor fires, the anchor sentence is authoritative — replace the explanation with it (preserving the orthogonal
repair_note) instead of appending to the radius base +tier_note. One count, one tier, internally consistent.confidencealready comes fromanchor["confidence"]. The radius path (no anchor) is unchanged.Test plan
pytest tests/test_same_building_anchor.py→ 52 passed (+2): anchor path → «построено по 3 аналогам из того же дома», no «Найдено»/«разных адресов»; radius path keeps the base «Найдено N…» text.ruffclean.Refs #695
✅ APPROVE
Fix #695 (Praktika milestone) — устранение противоречия в confidence_explanation при сработавшем якоре.
Correctness (проверено по коду)
repair_noteопределён на стр. 1538 (= ""), условно set на 1545 — standalone-переменная в scope на 1797. NameError исключён.explanation(стр. 1593) =base + tier_note + repair_note. Фикс ПОЛНОСТЬЮ отбрасывает его (убирает(explanation or "")префикс) и строит заново из anchor-фразы +repair_note→repair_noteровно один раз, без дублей; противоречащий радиусный текст + tier_note корректно выкинуты." Оценка…"(append), новая"Оценка…"(sentence-initial — верно).+ repair_noteповторяет идентичный паттерн со стр. 1593 → разделители консистентны.confidenceуже =anchor["confidence"]— согласовано.Tests — обе ветки: anchor-путь (фраза якоря есть, «Найдено»/«разных адресов» нет) + radius-путь (base-текст сохранён, якорной фразы нет). 52 passed (+2), 228 regression.
Scope/security — estimator.py + тест; нет миграции, нет secrets, нет self-extending триггера. Smoke → qa.