refactor(marketplace): extract ref propagation helper#1992
Open
WilliamK112 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors marketplace ref propagation by extracting the registered-ref selection logic into a single helper in marketplace/resolver.py, then reusing it across both the GitLab structured DependencyReference path and the GitHub-family #ref suffix path while preserving the existing precedence/guard rules from #1917.
Changes:
- Introduces
_select_marketplace_plugin_ref(...)to centralize ref selection precedence (version_spec > plugin ref > marketplace registered ref, excluding implicitmain/HEAD). - Replaces duplicated inline ref-selection logic in the GitLab in-marketplace dependency reference path with the new helper.
- Replaces the GitHub-family canonical
#refpropagation block to use the helper and preserve non-overwrite behavior.
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
marketplace/resolver.py.DependencyReferencepath and the GitHub-family canonical#refsuffix path.main/HEADremain implicit, and registered marketplace refs do not overwrite already-selected plugin refs.Closes #1917
Tests
.\.venv\Scripts\python.exe -m pytest tests\unit\marketplace\test_marketplace_resolver.py::TestMarketplaceRegisteredRefPropagation -q.\.venv\Scripts\python.exe -m pytest tests\unit\marketplace\test_marketplace_resolver.py -q.\.venv\Scripts\python.exe -m pytest tests\unit\marketplace\test_resolver_local_git.py tests\unit\marketplace\test_marketplace_commands.py -q.\.venv\Scripts\python.exe -m pytest tests\unit\marketplace\test_marketplace_install_integration.py::TestInstallMarketplaceGitLabMonorepoWiring -q.\.venv\Scripts\python.exe -m pytest tests\unit\commands\test_marketplace_plugin.py::TestResolveRef tests\unit\commands\test_marketplace_plugin.py::TestPackageAddRefResolution tests\unit\commands\test_marketplace_plugin.py::TestPackageSetRefResolution -q.\.venv\Scripts\python.exe -m ruff check src\apm_cli\marketplace\resolver.py.\.venv\Scripts\python.exe -m ruff format --check src\apm_cli\marketplace\resolver.pygit diff --checkNote: I also tried broader marketplace pytest groups; the full
tests/unit/marketplacedirectory and the existingTestInstallGitLabMarketplaceFullPipelineFromHttptest timed out in this Windows environment, so I did not count those as passing evidence.