Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

PATCH /report with an outdated report ID writes to the outdated record, so the served report stays pending

Fechada
#4,043 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 3 dias

Um pull request relacionado já foi integrado.

  • #4044 de @PavelMakarchuk — integrado

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
python
Domínio
api, backend

Direção de pesquisa

Start by reading resolve_report_output and update_report_output, then inspect the unit test reproduction described in the issue. Trace how the outdated ID maps to the current report and how the PATCH selects a record. Done when updating through the outdated ID completes the current report returned by GET, with a regression test covering that flow.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Problem

When a report is stored under an outdated report-output cache version, GET /{country_id}/report/{id} serves the current report for the same simulations and year (creating it if needed) and labels it with the requested ID (response_id). The app then saves the result it computed with PATCH /{country_id}/report and that same ID. update_report_output selects the record by ID, which is the outdated one, and writes the result there. The current report that GET serves stays pending, so the report never completes, and every visit recomputes it.

Reproduced in a unit test on master (ed036b43): after resolve_report_output(outdated_id) and update_report_output(outdated_id, status="complete", output=...), the outdated record holds the new output and resolve_report_output(outdated_id) still returns the current record as pending with no output.

Why it matters now

The report-output cache version includes the country package and policyengine versions. #4024 changed them, so every older v1 report (UK and US) is now outdated and goes through this path the next time it opens.

Related

#3946 reports a 500 on the same PATCH for reports 4501 (US) and 4729 (UK). This bug explains why such reports stay pending; the 500 itself does not reproduce on the SQLite test database, so its cause still needs the production log.

🤖 Generated with Claude Code

Linguagem predominante
Python
Estrelas
18
Forks
33
Merge médio
2d 16h
PRs com merge (30d)
53

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de PolicyEngine/policyengine-api

Todas as issues de PolicyEngine/policyengine-api

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.