Add computer port publish commands - #16
Conversation
|
Warning Review limit reached
More reviews will be available in 20 minutes and 28 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughRight then, listen carefully. We've added port publishing to the system—three operations, clean and organised. You've got types defining the port metadata, SDK methods handling the HTTP work, CLI commands for the users, and proper test coverage throughout. Everything flows from contracts downward. ChangesComputer Port Publishing
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant Computers as SDK Computers
participant Backend
User->>CLI: computer port publish curie --port 8000
CLI->>Computers: publish_port("curie", 8000)
Computers->>Backend: POST /published-ports {port: 8000}
Backend-->>Computers: {url, port, status, id}
Computers-->>CLI: result dict
CLI-->>User: print URL or JSON
User->>CLI: computer port list curie --json
CLI->>Computers: list_published_ports("curie")
Computers->>Backend: GET /published-ports
Backend-->>Computers: [port_info, ...]
Computers-->>CLI: result list
CLI-->>User: JSON array or Rich table
User->>CLI: computer port unpublish curie --port 8000
CLI->>Computers: unpublish_port("curie", 8000)
Computers->>Backend: DELETE /published-ports/8000
Backend-->>Computers: {status}
Computers-->>CLI: result dict
CLI-->>User: confirmation or JSON
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/celesto/sdk/client.py (1)
876-876:⚠️ Potential issue | 🔴 CriticalFix import-time crash in
Computers.list_published_portsby avoidinglist[...]annotation
Your class’slist()method at ~876 shadows the builtinlist, so the-> list[dict[str, Any]]return type at ~911 gets evaluated during import and blows up with'function' object is not subscriptable—usetyping.List[...]instead.💡 Suggested fix
- def list_published_ports(self, computer_id: str) -> list[dict[str, Any]]: + def list_published_ports(self, computer_id: str) -> List[dict[str, Any]]:Also applies to: 911-911
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/celesto/sdk/client.py` at line 876, The import-time crash is caused by using the builtin shadowed name `list[...]` in return annotations inside the Computers class (notably the `list` method and `list_published_ports`), which is evaluated at import and fails; update those annotations to use typing.List (e.g., `List[dict[str, Any]]`) and add the corresponding import (`from typing import List`) so the annotations no longer attempt to subscript the shadowed builtin `list`; keep the method names (`Computers.list`, `Computers.list_published_ports`) unchanged.Sources: Linters/SAST tools, Pipeline failures
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/celesto/sdk/client.py`:
- Line 876: The import-time crash is caused by using the builtin shadowed name
`list[...]` in return annotations inside the Computers class (notably the `list`
method and `list_published_ports`), which is evaluated at import and fails;
update those annotations to use typing.List (e.g., `List[dict[str, Any]]`) and
add the corresponding import (`from typing import List`) so the annotations no
longer attempt to subscript the shadowed builtin `list`; keep the method names
(`Computers.list`, `Computers.list_published_ports`) unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3746aa34-6d19-4925-ad2d-468f669f9b79
📒 Files selected for processing (5)
src/celesto/computer.pysrc/celesto/sdk/client.pysrc/celesto/sdk/types.pytests/test_computer_cli.pytests/test_sdk.py
…ring sanitization' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
|
Docs PR opened: CelestoAI/mintlify-docs#103 Added documentation for publishing, listing, and unpublishing computer ports via the Python SDK and CLI. |
Summary
Tests
Summary by CodeRabbit
New Features
celesto computer portto publish, list, and unpublish computer ports.Tests