feat: convert --verify 對帳 + 修復 CRLF 使 hash 失準 + raw/** .gitattributes #1
Reference in New Issue
Block a user
Delete Branch "feat/convert-verify-reconcile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
目的
convert後檔案被手動刪除/就地改動時,提供正規的稽核與修復途徑;並修掉一個讓「還原後 re-hash 比對」在 Windows 失效的既有 bug。變更
convert.py --verify(純唯讀對帳):re-hash 全部登記檔、掃未登記檔,回報 missing / mismatch / unregistered,不一致以退出碼 1 表示(可當 CI/排程閘門)。converted/assets/*與.gitkeep正確略過。write_text在 Windows 把\n→\r\n,但登記的 SHA-256 算在\nbytes 上 → 磁碟 bytes 與帳本永遠對不上(converted md + web 快照原始檔)。改為write_bytes寫入所登記的那份 bytes。.gitattributes(raw/** -text):core.autocrlf=true下 checkout 會在 git 層重新引入 CRLF,抵銷上一項修復;關閉 raw 的換行正規化,把「登記 hash == 磁碟 bytes」不變式延伸到 git checkin/checkout。.gitattributes機制。驗證
.venv/Scripts/python.exe tools/convert/selfcheck.py→ALL PASS。備註
--verify是唯讀稽核工具,不改任何檔(含 manifest),符合 §7「lint 絕不擅自刪改」精神。修復決策(可衍生 vs 信任根、先git restore不改帳本、動 manifest 走 PR)詳見 AGENTS.md §14。🤖 Generated with Claude Code