fix(tradein/cian): extract_all_states — discover new .concat() format, not just legacy .push() #2438
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#2438
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/tradein-cian-state-parser-concat-discovery"
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
Live bug found 2026-07-04 while verifying #2435 (Cian bti_data persistence). A real Cian offer page (200 OK, 595KB) parsed fine via
extract_state()— which already tries the new.concat([...])format first,.push({...})as fallback (per #639 2026-05 format drift) — butextract_all_states()returned{}. It only ever scanned the legacy.push()pattern (_RE_CIAN_PUSH), never updated for the concat format.This silently starved both consumers of real data on every current-format page:
cian/detail.pybti sister-state — the exact gap #2435 built persistence for, which could never receive datacian/newbuilding.pysister-state extractionFix
_extract_all_from_concat(html)— mirrors the existing_extract_from_concat()array-boundary logic (_RE_CIAN_CONCAT+_balanced_array, both unmodified) but without the single-key filter, collecting every{key,value}pair from every.concat([...])call.extract_all_states()now merges concat results first, then push-format matches for any(mfe, key)not already found via concat — mirroringextract_state()'s concat-first / push-fallback precedence.Strictly additive: previously-empty dict now populated; both callers already guard absent keys via
.get(..., {})+ truthiness /isinstance, so no behavior regression — only the empty-fallback path gets real data.Tests
New
tests/test_cian_state_parser.py(module had zero coverage before): concat discovery, multiple mfe containers, legacy push regression, mixed concat+push precedence (concat wins), no-config edge case, and anextract_state()/extract_all_states()consistency invariant — the exact invariant the bug violated.Test plan
pytest tests/test_cian_state_parser.py -v-> 6/6 passpytest tests/ -k cian -q-> 118 passedruff checkon both changed files -> cleanfrontend-offer-cardwith ~20 sub-keys.No SQL / schema / auth / pipeline-rule changes. Pure string/regex parsing.
Refs #2435