mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
The branch passed neither `lando phpcs` nor `lando artisan test`:
- SearchService::sanitizeUtf8 compared mb_convert_encoding() against false,
which PHPStan rejects as always-true (it never returns false on PHP 8).
- ScrapeUrlTest used Http::fake() without importing the facade, so the
soft-404 test errored instead of asserting. The feature was untested.
Soft-404 detection was also too loose and, where it did fire, ineffective:
- A bare "404" in a title matched real model numbers ("Roland SP-404",
"Peugeot 404"), nulling the price of live products and marking them
discontinued. It now only counts alongside error wording or alone.
- The template-404 body marker was unanchored, so a theme stylesheet
mentioning it could condemn a product page. Each marker is now anchored
to the attribute it belongs to.
- The injected schema.org Discontinued value was re-read through the
store's availability match config, which finds no rule for it and falls
back to its default (usually InStock) - losing the signal on exactly the
well-configured stores. ScrapeUrl::resolveStockStatus() now honours an
explicit not_found flag first, and all availability call sites use it.
Also: cover the progress-polling fix (it had no tests), extract the
logic duplicated across both search components into a concern, sanitize
title/image as well as html, and fix an unrelated flaky UrlTest that
compared a created_at-ordered relation against an id-ordered assertion.