fix(scrapers): narrow domrf Level-1 status badge-class regex (#1609 follow-up) #1704

Merged
lekss361 merged 1 commit from fix/domrf-badge-regex-narrow-1686 into main 2026-06-17 18:34:33 +00:00
Owner

Проблема (ревью #1686)

_STATUS_BADGE_CLS_RE = status|badge|tag|chip|label слишком широк — срабатывал на любой generic tag/chip/label.

Решение

(?<![a-z])status(?![a-z]) — требует токен status в CSS-классе. Реальные бейджи (status-badge, flat-status-tag, status-label) матчатся; generic элементы уходят в Level-2/3 каскад.

Verify

ruff clean; pytest -k domrf85 passed, 6 skipped (+тест: generic label/tag/chip/badge не берётся как статус).

## Проблема (ревью #1686) `_STATUS_BADGE_CLS_RE = status|badge|tag|chip|label` слишком широк — срабатывал на любой generic `tag`/`chip`/`label`. ## Решение `(?<![a-z])status(?![a-z])` — требует токен `status` в CSS-классе. Реальные бейджи (`status-badge`, `flat-status-tag`, `status-label`) матчатся; generic элементы уходят в Level-2/3 каскад. ## Verify `ruff` clean; `pytest -k domrf` → **85 passed, 6 skipped** (+тест: generic label/tag/chip/badge не берётся как статус).
lekss361 added 1 commit 2026-06-17 18:28:46 +00:00
fix(scrapers): narrow domrf Level-1 status badge-class regex (#1609 follow-up)
Some checks failed
CI / changes (push) Successful in 8s
CI / changes (pull_request) Has been cancelled
CI / backend-tests (pull_request) Has been cancelled
CI / frontend-tests (pull_request) Has been cancelled
CI / openapi-codegen-check (pull_request) Has been cancelled
CI / backend-tests (push) Has been cancelled
CI / frontend-tests (push) Has been cancelled
CI / openapi-codegen-check (push) Has been cancelled
c3c89646ce
_STATUS_BADGE_CLS_RE was too broad: `status|badge|tag|chip|label` matched
generic UI elements (e.g. <span class="label">, <span class="chip">) that
are unrelated to the sale-status badge, risking picking the wrong block.

Narrowed to `(?<![a-z])status(?![a-z])` — requires the literal token
"status" as a hyphen-delimited component of the CSS class (matches
`status-badge`, `flat-status-tag`, `object-status` but not bare `label`,
`tag`, `chip`, `badge`).

Adds regression test: page with generic label/tag/chip/badge elements
containing "В продаже" must NOT activate Level-1; only the real
`status-badge` block ("Продана") should be returned → status=sold.
lekss361 merged commit be33faf73e into main 2026-06-17 18:34:33 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lekss361/gendesign#1704
No description provided.