Repository navigation
fix(verified-reviews): read an empty ratings answer as "no ratings" - #17
Merged
Merged
Conversation
The ratings query answers `{}` for a single unrated product, but an empty
200 when none of several products has a rating. The PDP always asks for a
product together with its colors, so every product whose whole color group
is still unrated (every launch) logged "Unexpected end of JSON input" as an
error: ~1,400 lines per 6h, the largest group in production, with nothing
wrong for the shopper. Read the body as text and treat empty as no ratings;
a malformed body or an HTTP error still fails and logs as before.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JkCbBdPTvcEiJmvG3U7MfL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some o maior grupo de erro de produção (
Error on call ratings of Verified Review - SyntaxError: Unexpected end of JSON input, ~1.400 linhas a cada 6h), que não indicava falha nenhuma.Causa
A API do Verified Reviews tem duas formas de dizer "sem nota" na
query: "average":["3951"]){}["3951","3950","4024"])A PDP da Oficina pede a nota do produto junto com todas as cores (
aggregateSimilarProducts: true). Todo produto cujo grupo de cores ainda não tem avaliação — todo lançamento — caía no corpo vazio, efetchAPIestourava noresponse.json(). Os traces amostrados em produção eram exatamente tênis novos (0103086905,0103080713).Correção
ratingeratingsleem o corpo como texto e tratam vazio como "sem notas", igual ao{}. JSON inválido ou erro HTTP continuam falhando e logando como antes. Contrato dos apps intacto (resultado tratado, sem throw).Verificado contra a API real
Depois do merge: re-pinar deco-sites/oficina-reserva no SHA do
main-alt.🤖 Generated with Claude Code