PUT user-profile returns 500 when user_id is missing from the payload
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
バグは policyengine_api/routes/user_profile_routes.py の update_user_profile にあります。payload.pop("user_id") にはデフォルト値がなく、KeyError を発生させます。user_id が null の場合の既存の分岐("Payload must include user_id" とともに 400 を返す)を読み、キーが存在しない場合も同じ経路をたどるようにしてください。user_id を含まないペイロードが null の場合と同じ 400 を受け取り、両方のケースをテストでカバーすれば完了です。
索引モデルが issue の本文から書いたものです。
説明
The PUT /<country_id>/user-profile route (update_user_profile in policyengine_api/routes/user_profile_routes.py) reads the ID with payload.pop("user_id"), with no default. A payload without a user_id key raises KeyError, which the generic error handler turns into a 500.
The route already returns 400 ("Payload must include user_id") when user_id is present but null, so a missing key should get the same 400.
Expected
A payload without user_id gives 400 with the same message as a null user_id, for example by using payload.pop("user_id", None). Add a test for both cases.
Notes
- Found while documenting the code for the ruff docstring rules; behaviour was left unchanged there.
- The route has a TODO pointing at #2054 (request validation), which is now closed.
- 主要言語
- Python
- スター
- 18
- フォーク
- 33
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 18
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PolicyEngine/policyengine-api のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
PolicyEngine/policyengine-api#3910 ·
メンテナーはふだん 1 日以内に返信
-
Enable ruff security, logging and debugging rules (S, T20, LOG, G, DTZ, ERA, TD, FIX, EXE)対応中かも @anth-volk が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
PolicyEngine/policyengine-api#3914 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
PolicyEngine/policyengine-api#3912 ·
メンテナーはふだん 1 日以内に返信
-
validate_country prints "Validating country" on every request対応中かも @anth-volk が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 25/100
PolicyEngine/policyengine-api#3909 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 48/100
PolicyEngine/policyengine-api#3908 ·
メンテナーはふだん 1 日以内に返信
PolicyEngine/policyengine-api の issue をすべて見る
似ている issue
-
vis.image() reports "Unsupported number of image channels: 224" for an HxWxC image対応中かも @piyush182004 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
fossasia/visdom#1997 · コメント 3 件 ·
メンテナーはふだん 6 日以内に返信
-
Byse new domainオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Gujal00/ResolveURL#1525 ·
メンテナーはふだん 1 日以内に返信
-
Serialisation fails with pydantic 2.14: wrap serialisers pass SerializationInfo as index_key対応中かも @hugohills-regnosys が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
finos/rune-python-runtime#45 ·
-
[Bug]: LangGraph Store sync put bypasses namespace validation対応中かも @ktz03 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
volcengine/OpenViking#6050 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
hummingbot/condor#283 ·
メンテナーはふだん 1 日以内に返信