Repository navigation
Prefer Supertab-hosted content blocks when minting - #19
Merged
Merged
Conversation
filias
marked this pull request as ready for review
October 16, 2026 14:34
filias
requested review from
nick434434 and
ranael-garem
and
a balanced review from Copilot
October 16, 2026 14:34
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Host classification mishandles explicit default ports and lets malformed unrelated server URLs abort minting.
2 open findings
What changed in this PR
Aligns Python token minting with the TypeScript and PHP SDKs by preferring matching Supertab-hosted content blocks.
Changes:
- Prioritizes Supertab-hosted matches while retaining best-match fallback.
- Adds tests for preference and fallback behavior.
- Documents the change under
[Unreleased].
| File | Description |
|---|---|
| tests/customer/test_tokens.py | Tests provider preference and fallback. |
| supertab_connect/customer/token.py | Adds host-based token endpoint selection. |
| CHANGELOG.md | Documents Supertab-hosted block priority. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
filias
added a commit
that referenced
this pull request
Oct 16, 2026
Moves the Python conformance job from `v0.3.0` to `v0.5.0`. That version adds the no-match and multi-provider customer scenarios (`connect-sdk-conformance#5`). The runner is fixed so it reports what the SDK actually does:
- **`customer-match`** now calls `_select_token_endpoint`, the selector `obtain_license_token` uses. The runner used to call an older helper of its own, and on no match it reported "no token needed" even though the SDK mints license-less against `{baseUrl}/token`. It now reports the Agreement lane in the same shape TS and PHP use: `{matched:false, matched_url_pattern:null, token_server:<base URL>, requires_token:true}`.
- **`customer-obtain`** passes `supertab_base_url=MOCK_ORIGIN`. Without it, a license-less mint went to the production API.
Builds on #19 (merged), which makes the Python SDK prefer Supertab-hosted blocks; the `customer-*--multi-provider-supertab-wins` scenarios rely on it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


When several
<content>blocks match a resource,obtain_license_token()now picks one whoseserveris on thesupertab_base_urlhost before a more specific match from another provider. If no Supertab-hosted block matches, it still falls back to the best match overall.Before this change, Python picked the most specific match regardless of host. A multi-provider
license.xmlcould therefore send the customer's client credentials to a third party's token server even when a Supertab block also matched. TS (selectMintableContent) and PHP (selectTokenEndpoint) already prefer the Supertab host; this brings Python in line.Hosts are compared by hostname and port, case-insensitive, with default ports filled in from the scheme. So
https://api-connect.supertab.co:443/...counts as Supertab, the same as TS'sURL.host. Aserverthat can't be parsed is treated as non-Supertab, so one malformed block elsewhere inlicense.xmlcan't stop a valid match from minting.The new test covers four cases: the Supertab block winning, the fallback when no Supertab block matches, an explicit default port, and an unrelated malformed server. The conformance suite asserts the same thing in
customer-*--multi-provider-supertab-wins(v0.5.0). Those scenarios go green once this lands and the runner PR moves Python's pin tov0.5.0.Released together with the still-unreleased license-less mint (STC-921) under
[Unreleased].