Repository navigation
test(e2e): run the Python SDK contract suite against the gateway - #2778
Merged
Merged
Conversation
The chain, node, publisher/owner and gateway setup of the TypeScript SDK contract run moves from tests/gateway_sdk.rs into the always-compiled decdn_e2e::sdk_contract module. A Suite trait names one SDK's contract suite and how to run it against a fixture file; TypeScript implements it with the same vitest invocation and JSON report as before. run() wraps the heavy timeout tier and enforces that every collected test passed. tests/gateway_sdk.rs keeps its two tests, each now one call to sdk_contract::run. blake3 moves to [dependencies] for Content::new. Indexing that clippy flags in library code becomes Value::get / Map::insert and hashes.first()/last(). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Python SDK's contract suite runs under pytest, which reports its counts as JUnit XML. sdk_contract::junit reads the tests, failures, errors and skipped counts from the report's first <testsuite> start tag with no XML parser and no new crate, and fails naming a missing tag or attribute or a non-numeric value. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sdk_contract::Python runs decdn/sdk-python's tests/contract/test_*.py files with pytest under uv, from the checkout DECDN_SDK_PYTHON_DIR names, and reads its counts from the JUnit report. Python::from_dir requires an absolute checkout with a uv.lock and a synced .venv, and a uv that runs. The gateway_sdk_python target runs both modes with it, behind the anvil-e2e and sdk-e2e features. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Python suite runs every contract test once per client flavour (sync
and async) against one gateway. The flavours must not share a namespace
pointer or a delegate's capability, or one flavour sees the other's
state.
The public run now creates two namespaces for the publisher key and
writes them as `pointer.namespaces` (decimal strings);
`pointer.namespace` stays the first. The loopback run mints two
delegates, assigns each a capability from the one pool, and writes
`capabilities: [{host, capability}]` for example.com and example.net;
`host` and `capability` stay the first. The post-suite checks now
require the state of each flavour the suite runs. The fixture assembly
moves into pure helpers with unit tests.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add the anvil-e2e-sdk-python job, the .github/sdk-python.sha pin, and extend the no-retry nextest override to gateway_sdk_python. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Rename the CONTRIBUTING section to SDK contract runs, add the Python block, and name both targets in CLAUDE.md and the e2e rustdoc. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the Python SDK contract-testing changes.
No open issues 🎉
What changed in this PR
Adds Python SDK contract testing against a real decdn gateway, alongside the existing TypeScript suite, to catch differences between SDK expectations and gateway behavior.
Changes:
- Extracts shared gateway setup into a reusable harness with TypeScript and Python runners.
- Adds separate namespaces and capabilities for Python’s synchronous and asynchronous clients, plus fixture and report-validation tests.
- Adds a pinned Python SDK CI job, no-retry configuration, and documentation for both SDK runs.
| File | Description |
|---|---|
crates/e2e/tests/gateway_sdk.rs |
Delegates TypeScript tests to the shared harness. |
crates/e2e/tests/gateway_sdk_python.rs |
Adds Python public and loopback gateway tests. |
crates/e2e/src/timeout.rs |
Documents the Python suite’s timeout tier. |
crates/e2e/src/sdk_contract/tests.rs |
Tests fixture shapes, report counts, and harness validation. |
crates/e2e/src/sdk_contract/junit.rs |
Reads pytest’s JUnit result counts. |
crates/e2e/src/sdk_contract.rs |
Implements shared setup, SDK runners, and post-suite checks. |
crates/e2e/src/lib.rs |
Exports and documents the shared harness. |
crates/e2e/Cargo.toml |
Registers the Python target and promotes the shared hash dependency. |
CONTRIBUTING.md |
Documents setup, execution, and pin updates for both SDKs. |
CLAUDE.md |
Updates the project overview for both SDK contract suites. |
.github/workflows/sdk-contract.yml |
Adds the Python SDK job with cache saving disabled. |
.github/sdk-python.sha |
Pins the Python SDK revision used in CI. |
.config/nextest.toml |
Applies the contract-suite timeout and no-retry policy to Python. |
Review effort: Balanced
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 4 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
This was referenced Oct 30, 2026
thiras
added a commit
to decdn/sdk-typescript
that referenced
this pull request
Oct 30, 2026
decdn/decdn#2778 moved the SDK contract harness into `crates/e2e/src/sdk_contract.rs`; `crates/e2e/tests/gateway_sdk.rs` is now a thin caller, so `scripts/decdn-contract.sh` keeps its existence check and only its comment changes. This updates the README, CONTRIBUTING and the contract suite comments that named the old file as the fixture writer. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.1 <[email protected]>
thiras
added a commit
to decdn/sdk-python
that referenced
this pull request
Oct 30, 2026
decdn/decdn#2778 moved the SDK contract harness into `crates/e2e/src/sdk_contract.rs`; the `gateway_sdk*` test targets are thin callers. This updates the README and the contract suite docstrings that named the old file as the fixture writer. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.1 <[email protected]>
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.
What
Runs the Python SDK's contract suite (decdn/sdk-python) against a real
decdn gatewayin CI, the way the TypeScript suite already runs, at the commit.github/sdk-python.shapins.decdn_e2e::sdk_contract: the setup that lived incrates/e2e/tests/gateway_sdk.rsmoves into the library behind aSuitetrait (Mode,Outcome,run).TypeScriptkeeps today's vitest invocation;Pythonrunsuv run --frozen --no-sync pytest … --junit-xmland reads the JUnit counts with a dependency-free attribute scanner.tests/gateway_sdk.rsand the newtests/gateway_sdk_python.rsare thin test targets behindanvil-e2e+sdk-e2e.pointer.namespaces; the loopback run mints two delegates onexample.comandexample.netand writescapabilities. Index 0 equals the legacypointer.namespace/host/capability. The Python suite runs every contract test for bothClientandAsyncClientagainst the one gateway, each flavour on its own state; the post-suite checks cover each flavour the suite ran.anvil e2e (sdk contract, python), in.github/workflows/sdk-contract.yml, with the same restore-only caching as the TypeScript job;.config/nextest.tomlgives the new binary the same no-retry override.CONTRIBUTING.md § SDK contract runs(both SDKs),CLAUDE.md, rustdoc.No issue to close: this is the decdn half of the Python SDK work tracked in
decdn/sdk-python.Reviewer notes
Read
crates/e2e/src/sdk_contract.rsfirst:public/loopbackare the old test bodies moved verbatim (git diff --color-movedshows it; the only rewrites arehashes[0]/[len-1]→first()/last()andValueindexing →get, for the library lint policy), then theSuiteimpls at the top. The fixture JSON written for the TypeScript suite is unchanged apart from the two added fields, so sdk-typescript needs no change. Risk: the loopback run now mints two delegates and the public run creates two namespaces for both suites; the TypeScript run pays for one unused entry each (≈1 s).Follow-ups outside this repo: both SDK repos link
crates/e2e/tests/gateway_sdk.rsas the fixture writer; after this merges, the writer iscrates/e2e/src/sdk_contract.rs, so each gets a one-line docs PR. On a timed-out run,kill_on_dropkillsuv runbut not the pytest it spawned (it exits on its own 60 s test timeout); spawning.venv/bin/python -m pytestdirectly would close that, a small follow-up.Verification
Commands run locally (each with the workspace build cache):
cargo nextest run -p decdn-e2e: 67 passed (JUnit scanner, fixture shape,Python::from_dirchecks).DECDN_SDK_PYTHON_DIR=… cargo nextest run -p decdn-e2e --features anvil-e2e,sdk-e2e --test gateway_sdk_python→ 2 passed (pytest 28 public + 22 loopback, all passed);DECDN_SDK_DIR=… … --test gateway_sdk→ 2 passed, unchanged.cargo fmt -- --check,CARGO_BUILD_WARNINGS=deny cargo doc -p decdn-e2e --no-deps --document-private-items,actionlint: clean.Always:
pre-commit run --all-filesCARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-featurescargo nextest run(thedecdn-e2ecrate; the rest of the workspace is untouched and CI runs it)Only if touched: none of the listed areas. Not a user-visible change, so no
CHANGELOG.mdentry.After merge
anvil e2e (sdk contract, python)as a required check in themainbranch ruleset.harness-floor, which turns on its weekly released-gateway run.🤖 Generated with Claude Code