Repository navigation
[CB-0] [sdk-superfan] Catch only expected errors in the extension example's delete checks - #223
Draft
spicysouvlaki wants to merge 1 commit into
Draft
spicysouvlaki wants to merge 1 commit into
spicysouvlaki wants to merge 1 commit into
Conversation
…n proof Both post-delete checks raised AssertionError inside a `try` whose `except Exception` caught it, so an unexpected success printed "failed ... as expected". Any other failure did too: on the dev API the session-create check first hit `RateLimitError 429 ... max concurrent sessions` and would have "passed". Measured on api.dev.browserbase.com after deleting an extension: - `extensions.retrieve(id)` -> NotFoundError 404 - `sessions.create(extension_id=id)` -> BadRequestError 400 "Extension ID not found" Catch exactly those. The AssertionError and any other error now propagate. examples/ is custom code (not generated). The example is not wired into examples/e2e/test_playwright.py, and it cannot run end to end on the dev key (it creates a `proxies=True` session, which that plan rejects with 402), so the check was exercised with a throwaway harness that stubs the client: before 3 failed / 1 passed, after 4 passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What happened
#180. The example's checks after deleting an extension catch their own
AssertionErrorwithexcept Exception, so any outcome prints "... as expected".Why
playwright_extensions.py:125-140: theraise AssertionErrorsits inside thetry. On dev, the session check first returned429 ... max concurrent sessions, which the old code also counts as a pass (measured).Fix
Catch only the errors the API actually returns, both measured on dev:
retrieveraisesNotFoundError(404) andsessions.createraisesBadRequestError(400, "Extension ID not found").Tests
run(). Before the fix: 3 failed, 1 passed. After: 4 passed. It covers the expected errors, an unexpected success on each check, and a 429../scripts/lint: clean../scripts/test(py3.9 pydantic v2/v1, py3.14): all pass.proxies=Truesession returns 402 on the dev plan, andexamples/e2e/test_playwright.pydoesn't import this example.Risk and rollout
examples/is custom code, so this has no Stainless impact and nothing ships.Fixes #180
🤖 Generated with Claude Code