Skip to content

feat: identify SDK requests across unary and streaming transports - #68

Closed
rodnnnney wants to merge 1 commit into
mainfrom
capy/identify-sdk-requests-across
Closed

rodnnnney wants to merge 1 commit into
mainfrom
capy/identify-sdk-requests-across

Conversation

@rodnnnney

@rodnnnney rodnnnney commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • V3 SDK attribution: Send X-TextQL-SDK: python/<version> using package version metadata on generated sync/async requests and the separate Connect unary/streaming transport.
  • Regeneration safe: Register the generated-client behavior through custom hooks, leaving generated transport code untouched.
  • Header preservation: Keep caller client, agent, authentication, and custom user-agent headers while replacing stale SDK markers.

Release Notes

None, internal only

Tests

test_sdk_origin_header_on_transport: generated sync and async request headers
  1. Exercise both clients against the existing recording HTTP transport with absent and stale markers, default and custom user agents, and both server URL forms.
  2. Perform a generated API operation.
  3. Assert the SDK marker reaches the transport while authentication, custom metadata, path, and body remain unchanged.
test_connect_sdk_origin_header_on_transport: Connect unary and streaming headers
  1. Build sync and async Connect clients with recording transports and absent or stale markers.
  2. Make unary and streaming requests.
  3. Assert the outgoing SDK marker and preservation of authentication and caller headers.

Passed: 24 new attribution cases; 46 tests across test_sdk_origin.py, test_hooks.py, and test_httpclient.py; uv build; uv run pyright src/textql_sdk; uv run mypy src/textql_sdk; pylint for both edited source files; git diff --check.

A wider selection including test_basesdk_request_building.py and test_security.py has 73 passes and 3 pre-existing failures: test_default_base_url_and_path_used, test_trailing_slash_on_server_url_override_is_stripped, and test_model_dump_omits_none_api_key. All three reproduce with the unchanged HEAD registration hook (49 passes, 3 failures). They are not modified here.

Compatibility

  • Scope is this v3 Speakeasy SDK and its /rpc/public transports, not the v2 REST API.
  • Backend attribution and gateway support: https://github.com/TextQLLabs/demo2/pull/15984. Deploy the backend/chart before the coordinated SDK releases, particularly for browser clients in the TypeScript SDK.
  • The header contains only SDK language/version and is self-reported analytics metadata, never an authorization signal.

Open in Capy

@capy-ai

capy-ai Bot commented Sep 24, 2026

Copy link
Copy Markdown

Closing unmerged to honor the requested minimal scope. Backend PR TextQLLabs/demo2#15984 now recognizes the v3 Speakeasy SDK's existing User-Agent, so no Python SDK changes or release are needed. Custom-header and streaming additions are intentionally out of scope.

@capy-ai capy-ai Bot closed this Sep 24, 2026
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