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

@WilliamK112 WilliamK112 commented Jul 2, 2026

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

Validation

  • uv run --frozen --extra dev pytest tests/unit/marketplace/test_marketplace_resolver.py -q -n0 (127 passed)
  • uv run --frozen --extra dev pytest tests/unit/marketplace/test_resolver_local_git.py tests/unit/marketplace/test_marketplace_commands.py tests/unit/marketplace/test_marketplace_install_integration.py::TestInstallMarketplaceGitLabMonorepoWiring 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 -n0 (73 passed)
  • uv run --frozen --extra dev ruff check src/apm_cli/marketplace/resolver.py
  • uv run --frozen --extra dev ruff format --check src/apm_cli/marketplace/resolver.py
  • BASE_REF=origin/main bash tests/spec_conformance/mode_b_detector.sh
  • git diff --check origin/main...HEAD

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.

@WilliamK112
WilliamK112 force-pushed the codex/apm-marketplace-ref-helper-1917 branch from d126ef7 to 82299a5 Compare July 23, 2026 14:17
@WilliamK112

Copy link
Copy Markdown
Contributor Author

Rebased the single refactor commit onto the rewritten current main history and preserved the newer auth-scheme handling while resolving the helper conflict. Validation is green: 200 marketplace/ref tests pass; Ruff, the Mode B gate, and git diff --check are clean.

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