[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,98 +2,181 @@
|
||||
id: wiki-2026-0508-modern-review-workflow
|
||||
title: Modern Review Workflow
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-REINFORCE-AUTO-WIKI-DEV-007]
|
||||
aliases: [AI Code Review, PR Review 2026, Augmented Review]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.95
|
||||
tags: [development, pull-request, review-workflow, pr-size-limits, architecture-review, agile, p-reinforce]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [code-review, ci-cd, ai-augmented, pr-workflow]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-01
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: typescript
|
||||
framework: github-actions
|
||||
---
|
||||
|
||||
# [[Modern Review Workflow|Modern Review Workflow]]
|
||||
# Modern Review Workflow
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "작고 집중된 변경(Small Batches)을 통해 인지 부하를 줄이고, 사전 설계 검토와 자동화 게이트를 결합하여 개발 속도와 아키텍처 무결성을 동시에 확보하는 협업 프로세스."
|
||||
## 매 한 줄
|
||||
> **"매 review = human judgment + AI scaffolding"**. 2026년 PR review 매 single-reviewer linting → multi-agent triage 의 진화. Claude Opus 4.7 / Codex 가 매 first-pass (style, security, regression) 를 처리, human 의 매 architectural / product 판단에 집중.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
현대적인 리뷰 워크플로우는 단순히 코드를 검사하는 단계를 넘어 배포의 안전성과 팀의 민첩성을 보장하는 핵심 프로세스입니다.
|
||||
## 매 핵심
|
||||
|
||||
1. **풀 리퀘스트 (Pull Request / Merge Request)**:
|
||||
* 코드 변경 사항을 메인 브랜치에 병합하기 전, 동료들의 검토와 자동화 테스트를 거치는 공식적인 관문입니다.
|
||||
* **단일 목적 지향**: 하나의 PR은 기능 추가, 버그 수정, 리팩토링 중 단 하나의 명확한 목적만 가져야 합니다.
|
||||
2. **PR Size Limits (작은 PR의 원칙)**:
|
||||
* **인지적 한계**: 리뷰어는 200~400 LOC(Lines of Code) 사이에서 가장 높은 결함 발견율을 보입니다. 400줄을 초과하면 집중력이 급격히 저하되어 '고무 도장(Rubber-stamping)' 리뷰가 될 위험이 큽니다.
|
||||
* **분할 전략**: 거대 기능은 **기능 플래그(Feature Flags)**나 **누적 PR(Stacked PRs)**을 활용하여 작은 단위로 나누어 병합합니다.
|
||||
3. **[[Architecture Review (아키텍처 및 설계 리뷰)|Architecture Review]] (Shift-Left)**:
|
||||
* 코드를 작성하기 전, 설계 문서나 ADR(Architecture Decision Record)을 통해 방향성을 먼저 합의합니다. 이는 대규모 리팩토링 비용을 사전에 차단하는 가장 효율적인 전략입니다.
|
||||
4. **애자일 개발과의 조화**:
|
||||
* 지속적 통합(CI)과 빈번한 병합을 통해 코드 노후화(Stale)를 방지하고 피드백 루프를 극단적으로 단축합니다.
|
||||
### 매 단계
|
||||
- **Pre-PR**: 매 author-side `claude review` local 의 self-check.
|
||||
- **CI gate**: 매 automated agent 의 매 diff scan — security, perf, test coverage.
|
||||
- **Human review**: 매 design intent / API contract / UX trade-off 의 deep dive.
|
||||
- **Post-merge**: 매 deploy preview + canary metrics 의 watch.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **전체 맥락의 상실**: PR을 너무 작게 쪼개면 시스템의 '큰 그림'을 놓칠 수 있습니다. 이를 보완하기 위해 PR 설명에 상위 목표와의 연결성을 명시하거나, 사전 설계 리뷰를 병행해야 합니다.
|
||||
- **분할 오버헤드**: 작은 PR로 나누는 작업 자체가 개발자에게 추가적인 부담이 될 수 있습니다. 이는 시스템을 느슨하게 결합(Loosely Coupled)된 모듈로 설계하여 자연스럽게 작은 변경이 가능하도록 아키텍처 수준에서 해결해야 합니다.
|
||||
### 매 agent layer
|
||||
- **Linter agent**: style, type, dead code.
|
||||
- **Security agent**: secret scan, OWASP, dependency CVE.
|
||||
- **Test agent**: coverage delta, flaky detect, mutation score.
|
||||
- **Review agent**: 매 prose summary + risk flag (Claude Opus 4.7).
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Effective Code Review Feedback|Effective Code Review Feedback]]: 워크플로우 내에서의 구체적 소통법.
|
||||
- [[Automated Quality & Review|Automated Quality & Review]]: 인간의 리뷰 전 수행되는 자동화 관문.
|
||||
- [[Engineering Metrics (DORA)|Engineering Metrics (DORA]]: 워크플로우 효율성을 측정하는 지표.
|
||||
- [[Feature-Flags|Feature Flags]]: 큰 기능을 안전하게 나누어 배포하는 기술.
|
||||
- [[Technical-Debt|Technical Debt]]: 비대해진 PR이 유발하는 잠재적 위험.
|
||||
---
|
||||
### 매 응용
|
||||
1. Solo dev: 매 CI agent 만 = 매 reviewer 효과.
|
||||
2. 팀 (10+): tiered — agent gate → senior architect.
|
||||
3. OSS: 매 maintainer triage 의 cost 감소.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
## 💻 패턴
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### GitHub Actions: Claude review hook
|
||||
```yaml
|
||||
name: ai-review
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
jobs:
|
||||
review:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: { fetch-depth: 0 }
|
||||
- uses: anthropics/claude-code-action@v1
|
||||
with:
|
||||
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
model: claude-opus-4-7
|
||||
mode: review
|
||||
target-base: ${{ github.base_ref }}
|
||||
comment-style: inline
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Inline comment poster
|
||||
```typescript
|
||||
import Anthropic from "@anthropic-ai/sdk";
|
||||
import { Octokit } from "@octokit/rest";
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
const a = new Anthropic();
|
||||
const gh = new Octokit({ auth: process.env.GH_TOKEN });
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
export async function reviewDiff(owner: string, repo: string, pr: number) {
|
||||
const { data: files } = await gh.pulls.listFiles({ owner, repo, pull_number: pr });
|
||||
const diff = files.map((f) => `### ${f.filename}\n${f.patch ?? ""}`).join("\n\n");
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
const res = await a.messages.create({
|
||||
model: "claude-opus-4-7",
|
||||
max_tokens: 4096,
|
||||
system: "You are a senior reviewer. Output JSON: {comments: [{path, line, body, severity}]}.",
|
||||
messages: [{ role: "user", content: diff }],
|
||||
});
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
const { comments } = JSON.parse((res.content[0] as any).text);
|
||||
for (const c of comments) {
|
||||
await gh.pulls.createReviewComment({
|
||||
owner, repo, pull_number: pr, ...c,
|
||||
commit_id: process.env.HEAD_SHA!,
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### Local pre-PR self-check
|
||||
```bash
|
||||
# .git/hooks/pre-push
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
git diff origin/main...HEAD | claude -p "Review this diff. Flag bugs, security, perf only. No style." --model claude-opus-4-7
|
||||
```
|
||||
|
||||
### Risk-tiered routing
|
||||
```typescript
|
||||
type Risk = "low" | "medium" | "high";
|
||||
|
||||
function classify(diff: string): Risk {
|
||||
if (/migrations\/|schema\./.test(diff)) return "high";
|
||||
if (/auth|payment|crypto/i.test(diff)) return "high";
|
||||
if (diff.split("\n").length > 500) return "medium";
|
||||
return "low";
|
||||
}
|
||||
|
||||
function reviewers(r: Risk): string[] {
|
||||
return {
|
||||
low: ["ai-bot"],
|
||||
medium: ["ai-bot", "@team-lead"],
|
||||
high: ["ai-bot", "@security", "@architect"],
|
||||
}[r];
|
||||
}
|
||||
```
|
||||
|
||||
### Mutation-test gate
|
||||
```yaml
|
||||
- name: stryker
|
||||
run: npx stryker run --threshold.break 70
|
||||
```
|
||||
|
||||
### Coverage delta comment
|
||||
```typescript
|
||||
const before = await coverage("main");
|
||||
const after = await coverage("HEAD");
|
||||
const delta = after.lines - before.lines;
|
||||
if (delta < -1) await gh.issues.createComment({
|
||||
...ctx, body: `⚠️ Coverage dropped ${delta.toFixed(1)}%`,
|
||||
});
|
||||
```
|
||||
|
||||
### Auto-merge on green + AI ack
|
||||
```yaml
|
||||
- if: ${{ steps.ai-review.outputs.severity == 'none' && steps.tests.outcome == 'success' }}
|
||||
run: gh pr merge ${{ github.event.pull_request.number }} --squash --auto
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Solo / OSS | AI agent only, human spot-check |
|
||||
| Small team | AI gate + 1 human (rotating) |
|
||||
| Regulated (fin/health) | AI + 2 humans + audit log |
|
||||
| Hot path / migrations | Mandatory architect review |
|
||||
|
||||
**기본값**: AI first-pass + 1 human reviewer + risk-tiered escalation.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Code-Review-Practices]] · [[CI-CD]]
|
||||
- 변형: [[Pair-Programming]] · [[Mob-Programming]]
|
||||
- 응용: [[Pull-Request-Workflow]] · [[Trunk-Based-Development]]
|
||||
- Adjacent: [[Static-Analysis]] · [[Mutation-Testing]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 diff scan, security triage, coverage summary, prose explanation 의 PR description.
|
||||
**언제 X**: 매 architectural decision, API contract negotiation, domain-specific business rule — human 의 judgment.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **AI rubber-stamp**: 매 agent approve = 매 human 의 skip. 매 critical path 의 review 누락.
|
||||
- **Comment flood**: agent 의 매 nitpick → noise. Severity threshold 의 setting.
|
||||
- **No risk tiering**: schema migration 매 typo fix 와 동급 review → bottleneck.
|
||||
- **Secrets in prompt**: diff 의 secret 의 leak. Pre-scan + redact.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (GitHub blog 2025, Anthropic Claude Code docs 2026, Google Eng Practices).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — AI-augmented PR review workflow with Claude Opus 4.7 patterns |
|
||||
|
||||
Reference in New Issue
Block a user