Capafy
시작하기
Branch Merge Readiness Review: Which Are Safe?

Branch Merge Readiness Review: Which Are Safe?

Read-only pre-merge check of your branches: conflicts, scope drift, leaked secrets and re-run tests, then a verdict per branch and a merge order. #엔지니어링

평점
더 많은 평가가 필요합니다
판매
0
사용 방법
다운로드

붙여넣는 것: 리뷰 대기 중인 브랜치, 각 브랜치 작업에 대한 한 줄 요약, 그리고 대상 브랜치.
받는 것: 브랜치별 MERGE / MERGE_AFTER_FIX / HOLD / NEEDS_INFO 판정과 근거, 필수 수정 사항, 병합 순서, 그리고 실행한 명령어.

작동 방식

Branch Merge Readiness Review는 사용자가 제공한 리뷰 대기 브랜치(이름, 각 브랜치 작업에 대한 한 줄 요약, 대상 브랜치)를 "완료, 테스트 통과"라는 말을 그대로 믿지 않고 정해진 순서에 따라 읽기 전용으로 점검합니다. ref를 옮기거나 작업 트리를 변경하지 않으며(드라이런 병합은 참조되지 않는 git 객체를 기록할 수 있습니다), 브랜치 코드를 실행하기 전에 먼저 확인을 구합니다.

1단계 - 충돌. 병합 기준점(merge-base)을 기준으로 한 드라이런 병합(git merge-tree)과, 서로 충돌하는 브랜치가 병합 순서에 반영되도록 브랜치 쌍별 점검을 수행합니다.

2단계 - 범위. 변경된 파일을 명시된 작업 기준으로 범위 내, 인접, 범위 밖(배포 스크립트, 무관한 모듈, 약화된 테스트, CI 변경)으로 분류합니다.

3단계 - 유출 및 산출물. 비밀 정보로 보이는 내용, 민감한 파일명, 빌드 결과물, 대용량 바이너리를 diff에서 검사합니다. 일치한 항목은 보고서에서 마스킹됩니다.

4단계 - 에이전트가 다시 실행하는 테스트. 내보낸 사본에서 프로젝트 테스트를 직접 실행하고, 정확한 명령어, 종료 코드, 통과/실패 개수를 기록한 뒤 대상 브랜치의 기준선과 비교합니다. 테스트를 실행할 수 없으면 그렇게 밝히며, 통과했다고 가정하지 않습니다.

5-6단계 - 판정과 순서. 브랜치별 MERGE / MERGE_AFTER_FIX / HOLD / NEEDS_INFO 판정을 근거 표, 필수 수정 사항, 권장 병합 순서와 함께 제공하며, 모든 점검을 반복할 수 있도록 실행한 명령어도 그대로 제공합니다. 비밀 정보 검사는 휴리스틱이며 보안 감사가 아닙니다.

샘플 출력

이 Skill을 샘플 문제에 실행한 실제 출력이며, 편집하지 않았습니다.

> **Read-only review.** Nothing was merged, pushed, checked out over your working tree, or modified. The secret scan is a pattern heuristic, not a security audit: a clean scan does **not** prove a branch has no secrets, and a MERGE verdict is a recommendation, not a guarantee that the code is correct or safe. The human who merges owns the decision.

Repository: /tmp/demo4/repo-branch-merge-readiness-review, target: main @ b015557, reviewed on 2026-10-18.

(Sample request was hand-written, fictional fixture repo. Test execution relied on the explicit authorization in the request: exported copies only, command `python3 -I -m unittest`, no network, no dependency install.)

## Verdicts
| Branch | Tip | Verdict | One-line reason |
|---|---|---|---|
| feature/subtract | 3d222be | **MERGE** | Clean dry-run merge, in scope, nothing found by the scan, 2 tests pass on branch and on the merged tree. |
| feature/multiply | 41c7f1e | **MERGE_AFTER_FIX** | Conflicts with main in calc.py (main added negate() at the same spot); otherwise in scope and tests pass. Rebase and re-test. |
| feature/divide | c7ec94e | **HOLD** | Adds a .env containing an AWS-style key id and secret, a 3 MB minified bundle, and a deploy script, none of which the task asked for. |

## Evidence
| Check | feature/subtract | feature/multiply | feature/divide |
|---|---|---|---|
| Conflicts vs main (merge-base 6f6658b; behind/ahead 1/1 each) | CLEAN (merge-tree exit 0, tree eac2c2f) | CONFLICT in `calc.py` (exit 1) | CLEAN (merge-tree exit 0, tree f673658) |
| Scope vs brief | IN SCOPE: `subtract.py` (new), `test_calc.py` (+3 lines) | IN SCOPE: `calc.py` (+3), `test_calc.py` (+3/-1; the removed line is the import line being extended) | OUT OF SCOPE: `.env`, `deploy/release.sh`, `dist/bundle.min.js`. In scope: `divide.py`, `test_calc.py` |
| Leaks / artifacts | NONE FOUND (checked: sensitive file names, secret patterns on added lines, build paths, blobs over 1 MB; added lines only, not full history) | NONE FOUND (same checks) | FINDINGS: `.env` added; line 1 `AWS_ACCESS_KEY_ID=AKIA****` (AWS access key id pattern; cannot be confirmed as fake from the diff alone); line 2 `AWS_SECRET_ACCESS_KEY=fake****` (generic secret assignment, value looks like a placeholder but cannot be confirmed); `dist/bundle.min.js` build output, 3,000,000 bytes (about 2.9 MB), text; `deploy/release.sh` prints "deploying to prod" only, no network or file deletion seen |
| Tests re-run (python3 -I -m unittest in `git archive` export) | PASS (Ran 2 tests, OK; exit 0). Merged tree also PASS (2 tests, exit 0) | PASS on branch alone (Ran 2 tests, OK; exit 0). Merged result NOT TESTED (it conflicts) | PASS on branch alone (Ran 2 tests, OK; exit 0). Merged tree also PASS (2 tests, exit 0) |
| Author-reported (unverified) | "2 tests pass" | "2 tests pass" | "2 tests pass" |

Baseline: main alone, `Ran 1 test, OK; exit 0`. The author-reported counts matched what I saw on each branch.

## Pairwise conflicts
Only branches that are clean against main are required to be checked pairwise; I also ran the pairs that include multiply for information.

| Pair | Result |
|---|---|
| subtract + divide | CONFLICT in `test_calc.py` (both edit the same import and test lines) |
| subtract + multiply | CONFLICT in `test_calc.py` (informational; multiply already conflicts with main) |
| multiply + divide | CONFLICT in `test_calc.py` (informational) |

All three branches edit the same spot in `test_calc.py`, so whichever merges second will need a rebase.

## Required fixes
- **feature/multiply (owner: author)**: rebase onto current main, resolve the `calc.py` conflict (keep both `negate()` and `multiply()`), re-run `python3 -m unittest` and read the count the runner prints. Also expect a `test_calc.py` conflict if subtract lands first.
- **feature/divide (owner: author, then repository owner)**:
  1. Remove `.env` from the branch **and** treat the key pair as exposed: rotate or revoke it at the provider if it was ever real. Deleting the file in a new commit does not remove it from the branch history, so the branch must be recreated or have its history rewritten by its owner before merging. (This Skill does not do that.)
  2. Remove `dist/bundle.min.js` (build output) and add `dist/` to `.gitignore`.
  3. Drop `deploy/release.sh` or move it to its own reviewed branch; it is not part of "add divide()".
  4. Then rebase after subtract lands (the `test_calc.py` conflict) and re-run this review.

## Recommended merge order
1. **feature/subtract** - clean, smallest, tests pass on the merged tree. (Advice only; after it merges, main has changed.)
2. **feature/multiply** - after its rebase (it will also need to be rebased over subtract's `test_calc.py` change), re-run Phases 1 and 4.
3. **feature/divide** - blocked (HOLD); not ordered until the secret is handled and the branch is cleaned. Expect another `test_calc.py` rebase.

## Commands run
Read-only unless marked. All in /tmp/demo4/repo-branch-merge-readiness-review.
1. `git rev-parse --is-shallow-repository` -> false (exit 0)
2. `git rev-parse --verify --short main` / `feature/subtract` / `feature/multiply` / `feature/divide` -> b015557 / 3d222be / 41c7f1e / c7ec94e (exit 0 each). A first attempt that passed all refs in one call failed with exit 128 ("Needed a single revision"); nothing was changed.
3. `git merge-base main feature/<b>` -> 6f6658bcc94e (all three)
4. `git rev-list --left-right --count main...feature/<b>` -> `1 1` (all three)
5. `git merge-tree --write-tree main feature/subtract` -> exit 0; `... feature/multiply` -> exit 1 (CONFLICT calc.py); `... feature/divide` -> exit 0
6. `git merge-tree --write-tree feature/subtract feature/multiply`, `... feature/subtract feature/divide`, `... feature/multiply feature/divide` -> exit 1 each (test_calc.py)
7. `git diff --name-status main...feature/<b>` and `git diff --stat main...feature/<b>`, `git diff --numstat main...feature/<b>`
8. `git diff main...feature/<b> | grep -E '^\+' | grep -niE '<AKIA/ASIA, gh tokens, xox, sk_live_, private key block, JWT, generic secret-assignment patterns>'` (matches only in feature/divide; output masked)
9. `git cat-file -s feature/divide:dist/bundle.min.js` -> 3000000
10. `git show feature/divide:deploy/release.sh`
11. EXECUTES BRANCH CODE (authorized in the request): for b in main, feature/subtract, feature/multiply, feature/divide: `T=$(mktemp -d); git archive <b> | tar -x -C "$T"; cd "$T" && python3 -I -m unittest` -> exit 0 each (1, 2, 2, 2 tests; all OK); temp dirs removed
12. EXECUTES BRANCH CODE (authorized): same export-and-test for the merged trees `git archive $(git merge-tree --write-tree main feature/subtract)` and for feature/divide -> exit 0 each (2 tests, OK)
13. `git status --short | wc -l` -> 0 (working tree untouched)

## Not checked / NEEDS_INFO
- History before the branch point, and any commit inside a branch that adds then removes a secret (only the net diff against main was scanned).
- Whether the AWS-style values in feature/divide are real; treated as exposed because the diff cannot prove they are fake.
- Code quality, edge cases (e.g. divide by zero is not handled or tested), runtime behavior, dependency vulnerabilities, licenses.
- multiply's merged result (it conflicts), and the combined result of merging all branches together.

This is a pre-merge readiness estimate from read-only checks. Nothing was merged. Re-run after the branches change.

사용 사례

  • 이 AI 에이전트 브랜치 중 어느 것을 병합할 수 있고, 어떤 순서로 병합해야 하나요?
  • 병합 전에 브랜치의 병합 충돌, 유출된 비밀 정보, 범위 밖 변경을 확인해 주세요
  • 작성자의 말을 믿는 대신 테스트를 다시 실행하여 "모든 테스트 통과"라는 주장을 검증해 주세요
  • 외주 작업자나 서브에이전트 브랜치를 각자에게 할당된 작업 기준으로 병합 전 리뷰해 주세요

자주 묻는 질문

무언가를 병합하거나 푸시하나요? 아니요. 읽기 전용 git 명령어와 드라이런 병합만 사용하며, 병합, 푸시, 또는 작업 트리 위로의 체크아웃은 하지 않습니다.

제 코드를 실행하나요? 프로젝트 테스트만, 내보낸 사본에서, 그리고 명령어를 알리고 사용자의 승인을 받은 뒤(또는 사용자의 명시적 승인에 의존하여)에만 실행합니다. 둘 다 없으면 테스트는 실행하지 않음으로 기록합니다.

비밀 정보 검사는 보안 감사인가요? 아니요. 각 브랜치가 추가한 내용에서 일반적인 키 패턴과 파일명을 대조할 뿐이며, 깨끗한 결과가 비밀 정보가 없다는 증거는 아니고, 일치 항목은 사용자가 달리 확인해 줄 때까지 노출된 것으로 취급합니다.

테스트를 실행할 수 없거나 브랜치에 작업 요약이 없으면 어떻게 되나요? 해당 점검은 NOT RUN, COULD NOT RUN 또는 NEEDS_INFO로 보고됩니다. "확인할 수 없음"을 "통과"로 바꾸지 않습니다.

여기에 언급된 Git, GitHub 및 기타 제품명, 그리고 Anthropic, OpenAI, OpenClaw는 각 소유자의 상표입니다. 이 Skill은 독립적인 제품이며 이들 중 어느 곳과도 제휴, 보증, 후원 관계가 없습니다.