Skip to content

Merge to beta#1753

Merged
xavdid-stripe merged 4 commits intobetafrom
xavdid/merge-python-beta
Mar 10, 2026
Merged

Merge to beta#1753
xavdid-stripe merged 4 commits intobetafrom
xavdid/merge-python-beta

Conversation

@xavdid-stripe
Copy link
Member

Why?

What?

See Also

@xavdid-stripe xavdid-stripe requested a review from a team as a code owner March 10, 2026 17:44
@xavdid-stripe xavdid-stripe requested review from prathmesh-stripe and removed request for a team March 10, 2026 17:44
@xavdid-stripe xavdid-stripe enabled auto-merge March 10, 2026 17:44
@xavdid-stripe xavdid-stripe merged commit 4c1a72d into beta Mar 10, 2026
23 checks passed
@xavdid-stripe xavdid-stripe deleted the xavdid/merge-python-beta branch March 10, 2026 18:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR appears to sync changes into the beta branch by updating event-fetch request behavior and a few release/tooling metadata bits in the Stripe Python SDK.

Changes:

  • Add a Stripe-Request-Trigger: event=<event_id> header to requests made when fetching events and their related objects (sync + async) across v1/v2 event notification types.
  • Update the v2 event integration test to assert the new request header is sent.
  • Extend AI agent environment-variable detection for User-Agent reporting, add a just prepare convenience target, and update the changelog.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_v2_event.py Asserts Stripe-Request-Trigger is included on event + related-object fetch requests.
stripe/v2/core/_event.py Adds Stripe-Request-Trigger header to EventNotification.fetch_event* and UnknownEventNotification.fetch_related_object*.
stripe/events/_v2_core_event_destination_ping_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_person_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_person_deleted_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_person_created_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_including_requirements_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_including_identity_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_including_future_requirements_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_including_defaults_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_including_configuration_recipient_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_including_configuration_recipient_capability_status_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_including_configuration_merchant_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_including_configuration_merchant_capability_status_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_including_configuration_customer_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_including_configuration_customer_capability_status_updated_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_created_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v2_core_account_closed_event.py Adds Stripe-Request-Trigger header to related-object fetches.
stripe/events/_v1_billing_meter_error_report_triggered_event.py Adds Stripe-Request-Trigger header to related-object fetches for this v1 event type.
stripe/_api_requestor.py Expands AI agent env-var detection list for User-Agent reporting.
justfile Adds prepare target to run format/lint/typecheck/tests locally.
CHANGELOG.md Documents the header addition and AI agent User-Agent update in 14.4.1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object", "unknown_event"],
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as in fetch_event_async(): usage= is passed into StripeClient.raw_request_async, which currently forwards unknown kwargs (including usage) as request params because it doesn’t pop them. This makes async fetch_related_object_async() send an unintended usage parameter to the API.

Suggested change
usage=["fetch_related_object", "unknown_event"],

Copilot uses AI. Check for mistakes.
f"/v2/core/events/{self.id}",
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["pushed_event_pull", "pushed_event_pull_async"],
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetch_event_async() (and other async helpers calling StripeClient.raw_request_async) pass a usage= kwarg, but StripeClient.raw_request_async does not pop/consume usage the way raw_request does. As a result, usage will be forwarded as a request param/query field, which can change request semantics and leak internal instrumentation. Fix by updating StripeClient.raw_request_async to usage = params.pop("usage", ["raw_request"]) and pass that through to request_raw_async, or stop passing usage from these async event methods until the client is fixed.

Suggested change
usage=["pushed_event_pull", "pushed_event_pull_async"],

Copilot uses AI. Check for mistakes.
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