Installables: nested docker image path#861
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/cloudai/_core/installables.py`:
- Around line 56-69: The docstring for the DockerImage.cache_filename property
is too concrete and duplicates test data; update the DockerImage.cache_filename
property docstring to a short high-level description of what the property
returns (e.g., "Return the cache filename for the docker image") and remove the
example matrix so behavior is documented by tests (leave behavioral examples in
the parametrized test instead). Ensure you only edit the docstring in the
cache_filename property of the DockerImage class.
- Around line 73-80: The bug is that tag splitting uses reference.rsplit(":", 1)
which can capture colons in parent directories (e.g., ./cache:tmp/image.sqsh)
and leave slashes in tag; instead parse the tag from the basename only: take the
basename of reference (or image_ref after initial assignment) and split that
basename on ":" to extract tag, then reconstruct image_ref as the original path
with the basename portion replaced by the pre-tag basename (so image_ref has no
trailing :tag) and set image_name from that pre-tag basename; update the code
around image_ref, tag, and image_name (the variables currently set in this
branch) so cache_filename / install_path use the cleaned image_name without any
slashes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: e20e8381-78a0-481d-9c3f-04065ffa705b
📒 Files selected for processing (2)
src/cloudai/_core/installables.pytests/test_base_installer.py
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
src/cloudai/_core/installables.py (1)
60-63:⚠️ Potential issue | 🔴 CriticalCondition mismatch causes
ValueErrorwhen:appears in directory but not filename.Line 62 checks
if ":" in reference:but the rsplit on line 63 operates onimage_name. For a path like./cache:tmp/file.sqsh:
Path(reference).name→file.sqsh":" in reference→True"file.sqsh".rsplit(":", 1)→['file.sqsh'](single element)- Unpacking raises
ValueError: not enough values to unpackThe condition should check the same variable that gets split.
🐛 Proposed fix
if reference.startswith(("/", ".")): image_name = Path(reference).name - if ":" in reference: + if ":" in image_name: image_name, tag = image_name.rsplit(":", maxsplit=1)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cloudai/_core/installables.py` around lines 60 - 63, The bug is that the code checks ":" in reference but then splits image_name, causing a ValueError when a ":" is in a directory component; update the logic in the block that computes image_name/tag (the variables reference, image_name, tag and the Path(reference).name use and the rsplit call) so the condition checks the same variable being split (e.g., use if ":" in image_name) or use a safe split (partition/rsplit and handle single-element result) before unpacking to ensure tag is only extracted when present.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/cloudai/_core/installables.py`:
- Around line 57-74: The cache filename change in cache_filename will break
existing caches; update the code and docs to preserve compatibility by having
DockerImageCacheManager (methods: cache_filename and uninstall_cached_image)
attempt legacy filename patterns when locating or deleting .sqsh files (e.g.,
try the new name first, then fallback to the previous naming scheme), and add a
short note in the release notes/docs explaining that old cache files will be
auto-detected or otherwise require cleanup so users are aware of potential
re-downloads or orphaned files.
---
Duplicate comments:
In `@src/cloudai/_core/installables.py`:
- Around line 60-63: The bug is that the code checks ":" in reference but then
splits image_name, causing a ValueError when a ":" is in a directory component;
update the logic in the block that computes image_name/tag (the variables
reference, image_name, tag and the Path(reference).name use and the rsplit call)
so the condition checks the same variable being split (e.g., use if ":" in
image_name) or use a safe split (partition/rsplit and handle single-element
result) before unpacking to ensure tag is only extracted when present.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 2a6e36c4-a452-4f0e-b635-0425bb498620
📒 Files selected for processing (1)
src/cloudai/_core/installables.py
Summary
The generated path or complicated docker image URLs was nested (relatively to install dir) - intermediate dirs were not created thus installation failed
The PR makes sure docker image URLs always resolve into file names, not paths
Test Plan
Additional Notes