Digests of parsed JSON with ensure_ascii=False raise UnicodeEncodeError for a lone-surrogate escape in the input
メンテナーはふだん 1 日以内に返信
@antonwolfy がすでに取り組んでいます。
2026年11月13日 から。
評価
この issue はまだ評価されていません。
説明
Several digests dump parsed data with ensure_ascii=False and encode with .encode("utf-8"): item_digest and assignment_digest (dokimi/dokimi/eval/leakgate.py:162,175), graph_digest (dokimi/dokimi/eval_coverage.py:71), expectations_digest (dokimi/dokimi/repos/conformance.py:108), response_cache_key (dokimi/dokimi/caching.py:377) and _content_key (dokimi/dokimi/harnesses/harbor_export.py:100, resolved.encode()). A JSON or YAML escape such as "\udcff" in the input file loads as a lone surrogate and the encode raises. Plain file text is not a trigger: it is decoded as strict UTF-8.
Repro, each with json.loads('"n\\udcff"') as the value:
leakgate.item_digest({"grading": {"expected": S}}) -> UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 14: surrogates not allowed
eval_coverage.graph_digest({"nodes": [{"id": "a", "text": S, "path_class": "x"}]}) -> ... position 65
conformance.expectations_digest({"a": S}) -> ... position 7
caching.response_cache_key(litellm_model="m", messages=[{"role": "user", "content": S}]) -> ... position 41
harbor_export._content_key(path, "n\udcff") -> ... position 1
Fix options: .encode("utf-8", "surrogatepass") keeps every digest that encodes today unchanged and separates different surrogates; or refuse a lone surrogate in the loader with a message. Not errors="replace", which makes two inputs collide. Whether _content_key is reached depends on _task_toml writing a raw surrogate, which was not traced.
Found while fixing #675. The fix's PR is #721.
- 主要言語
- Python
- スター
- 15
- フォーク
- 11
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 464
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
intel/dokimi のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
OCA/account-invoicing#2529 ·
メンテナーはふだん 1 日以内に返信
-
area/ci
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster textオープンbug imagen skills
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Email validation accepts a trailing newline対応中かも @marcello-pichini が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信