Skip to content

⚡ Bolt: [성능 개선] SARIF 룰 인덱스 조회 O(1) 최적화 - #1394

Open
seonghobae wants to merge 1 commit into
developfrom
bolt-sarif-index-optimization-17196489606492966400
Open

seonghobae wants to merge 1 commit into
developfrom
bolt-sarif-index-optimization-17196489606492966400

Conversation

@seonghobae

@seonghobae seonghobae commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

💡 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


Devin Review

Summary by CodeRabbit

  • 개선 사항
    • SARIF 결과 생성 시 규칙 인덱스를 더 효율적으로 조회합니다.
  • 문서
    • 규칙 인덱스 조회를 최적화하는 방법에 관한 내용을 추가했습니다.

@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a481ce31-8657-404d-a199-25182aa3d8f4
📥 Commits

Reviewing files that changed from the base of the PR and between 2949d30 and 14e0131.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • appguardrail_core/sarif.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

findings_to_sarif는 규칙 인덱스를 딕셔너리에 저장하고 ruleIndex 조회에 사용합니다. .jules/bolt.md에는 반복적인 목록 검색의 비용과 별도 인덱스 매핑 사용에 관한 내용을 추가했습니다.

Changes

SARIF 규칙 인덱스 조회

Layer / File(s) Summary
규칙 인덱스 저장 및 조회
appguardrail_core/sarif.py, .jules/bolt.md
새 규칙의 인덱스를 rule_indices에 저장합니다. 결과의 ruleIndex는 이 딕셔너리에서 조회합니다. 문서에는 반복적인 목록 검색과 별도 인덱스 매핑에 관한 내용을 추가합니다.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 14e01

The lookup optimization preserves the SARIF rule-index behavior; no actionable merge-blocking risk remains.

Architecture Summary

Architecture risk: 🔵 Low · up to 14e01

The change affects 1 system.

Changed systems: appguardrail_core

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — appguardrail_core (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in appguardrail_core/sarif.py: Pridėtas rule_indices žodynas: pirmą kartą aptikus rule_id, jam priskiriamas tuo metu esantis taisyklių skaičius.
  • observed — Modified behavior in appguardrail_core/sarif.py: ruleIndex dabar gaunamas iš rule_indices žodyno, o ne ieškant rule_id pozicijos rules sąraše.
  • observed — Modified behavior in .jules/bolt.md: 반복문에서 list(dict).index()를 사용해 O(N²) 조회가 발생하는 사례와, 별도 인덱스 매핑으로 O(1) 조회를 유지하는 조치를 문서 항목으로 추가했습니다.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 SARIF 규칙 인덱스 조회를 O(1)로 최적화하는 주요 변경 사항을 명확하게 설명합니다.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant