Repository navigation
feat(sandbox): sync latest public APIs - #474
Conversation
Sync Sandbox API changes from qiniu/api-specs at 6cb3b18. Add persistent snapshots, Connect v2, pause/resume options, JSON body injections, template tags, and minimum disk constraints with tests and examples. Send snapshot idempotency keys as UTF-8 bytes and cover real HTTP transport, including retries with Unicode and byte-string keys. BREAKING CHANGE: replace disk_size_mb/diskSizeMB with min_disk_mb or min_free_disk_mb for template creation. Omitted connect timeouts now use the server default of 300 seconds.
There was a problem hiding this comment.
Reviewed every changed file, traced the affected callers and API contracts, and found three defects in snapshot retry handling. The sandbox suite passes with 224 tests passed and 11 credential-dependent integration tests skipped; targeted reproductions confirm the interrupted-response and Retry-After failures.
Reviewed head commit: 590eb9e75105458daae423104b229c04ad37a02f
- [P2] Bound snapshot retries by the idempotency retention window (
qiniu/services/sandbox/client.py:529-533) — see inline comment - [P2] Retry interrupted snapshot response bodies (
qiniu/services/sandbox/client.py:503-507) — see inline comment - [P3] Guard Retry-After conversion against malformed numeric values (
qiniu/services/sandbox/client.py:400-403) — see inline comment
Keep automatic retries within the idempotency retention window, replay interrupted responses, and validate Retry-After safely. Cover retry deadlines and raw HTTP transport across supported Python versions.
|
@fennoai review |
|
All 244 local Sandbox tests passed on Python 3.10, and the fixed diff passed whitespace checks. I found no actionable regressions; I’m submitting a non-blocking review noting that live service integration tests were not run. |
There was a problem hiding this comment.
Reviewed the complete diff at f03de75, including snapshot idempotency and retry boundaries, Connect v2, lifecycle options, pagination, template disk constraints, and HTTP body injection; no actionable regressions found. All 244 local Sandbox tests passed on Python 3.10, and the fixed diff passed whitespace checks. Live service integration tests were not run.
Patch the client time namespace instead of the shared time module so Python 2 ThreadPool background sleeps cannot contaminate retry assertions.
|
@fennoai review |
|
The updated tests isolate mocked retry sleeps to the client module, leaving other threads’ timing intact. All 244 local Sandbox tests passed, and the fixed diff passed whitespace checks. I found no actionable regressions and will submit the review. |
There was a problem hiding this comment.
Reviewed the complete fixed diff at 2a4d421, including snapshot retry safety, lifecycle and Connect v2 behavior, pagination, template options, injection serialization, and the updated isolation of mocked retry sleeps. No actionable regressions found; all 244 local Sandbox tests passed on Python 3.10, and the diff passed whitespace checks. Live service integration tests and Python 2 execution were not performed.
Prepare Python SDK 7.19.0 with the Sandbox changes merged since v7.18.2: idempotent creation/connection, resource APIs, persistent snapshots, Connect v2, pause/resume options, HTTP JSON body injection, and template disk constraints/tags. The changelog documents the removed `disk_size_mb` / `diskSizeMB` options and the server-default connect timeout. The release also isolates the Kodo signature test from `DISABLE_QINIU_TIMESTAMP_SIGNATURE`, reproducing and fixing the sole failure reported by the completed master CI jobs after #474. ### Validation - Python 3.9 and 3.11: 244 local Sandbox tests passed on each, with `DISABLE_QINIU_TIMESTAMP_SIGNATURE=True` to exercise the regression. - Flake8 and `git diff --check` passed. - `setup.py --version`, package metadata, and changelog agree on 7.19.0. - Wheel and sdist built; Twine checks passed with the existing missing `long_description_content_type` warning. - The wheel installed in a separate environment; importing qiniu reports 7.19.0 and exposes the snapshot client API. ### Release After merge, tag the release commit as v7.19.0 and publish the GitHub Release with compatibility notes. This follows the repository's previous release process; the repository has no PyPI publishing workflow.
The Sandbox SDK still uses the deprecated connect endpoint and lacks the latest snapshot, lifecycle, injection, and template options. This updates it against qiniu/api-specs at
6cb3b18a89584b0cd05f94c2d0a85aa7926c9f05and adds the corresponding tests, examples, and usage documentation.Changes
Retry-Afterhandling. Send validated UTF-8 key bytes so Unicode keys work through real HTTP transport.Compatibility
disk_size_mb/diskSizeMBoption with migration guidance. Usemin_disk_mbfor minimum total size ormin_free_disk_mbfor minimum free space.Validation
Retry-After, and real HTTP regressions for Unicode keys and interrupted response bodies. The raw-byte HTTP test server supports legacy Python header handling.590eb9e, four focused live integration cases passed: memory and filesystem snapshot recovery, minimum-disk template building, and HTTP body injection configuration. Created resources were cleaned up.590eb9e, four examples ran successfully against the service: snapshots, lifecycle, template lifecycle, and runtime configuration.git diff --checkpassed.The repository-wide integration suite was not run to completion, and historical examples were not all executed individually.