Skip to content

Add conformance runner for the cross-SDK parity suite - #14

Merged
ranael-garem merged 3 commits into
mainfrom
conformance/python-runner
Jul 30, 2026
Merged

Add conformance runner for the cross-SDK parity suite#14
ranael-garem merged 3 commits into
mainfrom
conformance/python-runner

Conversation

@ranael-garem

Copy link
Copy Markdown
Contributor

Adds conformance/run.py — the Python SDK's runner for the cross-SDK behavioral-parity suite (connect-sdk-conformance).

The runner reads one scenario on stdin, drives the real SDK entrypoint for the scenario's surface, and prints a normalized decision on stdout — the exact mirror of the TypeScript runner. It covers all four surfaces:

  • verifyverify_license_token
  • enforceSupertabConnect.handle_request
  • customer-obtainobtain_license_token
  • customer-match → the same private selection helpers obtain_license_token uses (_parse_content_elements_find_serverless_usage_content_find_best_matching_content), since there is no single public "match this request" entrypoint.

Wired into the suite, the first two-SDK run is fully green — the Python SDK reaches identical decisions to TypeScript across the whole corpus, no overrides needed.

Additive only: one new file, no changes to SDK source.

🤖 Generated with Claude Code

@ranael-garem
ranael-garem requested a review from Copilot July 30, 2026 12:15
@ranael-garem
ranael-garem marked this pull request as ready for review July 30, 2026 12:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a Python conformance runner (conformance/run.py) intended to execute a single cross-SDK parity scenario (read from stdin), invoke the corresponding real SDK surface, and emit a normalized JSON decision to stdout—mirroring the TypeScript conformance runner behavior.

Changes:

  • Introduces a scenario-driven runner that supports verify, enforce, customer-obtain, and customer-match.
  • Normalizes enforcement outputs by extracting key RSL headers into a stable shape.
  • Implements customer-match by calling the same internal selection helpers used by obtain_license_token.
Comments suppressed due to low confidence (1)

conformance/run.py:105

  • SupertabConnect.set_base_url(MOCK_ORIGIN) has no effect on obtain_license_token() (it doesn’t consult the merchant client base URL). Dropping this avoids an unnecessary global state mutation.
async def _customer_obtain(inp: dict) -> dict:
    SupertabConnect.set_base_url(MOCK_ORIGIN)
    try:

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

Comment thread conformance/run.py
Comment on lines +117 to +131
async def _main() -> None:
scn = json.loads(sys.stdin.read())
surface = scn["surface"]
inp = scn["input"]
if surface == "verify":
out = await _verify(inp)
elif surface == "enforce":
out = await _enforce(inp)
elif surface == "customer-match":
out = _customer_match(inp)
elif surface == "customer-obtain":
out = await _customer_obtain(inp)
else:
raise SystemExit(f"unhandled surface: {surface}")
sys.stdout.write(json.dumps(out))
Comment thread conformance/run.py
_enforce configures supertab_base_url on the instance; obtain_license_token
derives its origin from resource_url. Neither consults the global base URL,
so the set_base_url mutations were redundant/dead. (Copilot review.)
@ranael-garem
ranael-garem merged commit 8f8bdef into main Jul 30, 2026
3 checks passed
@ranael-garem
ranael-garem deleted the conformance/python-runner branch July 30, 2026 13:18
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.

2 participants