fix(tradein/cian): extract_all_states — discover new .concat() format, not just legacy .push() #2438

Merged
lekss361 merged 1 commit from fix/tradein-cian-state-parser-concat-discovery into main 2026-07-04 21:03:33 +00:00

1 commit

Author SHA1 Message Date
bot-backend
7833c354e9 fix(tradein/cian): extract_all_states — discover new .concat() format, not just legacy .push()
All checks were successful
CI Trade-In / changes (pull_request) Successful in 8s
CI / changes (pull_request) Successful in 9s
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / backend-tests (pull_request) Successful in 51s
Found live 2026-07-04 while verifying #2435 (bti_data persistence): a real Cian
offer page (200 OK, 595KB) parsed fine via extract_state() (which already tries
.concat() first, .push() as fallback per the #639 2026-05 format drift), but
extract_all_states() returned {} — it only ever scanned the legacy .push()
pattern via _RE_CIAN_PUSH, never updated when .concat() became the live format.

This silently starved both of its consumers of real data on every current-format
page: cian/detail.py's bti sister-state (the exact gap #2435 built persistence
for, which could never receive data) and cian/newbuilding.py's sister-state
extraction. Confirmed via live re-fetch after the fix: extract_all_states() now
returns 6 real MFE containers instead of an empty dict.

No test file previously existed for cian_state_parser.py (a stale .pyc from a
pre-scraper_kit-migration test was the only trace) — added tests/test_cian_state_parser.py
covering concat discovery, legacy push fallback, mixed-format precedence, and the
extract_state()/extract_all_states() consistency invariant that the bug violated.

Full backend suite: 2345 passed, 6 skipped, 1 pre-existing unrelated failure
(test_search_cache_hit, verified via git stash against clean main).

Refs #2435
2026-07-04 23:45:55 +03:00