Repository navigation
⚡ Bolt: [성능 개선] SARIF 룰 인덱스 조회 O(1) 최적화 - #1394
seonghobae wants to merge 1 commit into
Conversation
|
👋 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. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesSARIF 규칙 인덱스 조회
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~3 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to The lookup optimization preserves the SARIF rule-index behavior; no actionable merge-blocking risk remains. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
💡 What:
appguardrail_core/sarif.py의findings_to_sarif함수에서 SARIF 규칙 인덱스를 찾을 때list(rules).index(rule_id)를 사용하던 부분을rule_indices라는 별도의 딕셔너리를 사용하여 O(1)로 조회하도록 최적화했습니다. O(1) 조회가 가능하도록 룰이 최초로 발견될 때 딕셔너리에 매핑을 추가합니다.🎯 Why:
기존 코드는 딕셔너리의 키를 리스트로 변환한 뒤
.index()를 호출하여 값을 찾았습니다. 이는 루프 내부에서 실행될 경우 O(N)의 시간이 소요되어 결과적으로 O(N^2)의 시간 복잡도를 가지게 되며, 룰의 수가 많을수록 성능이 크게 저하되는 병목 현상을 유발합니다.📊 Impact:
룰 인덱스 조회의 시간 복잡도를 O(N^2)에서 O(N)으로 개선하여, 발견된 취약점(finding)과 고유한 룰(rule)의 개수가 많은 경우 SARIF 변환 속도를 크게 단축시켰습니다.
🔬 Measurement:
pytest및 전체 테스트 커버리지가 기존 기능을 온전히 유지하면서 통과하는 것을 확인했습니다.PR created automatically by Jules for task 17196489606492966400 started by @seonghobae
Summary by CodeRabbit