fix(update): card "Ver novidades" resiliente a falha da API (v1.36.2)#49
Merged
Conversation
… (v1.36.2) latest_release_notes() reusa a última nota obtida com sucesso em vez de zerar quando a REST API do GitHub falha (rate limit 60/h por IP / timeout), e o timeout sobe de 4s para 8s. Assim o card de novidades não cai pro link simples por uma falha pontual; só vira link se nunca obtivemos notas. + 2 testes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problema
Na página Admin → Atualizações, o card "Ver novidades" às vezes vira um link simples pro GitHub. Não é regressão de código:
git diff v1.36.0 HEAD -- app.py routes/admin.py= 0 linhas; o card existe e funciona desde v1.24.0.A causa é a fragilidade inerente: o card depende de uma chamada ao vivo à REST API do GitHub (
/releases/latest) para buscar o corpo da release —latest_release_notes()(app.py). Essa chamada é fail-open: num rate limit (60/h por IP, sem token no servidor) ou timeout de 4s, ela devolvia''e o template (templates/admin/update.html) caía no{% else %}→ link.Correção
latest_release_notes()reusa a última nota obtida com sucesso (_notes_cache) em vez de zerar quando a busca falha — o card só vira link se nunca obtivemos notas.Escopo
app.py(1 função) + teste + CHANGELOG/VERSION. Sem schema, sem rota nova.pytest: 152 passando.🤖 Generated with Claude Code