Skip to content

fix(python): align SDK errors and metadata#954

Closed
G4614 wants to merge 1 commit into
mainfrom
g4614/pol-python-sdk-fixes
Closed

fix(python): align SDK errors and metadata#954
G4614 wants to merge 1 commit into
mainfrom
g4614/pol-python-sdk-fixes

Conversation

@G4614

@G4614 G4614 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Align BoxInfo defaults and Python convenience API errors with actual runtime behavior.

Test plan:

  • cargo fmt --all
  • sdks/python/.venv/bin/python -m py_compile sdks/python/boxlite/constants.py sdks/python/boxlite/exec.py sdks/python/boxlite/simplebox.py sdks/python/boxlite/sync_api/_simplebox.py sdks/python/tests/test_box_management_mock.py sdks/python/tests/test_exec_timeout_sigalrm.py sdks/python/tests/test_skillbox.py sdks/python/tests/test_sync_simplebox.py sdks/python/tests/test_sync_skillbox.py sdks/python/tests/test_simplebox.py
  • BOXLITE_DEPS_STUB=1 cargo check -p boxlite-python
  • BOXLITE_DEPS_STUB=1 cargo test -p boxlite --test lifecycle remove_auto_removed_local_box_id_is_idempotent -- --nocapture
  • BOXLITE_DEPS_STUB=1 cargo test -p boxlite --test lifecycle litebox_info_returns_correct_metadata -- --nocapture
  • BOXLITE_DEPS_STUB=1 cargo test -p boxlite --test lifecycle remove_nonexistent_returns_not_found -- --nocapture
  • debug host 54.169.172.226: make dev:python
  • debug host 54.169.172.226: pytest -q sdks/python/tests/test_simplebox.py::test_simplebox_metrics sdks/python/tests/test_simplebox.py::test_simplebox_command_not_found_raises_exec_error sdks/python/tests/test_sync_simplebox.py::TestSyncSimpleBox::test_command_not_found_raises_exec_error sdks/python/tests/test_sync_simplebox.py::TestSyncSimpleBox::test_exec_with_timeout
  • debug host 54.169.172.226: pytest -q sdks/python/tests/test_exec_timeout_sigalrm.py
  • debug host 54.169.172.226: pytest -q sdks/python/tests/test_box_management_mock.py::TestBoxliteManagementMethods::test_sync_context_manager_points_to_sync_api sdks/python/tests/test_box_management_mock.py::TestBoxliteManagementMethods::test_async_context_manager
  • debug host 54.169.172.226: cargo test -p boxlite --test lifecycle remove_auto_removed_local_box_id_is_idempotent -- --nocapture
  • debug host 54.169.172.226: cargo test -p boxlite --test lifecycle litebox_info_returns_correct_metadata -- --nocapture
  • debug host 54.169.172.226: cargo test -p boxlite --test lifecycle remove_nonexistent_returns_not_found -- --nocapture

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 402592cb-3997-4126-8f88-bc2195cb6a71

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch g4614/pol-python-sdk-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.


# Try to import sync API - skip if greenlet not installed
try:
import boxlite
@G4614

G4614 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by split draft PRs: #956 (POL-96), #957 (POL-98), #958 (POL-99), #959 (POL-100), #960 (POL-101), and #961 (POL-102).

@G4614 G4614 closed this Jul 9, 2026
DorianZheng pushed a commit that referenced this pull request Jul 10, 2026
Add metrics() to async SimpleBox so it matches the synchronous
convenience API.

Test plan:
- [x] cargo fmt --all
- [x] sdks/python/.venv/bin/python -m py_compile
sdks/python/boxlite/simplebox.py sdks/python/tests/test_simplebox.py
- [x] BOXLITE_DEPS_STUB=1 cargo check -p boxlite-python
- [ ] Not rerun on debug host after splitting; the same SimpleBox
metrics path passed on debug host before the split in #954

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added an async `metrics()` capability to `SimpleBox` to retrieve
resource usage (CPU/memory) for a box that has been started.
* Enforces the same started/ready-state requirement as other `SimpleBox`
actions.
* **Tests**
* Added an integration test that starts a `SimpleBox`, runs a command,
retrieves `box.metrics()`, and verifies metrics are returned and include
a non-zero `commands_executed_total`.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant