Repository navigation
fix(account): close DB broker HTTP errors (#2330 to stage) - #2366
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughHTTP error handlers now close response bodies before raising or retrying. The handlers preserve status codes and existing error behavior. Tests verify closure across DB broker, Microsoft 365 authentication, Graph requests, and OneDrive uploads. ChangesHTTP error response cleanup
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The cleanup preserves existing error behavior while releasing failed HTTP responses across the targeted paths. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The linked issue is
✨ Finishing Touches 💡 1📝 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 |
🤖 Internal: Discord sync markerAuto-managed by the Discord notification workflow. Stores the linked Discord message ID and forum thread ID. Do not edit or delete. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
asclearuc
left a comment
There was a problem hiding this comment.
Thanks @kgarg2468 — correct fix, and the test is the right one: asserting response_body.closed pins the actual resource behaviour instead of re-checking the error message. Capturing e.code before e.close() and keeping from e preserves the existing error contract exactly.
This is the byte-identical port of #2330 onto stage (I compared the two diffs; they match exactly), so the review below is the same one I left on #2330.
Note on CI: the three Build jobs were still running when I wrote this, so the review is against code whose build and test results are not in yet. Nothing is red.
Approve
One non-blocking should fix is inline: four other HTTPError handlers in the repo drop the response the same way, and it may be worth deciding now whether to widen the fix or file a follow-up.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@asclearuc this final head is the exact two-commit stage port of merged develop #2330. CodeRabbit is clean, CI is green, the Microsoft 365/account regression suite passes 147/147, and there are no unresolved threads. Please re-review the final head. |
joshuadarron
left a comment
There was a problem hiding this comment.
Approve.
Verified this is a byte-identical port of merged develop #2330 (diffed both gh pr diff outputs — no delta), so the review carries over and port parity is intact.
Checked the fix rather than just the summary:
- All five handlers capture
exc.codeinto a local beforeclose(), and keepfrom exc, so status codes and the exception chain are unchanged. detailis computed inside the innertryand the close happens in the enclosingfinally— read-then-close ordering is right in bothgraph_client.request()andonedrive.upload_chunk().- The retry branch closes after the
Retry-Afterread.exc.headersis backed byhdrs, notfp, so closing there is safe and the backoff math is untouched. HTTPError(..., fp=None).close()is a no-op-safe on Python 3.10+ (__init__substitutes an emptyBytesIO), so the tests still passingfp=None— e.g.test_retries_429_with_http_date_retry_after_falls_back_to_backoff— don't regress.
The tests are the right shape: asserting body.closed pins the resource behaviour instead of re-asserting the error message, and _http_error() supplies a real fp so retry_error.fp.closed is meaningful.
CI is green on all three Build platforms plus Ruff and gitleaks, all review threads are resolved, and the earlier should fix about the sibling handlers was addressed in 6b07641.
Non-blocking follow-up (deliberately not for this PR — widening it would break port parity with #2330): the same read-without-close pattern is still present outside the Microsoft 365 / account surface:
nodes/src/nodes/tool_mcp_client/mcp_streamable_http_client.py:153(405 path returns without closing)nodes/src/nodes/tool_mcp_client/mcp_streamable_http_client.py:241and:268— both go through_safe_read_http_error(), which reads the body but never closes itpackages/client-common/python/src/rocketride_common/provision.py:121packages/client-python/src/rocketride/_app_scaffold.py:803
Worth a separate issue against develop so stage stays a clean port line.
Merge per the release-coordination note so the SaaS engine pin advances in the same window.
Summary
Type
fix (stage port)
Testing
./builder test:fast lint:check surfaces:checknot run locally; GitHub CI is the final repository-wide gateChecklist
Agent context
OpenAI Codex (gpt-5.6-sol) / T3 Code, autonomous under explicit approval. Focused tests and develop/stage patch parity were verified locally; engine-dependent builder suites remain delegated to GitHub CI.
Paired PR
Develop: #2330
Release Coordination
Merge with the release owner so the SaaS engine pin advances in the same release window.
Linked Issue
Fixes #2324
Summary by CodeRabbit