Skip to content

Release 0.3.0: unwrap(unexpected_status_type=), SHELLRENT_TOKEN_CACHE in FileTokenStore, updated spec - #3

Merged
svdigital-development merged 2 commits into
mainfrom
claude/fix-wrap
Oct 1, 2026
Merged

svdigital-development merged 2 commits into
mainfrom
claude/fix-wrap

Conversation

@svdigital-development

Copy link
Copy Markdown
Member

Summary

shellrent-internal-sdk revealed two gaps in this package. This PR also brings in the latest copy of the Shellrent API specification.

  • unwrap(response, *, error_type=None, unexpected_status_type=None): every generated client has its own UnexpectedStatus class. Another client now passes its own, so unwrap() raises the same exception as that client's generated functions. Without the parameter it still raises the UnexpectedStatus of shellrent_sdk.client, so existing calls keep working. The type is Callable[[int, bytes], Exception], so mypy checks the constructor.
  • FileTokenStore() without a directory now reads SHELLRENT_TOKEN_CACHE, like the CLI does: a directory, or off to keep the tokens in memory without writing any file. A directory passed as an argument still wins. The CLI now uses FileTokenStore() directly, so both have one implementation and its behaviour is unchanged.
  • spec/openapi.yaml updated to the latest version and the client regenerated with bin/generate:
    • per_page defaults to 15 instead of 20 in the 56 list operations.
    • list_active_monitoring_products and list_private_cloud_sv_products return ServicePaginatedListResponse. list_cloud_vps_products and list_dedicated_server_products return the new ServiceServerPaginatedListResponse. In all four, meta is a PaginationMeta.
    • ServiceListResponse, ServiceServerListResponse and their *MetaType0 models are removed.
  • README, CLAUDE.md (unexpected_status_type added to the interface used by shellrent-internal-sdk) and CHANGELOG.md, with a [0.3.0] section.

Notes for reviewers

  • Version 0.3.0, not 0.2.1: the regenerated client removes public models and changes the return types of 4 operations. Under CLAUDE.md that is an incompatible change, and with a patch release anyone pinned to ~=0.2.0 would pick up the removals.
  • Default change: code that relies on the per_page default now receives 15 items per page instead of 20.
  • With SHELLRENT_TOKEN_CACHE=off, FileTokenStore.directory is still the default directory, although no file is written there. This keeps the attribute's type (Path) the same.
  • Invalid keys are rejected with off too, so the behaviour does not depend on the environment.

Test plan

  • tests/unit/test_errors.py: another client's UnexpectedStatus for an undocumented status, for a 2xx without a parsed body and for a parsed body outside 2xx. Without unexpected_status_type, the exception is this package's, as in 0.2.0. It is also the default with this package's own types.
  • tests/unit/test_token_store.py: directory from the environment, an explicit directory winning over it, off (any case) keeping the tokens in memory without files and not sharing them with other instances, and OAuth2Auth with off. The default-directory test now clears the variable.
  • tests/unit/test_client.py: the default of per_page is 15.
  • The new tests fail on the previous code.
  • ruff format, ruff check, mypy, pytest (130 passed, 3 integration tests skipped without credentials)
  • Same checks on Python 3.11 with --resolution lowest-direct
  • bin/generate run again gives no diff

🤖 Generated with Claude Code

Tobia Zanarella and others added 2 commits October 1, 2026 14:59
- per_page defaults to 15 instead of 20 in the 56 list operations, as
  in the API.
- list_active_monitoring_products and list_private_cloud_sv_products
  return ServicePaginatedListResponse, list_cloud_vps_products and
  list_dedicated_server_products the new
  ServiceServerPaginatedListResponse, with PaginationMeta as meta.
- ServiceListResponse, ServiceServerListResponse and their MetaType0
  models are removed: an incompatible change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…TokenStore

- unwrap() takes the UnexpectedStatus class of another generated client,
  so that shellrent-internal-sdk raises its own exception instead of the
  one of shellrent_sdk.client. The default is unchanged.
- FileTokenStore() without a directory follows SHELLRENT_TOKEN_CACHE: a
  directory, or "off" to keep the tokens in memory. The CLI now uses it,
  with the same behaviour.
- Released as 0.3.0, not 0.2.1: the regenerated client removes models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@svdigital-development
svdigital-development merged commit ac58671 into main Oct 1, 2026
6 checks passed
@svdigital-development
svdigital-development deleted the claude/fix-wrap branch October 1, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant