feat: return annotation creation outcome - #4412
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe SDK now reports annotation delivery outcomes through ChangesAnnotation delivery outcomes
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant UserFeedback
participant BaseAnnotation
participant HTTPClient
UserFeedback->>BaseAnnotation: create annotation
BaseAnnotation->>HTTPClient: POST with raise_on_error=True
HTTPClient-->>BaseAnnotation: response or exception
BaseAnnotation-->>UserFeedback: AnnotationCreateResult
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 `@packages/traceloop-sdk/traceloop/sdk/client/http.py`:
- Around line 36-37: Update the response-handling method containing
raise_on_error so that after raise_for_status(), ValueError from response.json()
is caught and the method returns response.text or None instead of re-raising.
Preserve HTTP error propagation when raise_for_error applies, and add a
regression test covering a successful response with an empty or non-JSON body.
🪄 Autofix
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: 086ab2e4-57b2-44a1-8483-2d172fe17d3f
📒 Files selected for processing (5)
packages/traceloop-sdk/tests/test_http_client_post.pypackages/traceloop-sdk/tests/test_user_feedback.pypackages/traceloop-sdk/traceloop/sdk/annotation/base_annotation.pypackages/traceloop-sdk/traceloop/sdk/annotation/user_feedback.pypackages/traceloop-sdk/traceloop/sdk/client/http.py
Summary
Adds structured outcomes for annotation creation so callers can distinguish between successful delivery, server refusal, and transport failures.
Changes
AnnotationCreateStatuswithDELIVERED,REFUSED, andUNREACHABLEstates.AnnotationCreateResultcontaining status, response payload, HTTP status code, and error details.BaseAnnotation.create()to return structured results.UserFeedback.create()to expose the result.raise_on_errorsupport toHTTPClient.post()while preserving existing behavior by default.Validation
npx nx run traceloop-sdk:lint— passedmypy traceloop/sdk— passedThe three full-suite failures are unrelated to these changes:
WinError 32)test_manual_reportSummary by CodeRabbit
New Features
Bug Fixes