Skip to content

fix: honor environment overrides when copying clients - #796

Draft
Kayvan-Zahiri wants to merge 1 commit into
lithic-com:mainfrom
Kayvan-Zahiri:codex/copy-environment-routing
Draft

Kayvan-Zahiri wants to merge 1 commit into
lithic-com:mainfrom
Kayvan-Zahiri:codex/copy-environment-routing

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

Problem

client.with_options(environment="sandbox") and client.copy(environment="sandbox") keep using the original production URL. The copy constructor unconditionally receives self.base_url, whose explicit value takes precedence over the requested environment. Switching from sandbox to production has the same problem. Both sync and async clients are affected.

Change

When an environment is explicitly selected and no custom base URL is supplied, let the constructor resolve that environment's URL. Continue inheriting the original URL for ordinary copies, and preserve an explicitly supplied custom base URL's precedence.

Add12 regressions. Eight captured public cards.list() request cases exercise production↔sandbox switches through both copy and with_options, sync and async. Four controls verify custom URL overrides and ordinary-copy inheritance. All requests use an HTTPX MockTransport with dummy credentials; no Lithic service is contacted. The original client also retains its original URL.

Before the fix:8 fail,4 pass. After:all12 pass.

Validation

  • Full offline SDK suite on Python3.9:503 passed.
  • Prescribed Nox Pydantic1 compatibility session:490 passed,13 skipped.
  • Existing webhook suite:8 passed.
  • Full Ruff,Pyright,Mypy562 source files,formatting and whitespace checks pass.
  • Wheel and sdist build successfully.
  • API-resource contract tests requiring Prism were excluded.

CONTRIBUTING.md permits persisted manual changes in generated modules; maintainers may also wish to propagate this to the generator.

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