Repository navigation
chore: .gitattributes を追加し CRLF 破損を構造的に防ぐ - #212
Conversation
リポジトリ root に .gitattributes を新規追加。 * text=auto のデフォルト行、スクリプト・ソース系を text eol=lf で正規化、 Windows 専用ファイルを text eol=crlf、バイナリアセットを binary 指定することで、 Windows/WSL 環境での checkout/commit 時 CRLF 混入を構造的に防ぐ。 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
検証結果レポートIssue #97:
|
| AC | 確認コマンド | 実行結果 | 判定 |
|---|---|---|---|
| AC1 | test -f .gitattributes |
ファイル存在確認済み | PASS |
| AC2 | grep -nE '^\*\.sh|*.py' .gitattributes |
.sh・.py 両パターン確認 | PASS |
| AC3 | git check-attr text eol -- <3スクリプト> |
全て eol: lf を返却 |
PASS |
| AC4 | git ls-files --eol |
.claude/skills/**/*.{sh,py} 全て attr/text eol=lf |
PASS |
| AC5 | CRLF 検査(Python) | tracked な .sh/.py に CRLF なし |
PASS |
| AC6 | grep -nE 'binary' .gitattributes |
png/jpg/gif/webp/ico 等確認 | PASS |
| AC7 | PR #212 body の disclaimer 確認 | 「対象外」テキスト検出 | PASS |
Standard Gates
| ゲート | 実行結果 | 判定 |
|---|---|---|
pnpm typecheck |
成功 | PASS |
pnpm lint |
成功 | PASS |
pnpm test |
5/5 PASS | PASS |
pnpm build |
ビルド成功 | PASS |
総合判定
- 全 AC PASS: YES
- 全 Standard Gates PASS: YES
- FAIL 件数: 0
```yaml
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: CLEAN
baseline_only: false
verification_commands_pass: 11
verification_commands_fail: 0
```
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
- AC coverage: 全 7 件 (AC1〜AC7) PASS。PR 本文の
## 受け入れ条件の達成状況テーブルに各 AC の結果と根拠が記載されており、TEST_VERDICT_MACHINE コメント(verification_commands_fail: 0)でも全 PASS が確認されている。 - Allowed Paths: 変更ファイルは
.gitattributes1 ファイルのみ。Issue #97 のallowed_paths: [.gitattributes]に完全一致。遵守: true。 - CI Verification: build / lint / python-test / test / typecheck の全 5 チェックが
pass。 - 検証コマンド結果: PR 本文の
## 検証コマンド結果セクションに AC1〜AC7 各コマンドの出力が記載されており、雰囲気ではなく実行結果が確認できる。 - Schema Change Applicability:
not_schema_changeと明示されており根拠も妥当(.gitattributesは producer-consumer contract ではない)。Schema Consumer Inventory 提出不要。 - Safety Claim Matrix: 変更対象は repo root の
.gitattributes1 ファイルのみ。changed path / diff / issue text に safety-sensitive 判定条件(transport/permission/sandbox/auth/MCP/.claude/skills/**/.github/workflows/**)が含まれないため、N/A 判定は妥当。 - Runtime Verification: Issue に
decision: not_applicableと明記されており、test -f/grep/git check-attrの静的検証で完結している。
Blockers
なし
Non-blockers(任意改善)
なし
LOOP_VERDICT
LOOP_VERDICT:
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 4031e236086afc92a2ace886fde595333219c1af
follow_up_issue_requests: []|
敵対的レビュー結論 Verdict: APPROVE寄り。ただし “証跡品質” に軽微な修正推奨。Blockerはなし。 PR #212 は Issue #97 の要求どおり、repo root に .gitattributes だけを追加し、.sh / .py を含む主要テキストを text eol=lf、Windows系を text eol=crlf、主要バイナリを binary にしている。変更ファイルも .gitattributes 1件のみで、Issue #97 の Allowed Paths と一致する。 Git公式仕様上、text は check-in 時に LF 正規化を有効化し、eol=lf は checkout 時にも index と同じ LF を使わせる指定なので、このPRの中核方針は妥当。GitHub Docs も、repo root の .gitattributes を commit すると contributors の core.autocrlf より一貫した挙動を得られると説明している。 良い点 Issue #97 は、#79作業中に .claude/skills/ssot-discovery/scripts/match-ssot.sh が $'\r': command not found / set: pipefail: invalid option name で壊れた実害に基づく再発防止Issueであり、PR #103 でも CRLF破損と .gitattributes 不在が観測されていた。PR #212はその実害に対して最小かつ適切な構造的対策になっている。 .gitattributes の内容も、Git公式例の * text=auto、*.sh text eol=lf、画像系を非テキスト扱いにする設計と整合している。GitHub Docs でも text eol=lf は Windowsでも LFを維持すべきファイルに使い、binary は -text -diff の alias と説明されている。 指摘
PRコメント側のAC2検証に grep -nE '^\\.sh\|.py' と見える箇所があり、これは「.sh と .py の両方が正しく text eol=lf である」ことの証跡としては弱い。Issue #97 の Verification Commands には、.sh と .py を個別に確認する強い正規表現が定義されているため、PRコメントもIssue本文のコマンドに合わせるべき。 これは実装Blockerではない。PR本文側の検証出力と差分自体では *.sh text eol=lf / *.py text eol=lf が確認できるため、問題は「実装」ではなく「レビュー証跡の精度」。
.gitattributes は将来の check-in / checkout の正規化には効くが、既存 working tree の破損や既存 index の全面正規化を自動で完了するものではない。GitHub Docs も、line ending 設定変更後に全体を揃えるには git add --renormalize . を使う手順を案内している。 PR本文に「既存 working tree の CRLF 破損修復・実行 bit 修復は対象外」と明記されているため、この点は現状クリア。さらに follow-up として #206 が git add --renormalize の適用範囲設計、#205 が executable bit CI guard を扱っているため、スコープ分離も妥当。
現状の .gitattributes は .mjs, .cjs, .jsx, .mts, .cts, .css, .html, .svg, Dockerfile, .env* などは明示していない。ただし Issue #97 のIn Scopeに列挙された拡張子は満たしており、変更許可も .gitattributes のみ。後続でSSOT YAML/frontmatter生成や npm script を扱う #198 があるため、そこで新規ファイル種別が増えた時に .gitattributes の追補Issueを切るのがよい。 高品質化パッチ案 PR #212自体に入れるなら、実装差分ではなく検証コメントまたはPR本文の証跡修正だけでよい。 AC2: .sh / .py を個別に確認grep -nE '^*.sh[[:space:]]+text[[:space:]]+eol=lf$' .gitattributes binary 指定も全件数を確認するなら head で切らないgrep -nE '^*.(png|jpg|jpeg|gif|webp|ico|mp3|wav|ogg|mp4|zip|gz|pdf|ttf|otf|woff|woff2)[[:space:]]+binary$' .gitattributes 任意で .gitattributes に将来追加してもよい候補: *.jsx text eol=lf ただし、今回PRのIssue契約上は追加必須ではない。 最終判断 マージ可。 |
検証証跡 更新 (外部レビュー指摘対応)外部レビューで AC2 / AC6 の grep 証跡が弱いと指摘されたため、Issue #97 の VC と同等の厳密な正規表現で再確認した結果を記録します。 AC2:
|
Summary
.gitattributesを新規追加し、スクリプト・ソース・設定系ファイルの改行コードをeol=lfに正規化するcore.autocrlf設定による CRLF 混入を構造的に防ぐ.sh,.py等 14 種類の拡張子をtext eol=lf、Windows 専用 4 種類をtext eol=crlf、バイナリアセット 17 種類をbinary指定する受け入れ条件の達成状況
.gitattributesが repo root に存在する*.shと*.pyにtext eol=lf行が含まれるeol: lf属性が適用されるgit ls-files --eolでattr/text eol=lfが確認できる.sh/.pyに CRLF が含まれていないbinary指定が含まれる検証コマンド結果
Allowed Paths 遵守
.gitattributes(1 ファイル).gitattributesSchema Change Applicability
not_schema_change.gitattributesは git の line-ending 正規化設定ファイルであり、producer-consumer 境界をまたぐ machine-readable contract ではないSchema Consumer Inventory
N/A(
not_schema_changeのため)Compatibility Decision
N/AN/AN/AN/ASafety Claim Matrix
N/A。変更対象は
.gitattributes(1 ファイル)であり、transport/permission/sandbox/auth/MCP/.claude/skills/**/.github/workflows/**のいずれにも該当しない。Notes
Closes #97