Economy routes return 500 for Israel when a policy ID of 0 means current law
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
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
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus PolicyEngine/policyengine-api
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
PolicyEngine/policyengine-api#3911 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
PolicyEngine/policyengine-api#3910 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Enable ruff security, logging and debugging rules (S, T20, LOG, G, DTZ, ERA, TD, FIX, EXE)Evtl. vergeben @anth-volk hat das vor 1 Tag übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 18/100
PolicyEngine/policyengine-api#3914 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 38/100
PolicyEngine/policyengine-api#3912 ·
Maintainer antworten meist innerhalb von 1 Tag
-
validate_country prints "Validating country" on every requestEvtl. vergeben @anth-volk hat das vor 1 Tag übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 25/100
PolicyEngine/policyengine-api#3909 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in PolicyEngine/policyengine-api
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Deltares/imod-python#1940 ·
Maintainer antworten meist innerhalb von 1 Tag
-
effort: low prio: low ready
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
digitalfabrik/integreat-cms#4621 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
ioos/compliance-checker#1375 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag