Skip to content

sdk: fix pyright test typing#320

Merged
lucaspar merged 1 commit into
masterfrom
cursor/continuous-integration-failures-501e
Jul 9, 2026
Merged

sdk: fix pyright test typing#320
lucaspar merged 1 commit into
masterfrom
cursor/continuous-integration-failures-501e

Conversation

@cursor

@cursor cursor Bot commented Jul 9, 2026

Copy link
Copy Markdown

Summary

  • Fix SDK pyright errors in tests by making validated non-None values explicit and using Pydantic validation for coercion cases.
  • Broaden credit_unstreamed_file_bytes progress-bar typing to the structural update() API it uses.
  • Align test path/body helper types with SDK signatures.

Validation

  • npx --yes pyright@1.1.408 --pythonpath ./.venv/bin/python (0 errors)
  • python3 -m uv run -p 3.13 ruff format --check --config pyproject.toml ... (changed files)
  • python3 -m uv run -p 3.13 pyrefly check
  • Focused pytest targets for changed tests (11 passed)

Note: local full prek run --all-files could not install hooks in this container because the hook installer attempted to write to system Python; the source CI sdk-pre-commit job is green.

Open in Web View Automation 

Note

Low Risk
Changes are typing and test assertions only, aside from a wider structural type for progress bars that still only calls update().

Overview
Clears pyright failures in the SDK test suite and tightens one production type hint, with no intended runtime behavior change.

credit_unstreamed_file_bytes now accepts any object implementing update(n) via a new SupportsProgressUpdate protocol, instead of tqdm[NoReturn], matching how callers pass progress bars.

Tests are adjusted for stricter typing: explicit is not None checks before nested list access on Dataset, User.model_validate({}) and model_validate dicts for enum coercion, PurePosixPath for File.directory (not Path), Mapping on gateway stubs, and narrowing mocked HTTP request bodies before parse_qs.

Reviewed by Cursor Bugbot for commit 1d0b323. Configure here.

Co-authored-by: Lucas Parzianello <lucaspar@users.noreply.github.com>
@semanticdiff-com

semanticdiff-com Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  sdk/tests/models/test_user.py  58% smaller
  sdk/tests/test_gateway.py  14% smaller
  sdk/src/spectrumx/utils.py  0% smaller
  sdk/tests/models/test_datasets.py  0% smaller
  sdk/tests/ops/test_captures.py  0% smaller
  sdk/tests/ops/test_files.py  0% smaller

@lucaspar lucaspar marked this pull request as ready for review July 9, 2026 19:32
@lucaspar lucaspar added ci/cd GH actions, tests, builds, packaging, etc sdk SDK component labels Jul 9, 2026
@lucaspar lucaspar merged commit 369ddb1 into master Jul 9, 2026
4 checks passed
@lucaspar lucaspar deleted the cursor/continuous-integration-failures-501e branch July 9, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd GH actions, tests, builds, packaging, etc sdk SDK component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants