feat(objective): diff-gated objective_lots_history writer trigger (#307 OBJ-6) #1719
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#1719
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/objective-lots-history-writer-307-obj6"
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?
Задача (#307 OBJ-6)
objective_lots_historyимел 974k строк, но дельта-трекинга не было — python-парсер (70_parse_objective_raw.py) делал wholesaleINSERT ... ON CONFLICT DO NOTHING(одна строка на лот в день, независимо от изменений; vault-заметка про «delta tracking ON» оказалась ложной).Решение
Миграция
164_objective_lots_history_writer.sql:AFTER INSERT OR UPDATEтриггерobjective_lots_write_history, diff-gated поprice_per_m2_rub/price_calculated_total_rub/price_offer_total_rub/status/is_sold(IS DISTINCT FROM, NULL-safe). Latest-snapshot lookup по индексу;price_delta_pctsnapshot-over-snapshot;ON CONFLICT DO UPDATE(чинит drop intraday-изменений). Idempotent. Python sync НЕ тронут (правится параллельным воркером).Verify (live DB, авто-rollback, 0 прод-мутаций)
price 167326→180000 → 1 строка, delta 7.57 ✅; no-tracked-change → 0 строк ✅; same-day → update in place ✅; new lot → 1 строка ✅. Триггер enabled на проде.
Follow-up (не в PR)
Убрать прямой history-INSERT из
70_parse_objective_raw.py(тот файл правит OBJ-1-воркер) — тогда history станет полностью diff-gated. Сейчас безопасно сосуществуют (DO UPDATE, без дублей).Closes #307 (OBJ-6)