Same ghapi version returns different results depending on fastcore version (JSON `null` → empty `AttrDict`)
まだ誰も着手していません。
評価
調査の方向性
Issue にある GhApi の再現から始め、fastcore 1.8.16 と 1.11.2 でのレスポンス変換を比較し、報告されている fastcore.dict2obj の処理に焦点を当てます。完了条件は、サポート対象の fastcore バージョン全体で GitHub JSON の null 値が一貫して Python None のままになり、示されているリポジトリ一覧取得の呼び出しを通じてその挙動が検証されることです。
索引モデルが issue の本文から書いたものです。
説明
Summary
When using the same ghapi version, the return value of API calls changes depending on the fastcore dependency version.
Specifically, JSON null values from the GitHub REST API (e.g. repository description) are returned as:
Nonewithfastcore==1.8.16- empty
fastcore.basics.AttrDict({}) withfastcore==1.11.2
This breaks the semantic meaning of the API response and causes downstream issues (e.g. database storage, business logic).
Why this is a problem
- GitHub API explicitly defines
description: nullas “no value” - In Python, this should map to
None {}(empty mapping) has a different semantic meaning thanNone- The behavior changes without changing the ghapi version, only by upgrading a dependency
From a user’s perspective, this means:
The same ghapi version produces different API results depending on dependency resolution
This breaks API contract stability and reproducibility.
Environment
| Component | Version |
|---|---|
| ghapi | 1.0.8 |
| fastcore (local) | 1.8.16 |
| fastcore (sam) | 1.11.2 |
| Python | 3.10.19 |
Reproduction Code
from ghapi.core import GhApi
api = GhApi(token="*******", owner="ORG_NAME")
batch = api.repos.list_for_org("ORG_NAME", per_page=1, page=1)
r0 = batch[0]
print("item:", r0.get("description"), type(r0.get("description")))
print("attr:", r0.description, type(r0.description))
print("has key:", "description" in r0)
Actual Results
With fastcore==1.11.2
item: {} <class 'fastcore.basics.AttrDict'>
attr: {} <class 'fastcore.basics.AttrDict'>
has key: True
With fastcore==1.8.16
item: None <class 'NoneType'>
attr: None <class 'NoneType'>
has key: True
Expected Behavior
JSON null values from the GitHub API should consistently map to Python None, regardless of fastcore version.
At minimum, ghapi should:
- Preserve the semantic meaning of
null - Or pin / constrain fastcore versions to avoid silent behavior changes
Additional Notes
- The conversion appears to happen during
fastcore.dict2objprocessing - ghapi currently forwards this behavior directly to users
- This is not a database or SQLAlchemy issue — the value is already
{}immediately after the ghapi call
This behavior change is unexpected, breaking, and difficult to detect, especially in data ingestion pipelines.
I believe this is worth addressing either in ghapi itself or through tighter fastcore integration.
Thanks for your work on ghapi.
- 主要言語
- Python
- スター
- 687
- フォーク
- 69
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AnswerDotAI/ghapi のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
AnswerDotAI/ghapi#158 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
AnswerDotAI/ghapi#120 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
AnswerDotAI/ghapi#208 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
AnswerDotAI/ghapi#186 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
AnswerDotAI/ghapi#185 · コメント 1 件 · リアクション 1 件 ·
AnswerDotAI/ghapi の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Qiskit/qiskit-ibm-runtime#3431 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Lesson] A compatibility-gate rejection is a verdict, not something to overwrite with --accept-riskオープンlesson-submission needs-ac pending-review
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Ikalus1988/MisakaNet#2870 ·
メンテナーはふだん 1 日以内に返信
-
feature:LinkChecker
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
digitalfabrik/integreat-cms#4594 ·
メンテナーはふだん 5 日以内に返信