Skip to content

Commit c1ab0af

Browse files
test(client): pin behaviour against the last released client
The transport changed; the published behaviour must not. These tests compare against the 1.5.3 client vendored under tests/baseline: constructor and method signatures via AST, the request that goes out, the exceptions that come back, and the exact dict each method returns — the last by running both clients over the same responses. Also stop sending the generated fixed multipart boundary. An uploaded file containing those bytes would corrupt the encoding, so the header is dropped and the transport picks a random boundary, as the previous client did. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014f9oEEYspPH4fmPULTnLkJ
1 parent f68924a commit c1ab0af

5 files changed

Lines changed: 1069 additions & 6 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ lint = [
6868

6969
[tool.ruff]
7070
line-length = 88
71-
# Generated code is overwritten wholesale by tools/gen_sdk.sh, so a lint finding
72-
# there can never be fixed in place.
73-
extend-exclude = ["src/unstract/api_deployments/sdk_docstudio"]
71+
# Generated and vendored code is overwritten wholesale by its refresh script, so
72+
# a lint finding there can never be fixed in place.
73+
extend-exclude = ["src/unstract/api_deployments/sdk_docstudio", "tests/baseline"]
7474

7575
[tool.ruff.lint]
7676
select = ["E", "F", "W", "I"]

src/unstract/api_deployments/client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,10 @@ def structure_file(self, file_paths: list[str]) -> dict:
406406

407407
org_name, api_name = self._deployment_route
408408
request_kwargs = execute._get_kwargs(org_name, api_name, body=body)
409+
# The generated builder pins a fixed multipart boundary in the header. An
410+
# uploaded file containing those bytes would break the encoding, so let
411+
# the transport pick a random boundary instead.
412+
request_kwargs.get("headers", {}).pop("Content-Type", None)
409413
method = request_kwargs.pop("method")
410414
url = request_kwargs.pop("url")
411415

@@ -516,9 +520,7 @@ def check_execution_status(self, status_check_api_endpoint: str) -> dict:
516520
# The generated builder writes every declared query parameter, including
517521
# ones this client has never sent. Keep only what was asked for.
518522
request_kwargs["params"] = {
519-
k: v
520-
for k, v in request_kwargs["params"].items()
521-
if k in _STATUS_SEND_ONLY
523+
k: v for k, v in request_kwargs["params"].items() if k in _STATUS_SEND_ONLY
522524
}
523525
response = self._request_with_retry(
524526
request_kwargs.pop("method"), request_kwargs.pop("url"), **request_kwargs

0 commit comments

Comments
 (0)