CBG-5284 fix hiding SDK exceptions in couchbaseserver.py - #521
Open
torcolvin wants to merge 2 commits into
Open
Conversation
- Remove _try_n_times with a single get_bucket function that uses tenacity retry function - always use raise -> from syntax so we don't drop the exception messages
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
upsert_document_xattr still bypasses the new get_bucket() retry path, reintroducing inconsistent behavior for transient bucket-availability failures.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the Couchbase Server client utilities in the TDK (client/src/cbltest) to avoid masking underlying Couchbase SDK exceptions and to standardize retry behavior by leaning on tenacity and exception chaining (raise … from e).
Changes:
- Removed the legacy
_try_n_timeshelper and migrated bucket/collection readiness polling totenacity-based retries. - Updated several error paths to use exception chaining (
from e) so the original SDK exception context is preserved. - Refactored bucket readiness waiting in
create_bucket()to useretry_assert()with explicit readiness assertions.
File summaries
| File | Description |
|---|---|
| client/src/cbltest/utils.py | Removes _try_n_times in favor of existing tenacity-based retry helpers. |
| client/src/cbltest/api/couchbaseserver.py | Introduces get_bucket() with tenacity retry, adds collection readiness probing via retry, and switches multiple error raises to raise … from e. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Addresses PR review: upsert_document_xattr and delete_document_xattr opened the bucket directly, bypassing the retry policy the other document operations use. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CBG-5284 fix hiding SDK exceptions in couchbaseserver.py
This isn't the cause of the test failure, but we were hiding the real failure in
raise CblTestError(f"Unable to properly create {bucket}.{scope}.{name} in Couchbase Server"). Upcoming PR for the real fix.