Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Return a client error for simulation years the model cannot project its dataset to

Aperta
#969 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@anth-volk ci sta già lavorando.

Dal 27/10/2026.

  • #970 di @anth-volk — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
api, backend

Direzione di ricerca

Start from the year-file preparation path and the projection limit in policyengine_uk/data/dataset_schema.py, where ValueError("No dataset found for year ...") is raised. Then read job_status_routes.get_job_status and the existing SPMInputError/spm_error_detail handling to mirror the typed-error and 400-response pattern. Done means a request outside the installed model's supported year range returns HTTP 400 with code DATASET_YEAR_UNAVAILABLE, including the requested year and supported range.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

A society-wide (economy) run for a year the country model cannot project its dataset to fails as a server error instead of a client error.

  • policyengine-uk projects its single-year dataset only to PROJECTION_END_YEAR (2032 since policyengine-uk 2.130.1; 2030 before). A UK run for a later year fails while .py prepares the year file: ValueError("No dataset found for year 2033.") from policyengine_uk/data/dataset_schema.py.
  • The gateway's job-status endpoint (job_status_routes.get_job_status) re-raises the job's exception from modal.FunctionCall.get, redacts it and returns HTTP 500 with status: "failed". The entry forwards that 500, and the Public API stores it as a computation failure and returns 502.
  • This happened on 2026-10-15 for 2031–2035 (when the limit was 2030) and on 2026-10-26 for 2033–2039.
  • A US run outside its dataset's projection (data year 2024, last projected year 2035 with the current model) does not fail: before 2024 the year file holds default inputs, and after 2035 it holds carried-over or index-uprated inputs. Neither is a supported result.

Intended change

Before .py prepares the dataset, check the requested year against the years the installed model projects the dataset to (from the source's data year to the model's projection end year), and raise a typed error with a stable code, DATASET_YEAR_UNAVAILABLE, carrying the requested year and the supported range. The gateway returns it as a 400 with that code and a readable message, following the pattern of the SPM input errors (SPMInputError, spm_error_detail).

This is the simulation service part of a change that also touches the Public API (map the code to a 400) and the app (don't offer unsupported UK years, show a readable message).

Lingua principale
Python
Stelle
1
Fork
1
Merge medio
1g 15h
PR unite (30g)
78

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PolicyEngine/policyengine-sim-api

Tutte le issue di PolicyEngine/policyengine-sim-api

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.