feat: 인바운드 안전 SDK 래퍼 — 인젝션 신호 + 발신자 규칙 (#369/#370) - #4
Conversation
- Message: injection_score / injection_categories(#369 프롬프트-인젝션 휴리스틱 신호). - inbound_rules 리소스(#370): list/create/remove — 발신자 allow/block(per-mailbox/org-wide). - InboundSenderRule 모델 + 패키지 export. 버전 0.2.0 → 0.3.0. - 테스트 4(인젝션 파싱·규칙 CRUD), README 인바운드 안전 섹션. ruff/mypy clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 53 minutes and 59 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. 📝 WalkthroughWalkthroughThe PR adds inbound safety documentation, inbound message heuristic fields, a new ChangesInbound safety and sender rules
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@loftbox/client.py`:
- Around line 439-451: The pagination cursor name in InboundSenderRule list
methods is inconsistent with the rest of the client API. Update
InboundSenderRules.list to use cursor instead of before, and make the same
change in _Suppressions.list so callers can pass the Page.next_cursor value
through consistently. Keep the request parameter mapping aligned in the shared
list method implementations and preserve the existing Page model behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2f5b95c9-525b-4979-91e7-9cb600aab51f
📒 Files selected for processing (6)
README.mdloftbox/__init__.pyloftbox/client.pyloftbox/models.pypyproject.tomltests/test_client.py
| def list( | ||
| self, | ||
| *, | ||
| mailbox_id: Optional[str] = None, | ||
| limit: Optional[int] = None, | ||
| before: Optional[str] = None, | ||
| ) -> Page[InboundSenderRule]: | ||
| raw = self._c._request( | ||
| "GET", | ||
| "/v1/inbound-rules", | ||
| params={"mailbox_id": mailbox_id, "limit": limit, "before": before}, | ||
| ) | ||
| return _page(raw, InboundSenderRule) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect all list() signatures and pagination param usage across resources.
rg -nP '\bdef list\s*\(' loftbox/client.py -A 8
rg -nP '\b(before|after|cursor|next_cursor)\b' loftbox/client.py loftbox/models.pyRepository: TheMagicTower/loftbox-sdk-python
Length of output: 3767
Inconsistent pagination parameter naming
The InboundSenderRules.list and _Suppressions.list methods use before as the pagination cursor parameter, whereas Agent, Folder, and Thread list methods use cursor. Additionally, the Page model explicitly exposes next_cursor, creating a naming mismatch for callers attempting to chain pages (e.g., next_cursor vs before). Align the input parameter name to cursor across all list methods for consistency.
def list(
self,
*,
mailbox_id: Optional[str] = None,
limit: Optional[int] = None,
- before: Optional[str] = None,
+ cursor: Optional[str] = None,
) -> Page[InboundSenderRule]:
raw = self._c._request(
"GET",
"/v1/inbound-rules",
- params={"mailbox_id": mailbox_id, "limit": limit, "before": before},
+ params={"mailbox_id": mailbox_id, "limit": limit, "cursor": cursor},
)
return _page(raw, InboundSenderRule)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| def list( | |
| self, | |
| *, | |
| mailbox_id: Optional[str] = None, | |
| limit: Optional[int] = None, | |
| before: Optional[str] = None, | |
| ) -> Page[InboundSenderRule]: | |
| raw = self._c._request( | |
| "GET", | |
| "/v1/inbound-rules", | |
| params={"mailbox_id": mailbox_id, "limit": limit, "before": before}, | |
| ) | |
| return _page(raw, InboundSenderRule) | |
| def list( | |
| self, | |
| *, | |
| mailbox_id: Optional[str] = None, | |
| limit: Optional[int] = None, | |
| cursor: Optional[str] = None, | |
| ) -> Page[InboundSenderRule]: | |
| raw = self._c._request( | |
| "GET", | |
| "/v1/inbound-rules", | |
| params={"mailbox_id": mailbox_id, "limit": limit, "cursor": cursor}, | |
| ) | |
| return _page(raw, InboundSenderRule) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@loftbox/client.py` around lines 439 - 451, The pagination cursor name in
InboundSenderRule list methods is inconsistent with the rest of the client API.
Update InboundSenderRules.list to use cursor instead of before, and make the
same change in _Suppressions.list so callers can pass the Page.next_cursor value
through consistently. Keep the request parameter mapping aligned in the shared
list method implementations and preserve the existing Page model behavior.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
core #377(#369 인젝션 스캐너) + #378(#370 발신자 allow/block)의 Python SDK 래퍼.
변경
Message:injection_score(0~1) +injection_categories(#369) — 수신 메일 프롬프트-인젝션 휴리스틱 신호(차단 아님, 에이전트가 판단).client.inbound_rules(#370):list/create/remove— 발신자 allow/block(per-mailbox/org-wide).InboundSenderRule모델.검증
17 pytest 통과, ruff·mypy clean.
Summary by CodeRabbit
New Features
Bug Fixes
Chores