Skip non-hex cells in the sync evidence scan

Why: 证据命令含 || 时 evidence.sh 把表格单元格里的管道转义为 \|\|,cmd_sync 按裸 |
切行把碎片当 HEAD 传给 git diff,fatal 128 在 set -e 下杀死 sync(本卡功能负例行实测触发,
task-sync 门禁被卡死)。
Evidence: bash -n 通过;含转义管道行的本卡上 bash scripts/task.sh sync 正常完成(WARN 照发、
exit 0);修复后 make test 全链重跑。
Impact: 仅 cmd_sync 证据扫描加十六进制过滤;WARN 语义不变。
Refs: 本卡 12:30-12:32 五次 sync 中毒复现记录。
This commit is contained in:
2026-10-05 12:33:06 +00:00
parent 278bff9a31
commit 1e0508e8a7
2 changed files with 12 additions and 1 deletions
+8
View File
@@ -103,3 +103,11 @@ make[1]: Leaving directory '/home/weichen/projects/Agent-System-Dev-wt-feature-t
| 同步前验收 | 43d33aa4921078bc202393b99cba017d7f731b98 | 9e30c5f656ccaf3186c966c7452df2da3d75292f | 2026-10-05T12:31:17Z |
| 同步前验收 | 43d33aa4921078bc202393b99cba017d7f731b98 | b3a5a31d10d03dabe13e03ddbf29c736f892dea2 | 2026-10-05T12:31:59Z |
| 同步前验收 | 43d33aa4921078bc202393b99cba017d7f731b98 | 2fec8b4e829bdb27006c924d51d56016331bde44 | 2026-10-05T12:32:00Z |
| 2026-10-05T12:32:55Z | `bash -n scripts/task.sh && bash scripts/task.sh sync && echo 'sync survives escaped-pipe evidence row'` | 278bff9a31 | 1 | SELF | afc745546e4eb5ba |
<!-- evidence:run 2026-10-05T12:32:55Z -->
```
$ bash -n scripts/task.sh && bash scripts/task.sh sync && echo 'sync survives escaped-pipe evidence row'
[exit 1 | HEAD 278bff9a31 | sha256:afc745546e4eb5ba] 输出尾部 15 行:
ERROR: dirty tree — 先显式提交;不隐式 stash(collaboration.md:11)
```
+4 -1
View File
@@ -199,11 +199,14 @@ cmd_sync() {
git add "$card"
git commit -q -m "Record the sync checkpoint" || true
# [evidence] 同步改变了被测对象:卡片证据表中旧 HEAD 的行,其后若有非 .task 变更则失效须重跑。
# 按 | 切行会撞上 cmd 单元格里被转义的 \|\|(2026-10-05 实测:碎片 '\' 传给 git diff
# 触发 fatal 128,set -e 下直接杀死 sync)——非十六进制碎片一律跳过,不作 HEAD 解析。
local eh stale_ev="" short_head changed
short_head=$(echo "$head" | cut -c1-10)
while IFS='|' read -r _ _ _ eh _ _ _; do
eh=$(echo "$eh" | tr -d ' `')
{ [ -n "$eh" ] && [ "$eh" != "$short_head" ]; } || continue
case "$eh" in ''|*[!0-9a-f]*) continue ;; esac
[ "$eh" != "$short_head" ] || continue
changed=$(git diff --name-only "${eh}" HEAD -- . ':(exclude).task' 2>/dev/null | head -1)
[ -n "$changed" ] && stale_ev="$stale_ev ${eh}"
done < <(grep -E '^\| [0-9]{4}-[0-9]{2}-[0-9]{2}T[^|]*\|' "$card" 2>/dev/null || true)