Skip to content

Merge to beta - #1900

Merged
jar-stripe merged 7 commits into
betafrom
jar/merge-python-beta
Aug 31, 2026
Merged

Merge to beta#1900
jar-stripe merged 7 commits into
betafrom
jar/merge-python-beta

Conversation

@jar-stripe

@jar-stripe jar-stripe commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Why?

Routine merge of master into the beta release channel.

What?

Merged master into beta via sdk-codegen automerge (tools/automerge/python-beta.yaml).

One manual resolution: the urllib.parse import in stripe/_util.py, taken from master to keep urlsplit, which master's new validate_path calls. beta's only change there was a deleted blank line.

See Also

jar-stripe and others added 7 commits August 28, 2026 16:43
* Add discriminated union serialization tests

Tests discriminated union type shapes for both request-side (TypedDict
params with Literal discriminator) and response-side (StripeObject
deserialization), covering standalone and inline variants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude

* Clarify test docstring scope and dict() comment

The module docstring now explicitly states these tests exercise runtime
semantics (dict construction, field access, round-trip), not static type
narrowing. The dict() comment explains what it's actually testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude

* Rewrite DU tests: correct inline pattern + route through _api_encode

Inline union tests now use the flattened TypedDict pattern (discriminator
and per-variant payload fields on the parent) rather than the incorrect
per-variant TypedDicts-with-type-field pattern that was there before.

Request-side tests now exercise `_api_encode` so they verify real SDK
encoding behavior (bracket notation, nested dicts) rather than just dict
construction and key lookup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude

* Dispatch discriminated union fields to their variant class

A discriminated union field arrived as a dict with no class attached, so it
became a bare StripeObject. That object carries no `_field_encodings`, so an
int64 or decimal field inside a variant stayed a string — `luminance` came
back as "1500" rather than 1500.

Codegen already emits `_inner_class_union_variant_types` on the parent
(`{"color": ("model", {"rgb": RgbColor, ...})}`); nothing read it. Consume it
in `_update_attributes` so the discriminator inside the value selects the
variant class, which then applies its own encodings.

Mirrors stripe-ruby#1923. Falls back to a plain StripeObject when the
discriminator is absent, is not a string, or names a variant this release
does not know, so a variant the API adds later still deserializes.

Rewrites tests/test_discriminated_unions.py, which could not detect any of
this: every response-side test ran `StripeObject.construct_from` on the base
class with no variant map, so all seven passed identically against `{"foo":
1}`. The fixtures now mirror the generated shape — two color variants with
*different* encodings — so identical wire bytes hydrate differently based
only on the discriminator. Seven of the 24 tests fail with the dispatch line
reverted.

The request side moves from `_api_encode` to `_coerce_v2_params`.
`_api_encode` is v1 form encoding, which treats any dict identically and so
asserted nothing about unions; v2 requests coerce through the method-level
schema. One test pins the generator's deliberate flattening of variants into
one field-name-keyed map.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Committed-By-Agent: claude

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Replace --quiet with stdout redirection. Ruff's --quiet flag suppresses
all output including parse errors (e.g. merge markers), making format
failures in CI impossible to diagnose. Redirecting stdout to /dev/null
suppresses the file list but lets errors (which go to stderr) through.


Committed-By-Agent: claude

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
private-preview's ci.yml differs from master's by one additive hunk:
`private-preview` in `on.push.branches`.

Because that hunk lives only on private-preview, every merge of master into
private-preview yields a workflow blob matching neither parent. GitHub refuses a
push from a GitHub App lacking `workflows` permission when it introduces a
workflow blob that does not already exist in the repository, so the codegen repo's
Codegen job's push to latest-codegen-private-preview is rejected and a human has
to perform the merge by hand. Holding the hunk on master too means both sides of
the merge carry the same change, the merge result is byte-identical to master's
blob, and the App only ever carries an already-committed file forward.

The hunk is a no-op on master. For a push event the workflow file comes from the
pushed ref, so master's copy listing private-preview is never consulted for a
push to private-preview, and it cannot affect pushes to master or beta.
`on.pull_request.branches` already lists private-preview.


Committed-By-Agent: claude

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* Add open vs closed enum section to README

* Put type sig in code block
…1898)

* swap to a secure multipart boundary

* use monkeypatch insteado of bare assignment

* remove unneded comments
* validate that incoming urls don't redirect requests

* shorten comments
Committed-By-Agent: claude

# Conflicts:
#	stripe/_util.py
@jar-stripe
jar-stripe marked this pull request as ready for review August 31, 2026 23:42
@jar-stripe
jar-stripe requested a review from a team as a code owner August 31, 2026 23:42
@jar-stripe
jar-stripe requested review from zacchua-stripe and removed request for a team August 31, 2026 23:42
@jar-stripe
jar-stripe enabled auto-merge August 31, 2026 23:42
@jar-stripe
jar-stripe merged commit d6bc00c into beta Aug 31, 2026
20 checks passed
@jar-stripe
jar-stripe deleted the jar/merge-python-beta branch August 31, 2026 23:46
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.

3 participants