Skip to content

[DRAFT] Accept non-string immersive product title and fractional rating - #1

Merged
qschmick merged 2 commits into
mainfrom
fix/immersive-title-shape
Sep 25, 2026
Merged

qschmick merged 2 commits into
mainfrom
fix/immersive-title-shape

Conversation

@qschmick

Copy link
Copy Markdown
Member

Description

  • Archived google_immersive_product searches can return product_results as {"title": {"<n>": <int>}} with no stores. ImmersiveProductResults types title as ?string, so Data::from() throws a TypeError and the retrieve fails.
  • prepareForPipeline now maps a title that isn't a string to null.
  • rating is now ?float. SerpApi sends fractional ratings (e.g. 4.6), which ?int truncated.

Testing Instructions

  • vendor/bin/pest --no-coverage: 4 passed.
    • The new title-shape test failed before the fix with the TypeError.
    • The new rating test failed with 4 instead of 4.6.
  • vendor/bin/phpstan analyse: no errors.
  • Pint: clean.

Callouts

  • rating changes type from ?int to ?float, which is visible to anyone reading it.
  • Tag v0.0.9 after merge.

qschmick and others added 2 commits September 25, 2026 14:03
Archived google_immersive_product searches can return product_results as
{"title": {"<n>": <int>}} with no stores. ImmersiveProductResults typed
title as ?string, so Data::from() threw a TypeError.

- prepareForPipeline maps a non-string title to null
- rating is ?float (SerpApi sends fractional ratings; ?int truncated them)
- tests cover both shapes
@qschmick
qschmick marked this pull request as ready for review September 25, 2026 18:39
@qschmick
qschmick merged commit 8b8affe into main Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant