Files
2nd/10_Wiki/Topics/AI_and_ML/Pull_Request_PR.md
T
koriweb d8a80f6272 chore(wiki): dangling 링크 canonical 정규화 (768파일/1200건)
이름만 다른(표기 변형) [[위키링크]]를 대상 문서의 canonical 제목으로 치환해
끊겼던 1,200개 링크를 연결. 제목/파일명 정규화 일치만 적용하고 별칭 매칭은
과병합 위험으로 제외(애매성 가드). 원본은 _link_reconcile_backup/ 에 백업.
도구: Datacollect/scripts/link_reconcile_apply.mjs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 12:24:15 +09:00

6.0 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-pull-request-pr Pull Request (PR) 10_Wiki/Topics verified self
PR
Merge Request
Code Review PR
none A 0.9 applied
git
github
code-review
workflow
2026-05-10 pending
language framework
shell git

Pull Request (PR)

매 한 줄

"매 PR — small, single-purpose, reviewable diff". 매 GitHub flow 의 unit of change. 2026 modern: AI-assisted review (Copilot, CodeRabbit, Claude) 가 매 first-pass triage, 매 human reviewer 의 architecture / intent 에 집중.

매 핵심

매 Why small PRs

  • 매 review latency: 200 LOC PR 의 review time ≈ linear, >400 LOC 의 superlinear (review fatigue).
  • 매 bug detection: small PR 의 defect rate 의 lower (Microsoft 2013 study, 2024 GitHub data confirm).
  • 매 revert cost: small PR 의 cleanly revertable.
  • 매 mental model: reviewer 의 hold entire diff in head.

매 PR anatomy

  • Title: conventional commit prefix (feat:, fix:, refactor:, docs:, chore:).
  • Description: WHY (not WHAT — diff shows WHAT). Link issue (Closes #123).
  • Test plan: explicit checklist of manual / automated verification.
  • Screenshots / videos: UI changes 의 mandatory.
  • Breaking changes: top-level callout.

매 GitHub flow (vs Git flow)

  1. main always-deployable.
  2. Branch from main (feat/xyz).
  3. Commit + push.
  4. Open PR early (draft PR for WIP).
  5. CI + review.
  6. Squash-merge → deploy.

매 응용

  1. Open-source contribution (fork → PR).
  2. Internal team workflow (trunk-based).
  3. AI agent autonomous PRs (Devin, Claude Code, Cursor agents 의 emit PR).

💻 패턴

Small focused PR

# 매 single concern per PR
git checkout -b feat/add-user-avatar main
# ... edits limited to avatar feature ...
git add src/components/Avatar.tsx src/components/Avatar.test.tsx
git commit -m "feat(user): add Avatar component with fallback initials"
git push -u origin feat/add-user-avatar
gh pr create --fill --base main

Conventional commit message

feat(auth): add OAuth2 PKCE flow for SPA clients

- Replace implicit grant (deprecated) with PKCE
- Add code_verifier generation in auth-store
- Update redirect handler to exchange code

Closes #482
BREAKING CHANGE: SPA clients must upgrade to PKCE flow.

PR description template (.github/pull_request_template.md)

## Why
<problem this solves; link to issue>

## What changed
- bullet 1
- bullet 2

## Test plan
- [ ] unit tests pass (`pnpm test`)
- [ ] manual: login → logout flow
- [ ] verified on Safari + Firefox

## Screenshots
| Before | After |
|---|---|
| ... | ... |

Stacked PRs (Graphite / spr workflow)

# 매 large feature 을 매 dependent small PRs 로 split
gt create -m "feat: add User model"        # PR #1 base=main
gt create -m "feat: add User API"          # PR #2 base=PR#1
gt create -m "feat: add User UI"           # PR #3 base=PR#2
gt submit --stack

Squash-merge with clean message

gh pr merge 482 --squash --delete-branch \
  --subject "feat(auth): add OAuth2 PKCE flow (#482)" \
  --body "$(gh pr view 482 --json body -q .body)"

CI gate (GitHub Actions)

# .github/workflows/pr.yml
on: pull_request
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
      - run: pnpm install --frozen-lockfile
      - run: pnpm lint && pnpm typecheck && pnpm test
      - run: pnpm build

AI review automation (CodeRabbit / Claude PR review)

# .github/workflows/claude-review.yml
on: pull_request
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          mode: review
          model: claude-opus-4-7

Review etiquette (comment style)

# 매 nit (preference, non-blocking)
nit: prefer `const` over `let` here

# 매 question (clarification)
q: why bypass the cache here?

# 매 blocker (must fix before merge)
blocker: this regex is catastrophic backtracking, see #391

# 매 praise
praise: nice extraction of the retry helper

매 결정 기준

상황 Approach
<200 LOC, single concern merge as-is
>400 LOC split into stacked PRs
WIP, want early feedback draft PR
breaking change explicit BREAKING CHANGE footer + RFC 먼저
hot fix small PR, fast-track review, label hotfix
cosmetic only label chore, rubber-stamp review

기본값: 매 small (<300 LOC), single-purpose, conventional commit title, draft 시작 → ready when CI green → squash-merge.

🔗 Graph

🤖 LLM 활용

언제: PR description 초안, conventional commit message generation, first-pass review (typo / obvious bug / style). 언제 X: architectural decision, security-sensitive review, business-logic correctness — LLM 의 surface false confidence, 매 human reviewer 의 final word.

안티패턴

  • Mega PR: 1000+ LOC, multi-concern → reviewer 의 rubber-stamp, bugs slip.
  • Ghost PR: open PR, no description → reviewer 의 reverse-engineer intent.
  • Drive-by review: "LGTM" without reading diff.
  • Force-push after review: lose review thread context — prefer fixup commits, squash on merge.
  • Branch from feature branch (not main): stacked dependency hell unless using Graphite.

🧪 검증 / 중복

  • Verified (GitHub Docs 2026, Conventional Commits 1.0, Microsoft Code Review study 2013, Google Eng Practices).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — full PR best practices with AI review automation