Skip to content

refactor(marketplace): extract ref propagation helper#1992

Open
WilliamK112 wants to merge 1 commit into
microsoft:mainfrom
WilliamK112:codex/apm-marketplace-ref-helper-1917
Open

refactor(marketplace): extract ref propagation helper#1992
WilliamK112 wants to merge 1 commit into
microsoft:mainfrom
WilliamK112:codex/apm-marketplace-ref-helper-1917

Conversation

@WilliamK112

Copy link
Copy Markdown
Contributor

Summary

  • Extract the registered marketplace ref selection into a co-located helper in marketplace/resolver.py.
  • Share that helper across the GitLab structured DependencyReference path and the GitHub-family canonical #ref suffix path.
  • Preserve the security-adjacent guards from refactor(marketplace): extract ref-propagation helpers from resolve_marketplace_plugin #1917: explicit install/plugin refs win, main/HEAD remain 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.py
  • git diff --check

Note: I also tried broader marketplace pytest groups; the full tests/unit/marketplace directory and the existing TestInstallGitLabMarketplaceFullPipelineFromHttp test timed out in this Windows environment, so I did not count those as passing evidence.

Copilot AI review requested due to automatic review settings July 2, 2026 02:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 implicit main/HEAD).
  • Replaces duplicated inline ref-selection logic in the GitLab in-marketplace dependency reference path with the new helper.
  • Replaces the GitHub-family canonical #ref propagation block to use the helper and preserve non-overwrite behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(marketplace): extract ref-propagation helpers from resolve_marketplace_plugin

2 participants