fix: keep the code of version 6 working and document what still breaks - #161
Merged
Merged
Conversation
The clients gained arguments and errors gained types since version 6, and some of that broke code that had no reason to break. Three changes give it back without giving up what the new behaviour is for: - availability sat between item_page and condition in search_items, so a caller not using keywords bound every following value to the wrong argument, silently. It moves to the end and becomes keyword only, which also keeps it from displacing anything in the future. - A request that fails to authenticate or is denied raised RequestError before it got its own type, so AuthenticationError and AccessDeniedError become subclasses of it. - An invalid value raised the ValidationError of pydantic or a plain ValueError, both ValueError subclasses, so InvalidArgumentError becomes one too. An unsupported version now raises it as well, instead of the plain ValueError it kept for no reason. The signatures of both clients and the hierarchy of the errors are pinned by tests, as they are the promise this commit is making. What is left breaking is what cannot be given back without restoring a bug, and is now covered by a migration guide: the errors mapped from the response, the values the async client no longer sends unvalidated, the items not found, the timeout and the retries of the requests, the ASIN of a malformed URL and the configuration each client keeps for itself. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017bWGetbCpBr2upxna7R5QV
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.
The clients gained arguments and errors gained types since version 6, and
some of that broke code that had no reason to break. Three changes give it
back without giving up what the new behaviour is for:
caller not using keywords bound every following value to the wrong
argument, silently. It moves to the end and becomes keyword only, which
also keeps it from displacing anything in the future.
before it got its own type, so AuthenticationError and AccessDeniedError
become subclasses of it.
ValueError, both ValueError subclasses, so InvalidArgumentError becomes
one too. An unsupported version now raises it as well, instead of the
plain ValueError it kept for no reason.
The signatures of both clients and the hierarchy of the errors are pinned
by tests, as they are the promise this commit is making.
What is left breaking is what cannot be given back without restoring a bug,
and is now covered by a migration guide: the errors mapped from the
response, the values the async client no longer sends unvalidated, the
items not found, the timeout and the retries of the requests, the ASIN of a
malformed URL and the configuration each client keeps for itself.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_017bWGetbCpBr2upxna7R5QV