fix(sync): derive module name from subdirectory basename#178
Draft
quay-devel wants to merge 3 commits into
Draft
fix(sync): derive module name from subdirectory basename#178quay-devel wants to merge 3 commits into
quay-devel wants to merge 3 commits into
Conversation
When a .lola-req file has multiple entries from the same git repository with different #subdirectory= fragments, lola sync derived the same module name from the URL for all entries and silently skipped duplicates. Two changes to resolve_and_fetch_module(): 1. When spec.subdirectory is present and has a non-empty basename, derive module_name from Path(spec.subdirectory).name instead of the URL stem. Falls back to URL stem for edge cases like #subdirectory=/. 2. Switch from fetch_module() to fetch_module_as_name() so the on-disk module directory matches the derived name. This follows the pattern already used by _fetch_from_marketplace_quiet(). Examples after fix: - .git#subdirectory=plugins/dev → module name 'dev' - .git#subdirectory=plugins/jira → module name 'jira' - .git (no subdirectory) → module name from URL stem (unchanged) Fixes LobsterTrap#177 Generated-by: Quay LLM Automation (quay-devel)
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Reverts accidental 644→755 mode change on src/lola/cli/sync.py and tests/test_cli_sync.py from the previous commit. Generated-by: Quay LLM Automation (quay-devel)
Combine URL stem with subdirectory basename (e.g., ai-helpers-dev) instead of using the leaf alone (dev). This avoids cross-repo collisions where different repos could have identically-named subdirectories. Fixes LobsterTrap#177
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
.lola-reqentries share the same git URL but specify different#subdirectory=fragmentsai-helpers-dev) instead of URL stem alone when#subdirectory=is presentfetch_module_as_name()to ensure the on-disk directory matches the derived nameFixes #177
Root Cause
resolve_and_fetch_module()derived the module name fromPath(url_path).stem, which always yields the repo name (e.g.,ai-helpers) regardless of#subdirectory=. The second entry found the directory already existed and was silently skipped. Additionally,fetch_module()independently derives directory names from the URL, so even a correctedmodule_namewould be stored under the wrong path.Changes
src/lola/cli/sync.py:-{subdirectory_leaf}when a subdirectory is specified (e.g.,ai-helpers+dev→ai-helpers-dev)fetch_module()tofetch_module_as_name()so the module is stored under the correct namefetch_moduleimporttests/test_cli_sync.py:TestSyncSubdirectoryNameDerivationcovering: basic subdirectory, no subdirectory (backward compat), two entries same repo, root/, deep paths, trailing slashTestSyncWithGitUrlsmocks to matchfetch_module_as_nameTest plan
#subdirectory=still use URL stem/, deep paths, trailing slashesNote
This contribution was developed with LLM assistance by the Quay team.
🤖 Generated with Claude Code