⚡ Bolt: opencode_review_approve_gate.sh 정규표현식 사전 컴파일(pre-compile)을 통한 git diff 파싱 최적화#562
⚡ Bolt: opencode_review_approve_gate.sh 정규표현식 사전 컴파일(pre-compile)을 통한 git diff 파싱 최적화#562seonghobae wants to merge 4 commits into
Conversation
scripts/ci/opencode_review_approve_gate.sh에 내장된 Python 스크립트 내 루프 호출 함수(`changed_new_lines`)에서 매번 재컴파일되던 `hunk_header` 정규식을 모듈 레벨로 분리하고 `HUNK_HEADER_RE`로 미리 컴파일하도록 최적화했습니다.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
scripts/ci/opencode_review_approve_gate.sh에 내장된 Python 스크립트 내 루프 호출 함수(`changed_new_lines`)에서 매번 재컴파일되던 `hunk_header` 정규식을 모듈 레벨로 분리하고 `HUNK_HEADER_RE`로 미리 컴파일하도록 최적화했습니다. 또한 해당 변경과 무관하게 실패하고 있던 `test_opencode_existing_approval_gate.py` 내의 artifact 권한 문제(테스트 셋업 중 chmod 누락)도 수정하여 전체 CI가 성공하도록 조치했습니다.
scripts/ci/opencode_review_approve_gate.sh에 내장된 Python 스크립트 내 루프 호출 함수(changed_new_lines)에서 매번 재컴파일되던 hunk_header 정규식을 모듈 레벨로 분리하고 HUNK_HEADER_RE로 미리 컴파일하도록 최적화했습니다. 또한 해당 변경과 무관하게 실패하고 있던 test_opencode_existing_approval_gate.py 내의 artifact 권한 문제(테스트 셋업 중 chmod 누락)도 수정하여 전체 CI가 성공하도록 조치했습니다.
scripts/ci/opencode_review_approve_gate.sh에 내장된 Python 스크립트 내 루프 호출 함수(changed_new_lines)에서 매번 재컴파일되던 hunk_header 정규식을 모듈 레벨로 분리하고 HUNK_HEADER_RE로 미리 컴파일하도록 최적화했습니다. 또한 해당 변경과 무관하게 실패하고 있던 test_opencode_existing_approval_gate.py 내의 artifact 권한 문제(테스트 셋업 중 chmod 누락)도 수정하여 전체 CI가 성공하도록 조치했습니다.
💡 What:
scripts/ci/opencode_review_approve_gate.sh파일 안의 내장 Python 스크립트에서,changed_new_lines함수 내부에 정의되어 있던 정규식re.compile(r"^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@")를 함수 밖 모듈 레벨인HUNK_HEADER_RE로 이동시켰습니다.🎯 Why:
changed_new_lines함수는 여러 변경된 파일에서 루프를 돌며 호출되거나 반복적으로git diff를 파싱할 때 사용되는데, 이 과정에서 정규식을 계속 새로 컴파일하는 작업은 N+1 형식의 불필요한 성능 저하(오버헤드)를 발생시켰습니다. 이를 미리 모듈 레벨에서 컴파일하여 속도를 개선하기 위함입니다.📊 Impact:
모든 변경된 파일들에 대해 git diff의 hunk 헤더를 처리할 때 정규식을 다시 컴파일하는 오버헤드를 줄입니다. 큰 PR에서 여러 파일 변경이 감지될 때 약간의 성능(컴파일 및 메모리 재할당 시간) 개선을 이룰 수 있습니다.
🔬 Measurement:
test_strix_quick_gate.sh,pr_review_merge_scheduler.py등)의 실행이 여전히 성공하는지 확인했습니다.PR created automatically by Jules for task 8943471184524316335 started by @seonghobae