Skip to content

Improve worktree and distribution cleanup - #71

Merged
yansfil merged 1 commit into
mainfrom
fix/worktree-cleanup-retention
Sep 16, 2026
Merged

yansfil merged 1 commit into
mainfrom
fix/worktree-cleanup-retention

Conversation

@yansfil

@yansfil yansfil commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

삭제된 live pane cwd 하나가 모든 worktree cleanup 검사를 중단시키던 문제를 수정합니다.
존재하는 cwd는 canonical path로 검증하고, 이미 사라진 절대 경로는 해당 경로를 포함하는 후보만 계속 제외합니다.

일반 merge는 기존 Git ancestry로 증명하고, squash merge는 worktree HEAD와 정확히 일치하는 merged PR head 및 local main에 포함된 merge commit을 모두 요구합니다.
브랜치 이름만 같거나 GitHub에만 merge된 상태에서는 삭제하지 않습니다.

worktree 제거가 끝나면 현재 repository convention으로 계산한 checkout 전용 외부 test cache만 제거합니다.
cache 제거 실패는 worktree가 이미 제거된 사실을 유지하면서 partial 결과로 표시하고 같은 제거를 반복하지 않습니다.

로컬 distribution build는 완성된 bundle, zip, checksum을 먼저 검증하고 dist/에 현재 archive pair만 유지합니다.
publish 도중 command failure 또는 처리 가능한 종료 signal이 발생하면 이전 complete set으로 rollback합니다.

Review focus

  • 사람이 판단할 것: squash merge를 local cleanup 대상으로 인정하는 증명 조건과 current-only local archive retention 정책이 의도한 운영 방식인지 확인해 주세요.
  • 위험한 파일: herdr-core/src/worktree_cleanup.rs는 실제 worktree와 외부 cache를 삭제하며, scripts/publish-dist-artifacts.sh는 기존 local distribution을 교체합니다.
  • 리뷰어에게 묻는 것: exact PR head, local merge commit ancestry, normalized stale cwd, exact scratch root 검증이 삭제 전 fail-closed 경계로 충분한지 봐 주세요.

Risk surface

  • Runtime mutex: pane focus path만 lock 안에서 복사하며 GitHub, Git, filesystem 작업은 기존 action worker에서 lock 밖으로 실행합니다.
  • Snapshot wire: 기존 session.snapshot의 pane cwd와 foreground cwd 소비만 유지하며 wire 계약은 바꾸지 않습니다.
  • Ownership: pane cwd는 Herdr가 제공하고 cleanup eligibility 및 결과 상태는 core가 계산합니다.
  • Herdr contract: 새 method나 field를 추가하지 않습니다.
  • Failure path: 확인할 수 없는 pane path와 merge proof는 candidate exclusion으로 보이고, worktree 제거 후 cache 실패는 warning 색의 partial 결과로 보입니다.
  • High-frequency path: Overview에서 사용자가 여는 cleanup action에서만 실행하며 input, render, subscription 경로에는 일을 추가하지 않습니다.

Evidence

  • 확인한 것: cleanup 회귀 테스트 7개와 GitHub merge-proof parser 테스트 1개가 통과했습니다.
  • 확인한 것: distribution success, incomplete input preservation, checksum install 직전 강제 실패 rollback을 포함한 Python 스크립트 테스트 30개가 통과했습니다.
  • 확인한 것: shell syntax, Rust formatting, diff whitespace, design contract가 통과했습니다.
  • 확인한 것: 고정 bundle ID와 isolated Herdr server로 stale missing cwd를 실제 재현했고 cleanup sheet가 global error 없이 Available과 Excluded를 표시하는 것을 native screenshot으로 확인했습니다.
  • 확인한 것: destructive publish 경로를 독립 리뷰했고, 발견된 rollback gap을 수정한 뒤 failure injection과 재리뷰를 통과했습니다.
  • 확인하지 못한 것과 그 이유: 전체 Rust run은 555 passed, 3 failed, 6 ignored였으며 2개 session-sync deadline failure는 origin/main checkout에서도 동일하게 재현됐고 나머지 1개 pane reopen failure는 단독 실행에서 통과했습니다.
  • 확인하지 못한 것과 그 이유: 전체 Swift run은 443 passed, 1 failed였으며 login shell PATH failure는 origin/main checkout에서도 동일하게 재현됐습니다.
  • 화면 증거: native capture를 직접 확인했으며 repository의 evidence policy에 따라 local run artifact는 커밋하지 않았습니다.

@yansfil
yansfil merged commit 5b7e2a5 into main Sep 16, 2026
5 checks passed
@yansfil
yansfil deleted the fix/worktree-cleanup-retention branch September 16, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant