Skip to content

Merge a green pull request without bringing it up to date when the merge result passes the fast checks - #774

Merged
yansfil merged 2 commits into
mainfrom
docs/merge-policy
Oct 8, 2026
Merged

yansfil merged 2 commits into
mainfrom
docs/merge-policy

Conversation

@yansfil

@yansfil yansfil commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Related: yansfil/sasu#29 (/ship merge가 이 검사를 쓰게 하는 쪽)

Summary

PR이 몰리는 날 머지가 느려진 가장 큰 원인은 "main이 움직이면 green PR도 최신 main을 받아 verify를 다시 돌린다"는 규칙이었습니다.
10-07~08 24시간 동안 머지된 PR 40개는 첫 green부터 머지까지 중앙값 29분을 기다렸고, #721은 main을 5번 받아 264분을 기다렸습니다.
이제 최신 verify가 green이고 python3 scripts/premerge-check.py <번호>가 지금 main과의 머지 결과에서 통과하면, 브랜치를 최신으로 만들지 않고 머지합니다.
둘이 합쳐야만 깨지는 동작은 main push run(전 레인)이 잡고, main이 빨간 동안은 revert나 수정 말고는 머지하지 않습니다.
CONTRIBUTING.md의 "Merging into main"이 정책과 근거를 소유합니다.

$ python3 scripts/premerge-check.py 454
`verify` passed on a1eda76c51cc: https://github.com/modakbul-gongbang/hide/actions/runs/37717294857
Checking #454 merged with main at 5956123e3292.
ok  node modules (4s)
ok  web typecheck (21s)
ok  desktop typecheck (3s)
ok  web e2e size budget (0s)
ok  desktop e2e size budget (0s)
ok  rust fmt and clippy (77s)
ok  ... policy 구조 검사 7개
#454 may merge now: gh pr merge 454 --merge --match-head-commit a1eda76c...

Review

  • 판단해 주세요: main이 빨개지면 "먼저 revert, fix-forward는 revert보다 작고 바로 준비된 경우만" 규칙이 맞는지.
  • 판단해 주세요: main과 PR이 같은 파일을 고쳤어도 검사가 통과하면 업데이트 없이 머지합니다. 테스트로만 드러나는 의미 충돌은 main push run에 맡기는 트레이드오프입니다.
  • 조심해서 볼 파일: scripts/premerge-check.py - failure path. 검사가 실패하거나 중단돼도 process group을 끝내고 worktree를 지우는지, 정리 실패가 원래 실패를 가리지 않는지.

Evidence

  • 확인한 것: test_premerge_check.py 7개: 충돌 거부, 각자 통과하지만 합치면 실패하는 두 변경 거부, 깨끗한 머지 허용, main을 포함한 브랜치는 검사 생략, 최신 verify run이 결정, policy 레인 구조 검사와 목록 일치.
  • 확인한 것: 일부러 넣은 결함 두 개(머지 결과 대신 PR head를 검사, 충돌을 통과로 처리)를 테스트가 각각 잡았습니다.
  • 확인한 것: 실제 PR로 실행. main보다 뒤처진 #454는 135초 만에 허용, verify가 취소된 #458은 2초 만에 거부. 둘 다 worktree가 남지 않았습니다.
  • 확인한 것: clippy 도중 SIGTERM을 보내면 exit 2, 검사 아래 프로세스 15개가 0개로 정리되고 worktree도 지워졌습니다.
  • 확인한 것: scripts/tests 전체 unittest 통과, check-no-workstation-identity, check-no-attribution 통과. 이 변경은 policy 레인만 계획합니다(ci-plan.py에 추가).
  • 확인하지 못한 것: 의미 충돌로 main이 실제로 깨졌을 때의 revert 흐름은 문서 규칙만 있고 아직 겪어 보지 않았습니다. 검사 시간 2분은 이 Mac 기준이며, 다른 기기에서는 재지 않았습니다.

…rge result passes the fast checks

Requiring every pull request to contain the latest main sent each green one back through a full verify and the runner queue whenever another merged.
CONTRIBUTING.md now owns when a pull request may merge into main and what happens when main's push run fails, and scripts/premerge-check.py is its check: the latest verify on the head passed, no conflict with main, and the typecheck, Clippy, e2e size budgets and policy structural checks pass on the merge result.
@yansfil
yansfil merged commit 6005ea2 into main Oct 8, 2026
20 checks passed
@yansfil
yansfil deleted the docs/merge-policy branch October 8, 2026 06:08
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