test: replace always-true assert with issubclass check in test_installer_class_available#1979
test: replace always-true assert with issubclass check in test_installer_class_available#1979hognek wants to merge 3 commits into
Conversation
|
Warning Review limit reached
Next review available in: 34 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughLXCInstaller now uses the shared ChangesLXC port allocation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant LXCInstaller
participant allocate_host_port
participant LXCProxyDevice
LXCInstaller->>allocate_host_port: Request an available host port
allocate_host_port-->>LXCInstaller: Return host port
LXCInstaller->>LXCProxyDevice: Create proxy device
LXCProxyDevice-->>LXCInstaller: Report address-in-use failure
LXCInstaller->>allocate_host_port: Retry while excluding failed ports
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Verified current HEAD ( Files Reviewed (1 file)
Reviewed by hy3:free · Input: 37.9K · Output: 2.9K · Cached: 167K |
|
Good catch folding the post-merge Kilo nit on #1964. The branch is CONFLICTING against dev though - please rebase onto origin/dev and I'll merge once green. |
Replace the standalone _find_free_port() in lxc_installer.py with
allocate_host_port(app_id) from port_allocator.py so the centralized
allocator is the single source of truth for all app host-port
assignments.
- Remove _find_free_port(), socket, and closing imports from lxc_installer
- Import allocate_host_port instead of RESERVED_PORTS
- Accumulate failed ports in exclude set across TOCTOU retry loop
- Fix stale _docker_published_port docstring (DockerInstaller now
maps {allocated_host_port}:{container_port}, not {p}:{p})
- Add test class verifying _find_free_port is gone and
allocate_host_port is the only import
Refs: jaylfc#695
Add assert not hasattr(mod, 'RESERVED_PORTS') to verify the old import is truly removed, not just that allocate_host_port is present.
…ler_class_available
3ca6aa9 to
dc1c8ae
Compare
Kilo suggestion on merged PR #1964:
assert LXCInstaller is not Noneis always true at module scope and cannot detect the import-error regression the docstring claims.Fix: Replace with
assert issubclass(LXCInstaller, AppInstaller)— a meaningful class-hierarchy regression check.AppInstallerimport fromtinyagentos.installers.baseTests: 16/16 pass in test_port_allocator.py
Summary by Gitar
TestLxcUsesCentralizedAllocatorto enforce thatLXCInstalleruses the centralized port allocator.lxc_installermodule no longer exposes_find_free_portorRESERVED_PORTS.This will update automatically on new commits.
Summary by CodeRabbit
Bug Fixes
Documentation