Skip to content

chore(hook): main = PR-only 강제 + rawCmd 참조 버그 fix#21

Merged
developer-1px merged 1 commit into
mainfrom
chore/main-pronly-v2
Apr 21, 2026
Merged

chore(hook): main = PR-only 강제 + rawCmd 참조 버그 fix#21
developer-1px merged 1 commit into
mainfrom
chore/main-pronly-v2

Conversation

@developer-1px
Copy link
Copy Markdown
Owner

Summary

  • main 브랜치에서 `git commit/push/merge/rebase/cherry-pick` 로컬 실행 차단
  • `ALLOW_MAIN` envOverride 제거 — 하네스 env 미전파로 죽은 스위치였고 우회 유혹만 발생
  • origin/main 잠복 버그 수정: `isMainBranch()`가 `rawCmd`를 참조하지만 PR #15에서 const가 `cmd`로 rename되어 `ReferenceError` 발생하던 cd-prefix 판정 경로
  • `reset --hard`, `branch -D`를 main-only로 축소 (feature branch 복구 허용)
  • `push --force`에 `force-with-lease` 부정 lookahead 추가 (안전한 대안은 허용)
  • `docs/2026-04-21/mainPrOnlyPolicy.md`: 허용/금지 매트릭스 + 표준 워크플로우 명문화

Why

최근 세션에서 드러난 3개 모순:

  1. main에서 commit은 차단되는데 merge/rebase는 통과 → "머지 전용 worktree" 신조어 발생
  2. `ALLOW_MAIN=1` 우회 시도가 훅 프로세스 env에 닿지 않음 (하네스는 별도 프로세스)
  3. `rawCmd` 미정의로 cd-prefix 브랜치 판정이 조용히 실패 중

해결: main을 완전 read-only + PR-only 상태로 격리. 머지도 worktree에서.

Supersedes

Test plan

  • main cwd에서 `git merge/rebase/cherry-pick` 훅 차단 확인
  • worktree 안에서는 모든 git 쓰기 정상 동작
  • cd-prefix 판정 경로 ReferenceError 발생 안 함

🤖 Generated with Claude Code

- main 브랜치에서 git commit/push/merge/rebase/cherry-pick 차단
- ALLOW_MAIN envOverride 제거 (하네스 env 미전파로 죽은 스위치였음)
- rawCmd 참조 버그 수정 (origin/main에서 cmd로 rename되어 ReferenceError 발생하던 cd-prefix 판정 경로)
- reset --hard, branch -D를 main-only로 축소 (feature branch 복구 허용)
- push --force에 force-with-lease 부정 lookahead (대안 허용)
- docs/mainPrOnlyPolicy.md: 허용/금지 매트릭스 + 워크플로우

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@developer-1px developer-1px merged commit 8fcc2ad into main Apr 21, 2026
3 checks passed
@developer-1px developer-1px deleted the chore/main-pronly-v2 branch April 21, 2026 04:45
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