fix(adr): adr-judge lefthook job — Python UTF-8 mode for Cyrillic diffs
adr-judge crashed (UnicodeEncodeError: surrogate '\udc98') when the staged diff contained non-ASCII content: Python reads piped stdin with the Windows cp1251 console codepage, not UTF-8, so a Cyrillic diff mis-decodes into surrogates and dies at diff_text.encode('utf-8'). '-X utf8' forces Python UTF-8 mode. Task 5's red-test probe was ASCII, so the crash went unseen until Task 6's Cyrillic docs/architecture files. adr-judge's file reads already use explicit encoding='utf-8'; only stdin was affected.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -121,8 +121,10 @@ pre-commit:
|
||||
# правила к staged-дифу. Вендорен из adr-kit v0.13.1 (MIT) → tools/adr-judge.py;
|
||||
# пере-вендорить после `/adr-kit:upgrade`. Без --llm → только regex, без вызова
|
||||
# Claude API, нулевая стоимость (AK6). Без glob — adr-judge нужен весь staged-диф.
|
||||
# `-X utf8` обязателен: stdin Python на Windows = cp1251; диф с кириллицей иначе
|
||||
# ломается на surrogate → UnicodeEncodeError (crash, не ADR-violation).
|
||||
- name: adr-judge
|
||||
run: git diff --cached --unified=0 | python tools/adr-judge.py --diff - --adr-dir docs/adr/
|
||||
run: git diff --cached --unified=0 | python -X utf8 tools/adr-judge.py --diff - --adr-dir docs/adr/
|
||||
fail_text: |
|
||||
adr-judge: staged-изменение нарушает задокументированное архитектурное
|
||||
решение (ADR). Смотри file:line выше и docs/adr/ADR-*.md.
|
||||
|
||||
Reference in New Issue
Block a user