feat(python): add patch_cvm and confirm_cvm_patch for unified PATCH endpoint#210
Merged
feat(python): add patch_cvm and confirm_cvm_patch for unified PATCH endpoint#210
Conversation
…ndpoint Mirrors JS SDK's patchCvm/confirmCvmPatch (PR #208): - patch_cvm: unified PATCH /cvms/{cvm_id} with true PATCH semantics Returns {requires_on_chain_hash: False, correlation_id} on success, or {requires_on_chain_hash: True, compose_hash, app_id, ...} on 465 - confirm_cvm_patch: Phase 2 with X-Compose-Hash/X-Transaction-Hash headers - Both sync and async clients - Function-style wrappers in actions module
Contributor
📋 Check Results✨ JS SDK - Code FormattingShow format check results🔍 JS SDK - TypeScript Type CheckShow type check output🧪 JS SDK - Test ResultsShow test output📝 JS SDK - Lint CheckShow lint results🌐 JS SDK - Browser CompatibilityShow browser test results🌐 Browser Compatibility ReportBrowser compatibility tests completed across:
The SDK has been verified to work in modern browser environments. Check run: https://github.com/Phala-Network/phala-cloud/actions/runs/23229760229 |
Unit tests:
- Add mock handler for PATCH /cvms/{cvm_id} (202 with correlation_id)
- Add patch_cvm and confirm_cvm_patch to direct and safe call matrices
E2E test (test_e2e_patch_cvm):
- Deploy dedicated CVM → patch with various param combos → verify → cleanup
- Covers: visibility-only, docker_compose, pre_launch_script, encrypted_env,
multi-field (visibility + compose), and safe_patch_cvm
- Each patch: assert idle → patch → verify correlation_id → wait idle
- Verifies state changes via get_cvm_info after patches
pacoyang
approved these changes
Mar 18, 2026
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.
Summary
Python SDK counterpart to JS SDK PR #208 (
patchCvm/confirmCvmPatch).patch_cvm— unifiedPATCH /cvms/{cvm_id}with true PATCH semantics. Only fields present in the request are sent.{"requires_on_chain_hash": False, "correlation_id": "..."}on 202{"requires_on_chain_hash": True, "compose_hash": "...", "app_id": "...", ...}on 465 (on-chain KMS)confirm_cvm_patch— Phase 2 for on-chain KMS, sendsX-Compose-Hash/X-Transaction-HashheadersactionsmoduleTest plan
make test— 11 passed, 2 skippedmake lint— all checks passed