Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Economy routes return 500 for Israel when a policy ID of 0 means current law

Offen
#3,908 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
Ein halber Tag
Anfängerfreundlichkeit
48/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
api, backend

Rechercherichtung

Start in policyengine_api/utils/get_current_law.py, where the lookup covers only uk, us, ca and ng, then check how policyengine_api/routes/economy_routes.py calls it for the single-year and budget-window routes. The COUNTRIES list in policyengine_api/constants.py includes il, so that is the case to reproduce. Done means Israel with policy ID 0 either resolves to a stored current-law ID or returns a clear 4xx, with no 500. Confirm first whether Israel has a stored current-law policy, since that choice decides the fix.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

The single-year and budget-window economy routes (/<country_id>/economy/<policy_id>/over/<baseline_policy_id> and its budget-window variant in policyengine_api/routes/economy_routes.py) treat a policy ID of 0 as "current law" and resolve it with get_current_law_policy_id(country_id).

get_current_law_policy_id (policyengine_api/utils/get_current_law.py) only knows uk, us, ca and ng, but COUNTRIES in policyengine_api/constants.py also includes il, so validate_country lets Israel through. For country_id="il" with either ID set to 0, the dictionary lookup raises KeyError, which the generic error handler turns into a 500.

Expected

Either Israel resolves to its current-law policy ID, or the route returns a clear 4xx saying current law is not available for Israel.

Notes

  • Found while documenting the code for the ruff docstring rules; behaviour was left unchanged there.
  • Worth checking whether Israel has a stored current-law policy at all before choosing between the two fixes.
Vorherrschende Sprache
Python
Sterne
18
Forks
33
Ø Merge
1 T. 15 Std.
Gemergte PRs (30 T.)
18

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus PolicyEngine/policyengine-api

Alle Issues in PolicyEngine/policyengine-api

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.