STEP: 1554 / Script: scripts/git-atomic-commit.sh / Feedback rule: memory/feedback_multi_tab_commit_atomic.md / Trigger: STEP 1544/1550 実測 incident 2 件
実測 incident 1: STEP 1544 commit 1a8deb61d contamination (2026-08-29)
意図した 4 files (game-verdict-connector.ts + test + public + dist-renderer) が commit されず、 代わりに別 tab の step-1537-verdict-puzzle + step-1541-flow-state 系 9 files が入った。 自 files は untracked (?) に戻り staging drop。 復旧に別 commit d23bc29bf 必要。
実測 incident 2: STEP 1550 first commit attempt (2026-08-29)
「no changes added to commit」 で失敗。 全 staging 消失。 同時に別 tab で STEP 1548/1549/1551 の 3 commit landing。 復旧に原子的 git add && git commit 必要 (commit 83be73c6e)。
.git/index は repo あたり単一の shared file。 Multi-tab workflow で:
Tab A: git add MY_FILES → index = {MY_FILES staged}
Tab B: git add THEIR_FILES → index が mutate される (併記 or 置換)
Tab A: git commit -m "..." → 現在の index (= B 変更後) を commit
→ 結果: 自 files 欠落 or 別 files 混入
Git 自体は multi-writer 前提の設計ではない。 pre-commit hook が git add を追加すること (inbox merger 等) も index を触るため race window を広げる。
git commit --only FILESAtomic 5 stage: single git process 内で実行、 他 tab の add/reset/commit に免疫。
git add は一時 index に追加)scripts/git-atomic-commit.sh# Basic (multi-file): scripts/git-atomic-commit.sh -m "STEP 1550 Lean 4 ..." -- \ data/lean4-transfer/step1550_game_verdict.lean \ src/mcp/rei-mcp-server.ts \ public/tools/step-1550-lean4-game-verdict/index.html # With --force (dist-renderer mirror 等 gitignored file): scripts/git-atomic-commit.sh -m "..." --force -- \ dist-renderer/tools/step-1550-lean4-game-verdict/index.html # Long HEREDOC message via file: cat > /tmp/msg.txt <<'EOF' STEP 1550 Lean 4 for game_verdict — 12 theorem zero sorry Body... EOF scripts/git-atomic-commit.sh -F /tmp/msg.txt -- file1 file2 # Help: scripts/git-atomic-commit.sh -h
| Flag | 意味 |
|---|---|
-m MSG | Commit message (short) |
-F FILE | Commit message from file (long HEREDOC 用) |
--force | git add -f 事前実行 (gitignored file 用、 dist-renderer/ mirror 等) |
-- | Files delimiter (以降は全て files 扱い) |
-h | Help |
| Code | 意味 |
|---|---|
| 0 | OK |
| 1 | Usage error (bad flags, missing file) |
| 2 | No files specified |
| 3+ | git commit error (git 自体の exit code + 2) |
memory/feedback_multi_tab_commit_atomic.md で永久 rule 化:
| 層 | tool | 役割 | 導入 STEP |
|---|---|---|---|
| 1 (集約) | Inbox pattern (docs/recent-updates-inbox/ + memory/hooks/) | 単一 append point (RECENT_UPDATES.md / MEMORY.md) への直接編集を禁じ、 unique file 経由で merger が atomic 集約 | 2026-08-27 (STEP 1414+1415+mapping arc 3 tab 併走 collision root cause fix) |
| 1.5 (番号) | Central STEP counter (scripts/claim-step.ts) | STEP 番号 collision 予防 (SAC-4 49/50 renumber root cause fix) | 2026-08-27 |
| 2 (commit) | scripts/git-atomic-commit.sh | git index race を --only FILES で回避、 別 tab の staging に免疫 | 2026-08-29 (STEP 1554、 本 STEP) |