Skip to content

feat(health): Phase 3 — detect in-progress git ops (rebase/merge/cherry-pick) · Refs #414 - #415

Merged
erishforG merged 2 commits into
developfrom
feat/auto-health-phase3-git-ops
Aug 31, 2026
Merged

feat(health): Phase 3 — detect in-progress git ops (rebase/merge/cherry-pick) · Refs #414#415
erishforG merged 2 commits into
developfrom
feat/auto-health-phase3-git-ops

Conversation

@erishforG

Copy link
Copy Markdown
Owner

무엇

parsec health에 Phase 3 지표 3개를 추가한다: 진행 중인 git 작업 감지.

지표 감지 방법 의미
rebase_in_progress .git/rebase-merge/ 또는 .git/rebase-apply/ 디렉터리 rebase 중단/방치
merge_in_progress .git/MERGE_HEAD 파일 merge 중단/방치
cherry_pick_in_progress .git/CHERRY_PICK_HEAD 파일 cherry-pick 중단/방치

왜 (이슈 참조)

Refs #414 — 멀티 worktree 환경에서 "worktree A에서 rebase 시작 후 worktree B로 이동해 방치" 패턴은 index.lock으로 감지되지 않는다. lock 파일은 git 명령 실행 중에만 존재하지만, rebase/merge/cherry-pick 은 중간 상태로 영구 잔류한다.

변경

  • src/output/mod.rs: HealthRecord에 3개 bool 필드 추가 (additive — 하위 호환)
  • src/cli/commands/health.rs: resolve_git_dir() 헬퍼 추가 + Phase 1 lock 감지 로직 통합 + 3개 감지 추가
  • src/output/human.rs: ⚠ 빨간 태그 3개 + 아이콘 rollup 포함
  • src/output/json.rs: 3개 bool 필드 직렬화 + all_healthy rollup 반영

linked worktree (이 파일인 경우) 도 올바르게 처리: 포인터 resolve.

다음 Phase 힌트

Phase 4 후보: bisect in-progress (.git/BISECT_LOG) / revert in-progress (.git/REVERT_HEAD) 추가, 또는 --warn-only-ops 플래그로 op-in-progress만 필터링.

리스크

low — 완전 read-only. 파일시스템 접근 실패 시 false soft-fail. 새 필드는 기존 JSON 소비자에 추가만 됨 (breaking change 없음).

롤백

git revert <sha> 또는 이 브랜치를 develop에서 revert. downstream 영향 없음.

Test plan

cargo test -- health → 7 unit tests 통과:

  • resolve_git_dir main/linked worktree 레이아웃
  • rebase-merge/, rebase-apply/ 감지
  • MERGE_HEAD, CHERRY_PICK_HEAD 감지
  • 클린 상태에서 false positive 없음

cc @erishforG

…ry-pick) · Refs #414

Adds three new read-only health indicators to `parsec health`:

| Indicator              | Detection                                  |
|------------------------|--------------------------------------------|
| rebase_in_progress     | .git/rebase-merge/ or .git/rebase-apply/  |
| merge_in_progress      | .git/MERGE_HEAD                            |
| cherry_pick_in_progress| .git/CHERRY_PICK_HEAD                      |

These catch the common "I started a rebase in worktree A and forgot about it"
pattern that index.lock alone cannot detect (lock only exists while git runs).

Works for both main worktrees (.git/ dir) and linked worktrees (.git file
containing a gitdir: pointer). Detection failures soft-fail to false.

Changes:
- src/output/mod.rs: 3 new bool fields on HealthRecord
- src/cli/commands/health.rs: resolve_git_dir() helper + detection logic
- src/output/human.rs: ⚠ red tags + icon rollup for in-progress ops
- src/output/json.rs: 3 new bool fields + all_healthy rollup update
- 7 unit tests covering main/linked worktree layout + per-state detection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@erishforG erishforG added the auto-improvement Daily auto-generated improvement PR/issue label Aug 31, 2026
Pre-existing lint (clippy::for_kv_map) that started failing on CI ubuntu runner.
workspace.rs:318 iterated over (key, value) pairs but only used values;
replacing with .values_mut() satisfies the lint with no behaviour change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@erishforG
erishforG merged commit 794cdb2 into develop Aug 31, 2026
12 checks passed
@erishforG
erishforG deleted the feat/auto-health-phase3-git-ops branch August 31, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-improvement Daily auto-generated improvement PR/issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant