Skip to content

fix(marketplace): resolve version tags from package remote - #3044

Merged
Daniel Meppiel (danielmeppiel) merged 12 commits into
microsoft:mainfrom
modelpath-dev:fix/2928-package-tag-remote
Sep 30, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 12 commits into
microsoft:mainfrom
modelpath-dev:fix/2928-package-tag-remote

Conversation

@modelpath-dev

@modelpath-dev Chandan Kumar (modelpath-dev) commented Sep 20, 2026 •

Copy link
Copy Markdown

Fixes #2928

Why

Version constraints for marketplace installs listed git tags on the marketplace catalog even when the plugin lives in a separate package repository. Tags published only on the package remote never matched, so installs like apm install pkg@marketplace#1.0.1 failed with No tag matching version. Query the package remote when the plugin source points there, and keep the catalog remote for in-marketplace packages.

Scope

  • resolve_version_constraint: optional remote_url passed through to list_remote_refs
  • resolve_marketplace_plugin: pick package coordinates from dep_ref or github/gitlab/git-subdir locators before falling back to the marketplace
  • MarketplaceBuilder: pass source_url as remote_url when listing refs
  • Unit coverage for packed remote sources and remote_url forwarding

Tradeoffs

Left in-marketplace / relative sources on the catalog remote. That is still where those packages publish tags.

Blast Radius

Touches marketplace install validation and builder tag resolution only. Auth for the lookup follows the package host when it differs from the catalog.

Verification

uv run --extra dev pytest \
  tests/unit/marketplace/test_version_resolver.py \
  tests/unit/marketplace/test_marketplace_resolver.py \
  tests/unit/marketplace/test_versioned_resolver.py -q

173 passed.

Version constraints listed tags on the marketplace catalog even when the
plugin lives in a different package repo. Query the package remote so
tag/version install works when those remotes differ.

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.

Copilot review overview

🟡 Changes recommended

Repository host parsing and SSH transport issues remain unresolved; two minor test improvements are also noted.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Updates marketplace version resolution to query tags from the package repository when sources differ from the marketplace catalog.

Changes:

  • Forwards optional remote URLs during version and builder resolution.
  • Resolves package coordinates from external marketplace sources.
  • Adds unit coverage for remote lookup behavior.
File Summary
tests/​unit/​marketplace/​test_version_resolver.py Tests remote forwarding and diagnostics; nit (1 vote): parse diagnostic URLs instead of using substring matching.
tests/​unit/​marketplace/​test_marketplace_source_base.py Updates resolver test doubles.
tests/​unit/​marketplace/​test_marketplace_resolver.py Tests package-remote resolution.
tests/​unit/​marketplace/​test_builder.py Updates builder test doubles.
src/​apm_cli/​marketplace/​version_resolver.py Forwards optional remote URLs to reference resolution.
src/​apm_cli/​marketplace/​resolver.py Selects package remotes; critical (3 votes): preserve bare and host-qualified source semantics; moderate (1 vote): preserve SSH transport.
src/​apm_cli/​marketplace/​builder.py Uses source URLs for tag lookup; nit (1 vote): assert the forwarded source_url in builder tests.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/apm_cli/marketplace/resolver.py Resolved
Bare type:github locators and host-qualified repo fields must parse
through DependencyReference so tags are listed on github.com, not the
marketplace catalog host.
@modelpath-dev

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@sergio-sisternes-epam

Copy link
Copy Markdown
Collaborator

Thank you for this pull request. It is linked to #2928, which a maintainer labelled status/accepted, so the reported marketplace tag-install regression is in scope for review.

CODEOWNERS review is already requested from Daniel Meppiel (@danielmeppiel) and Sergio Sisternes (@sergio-sisternes-epam). This comment does not add or change review requests, and it is not merge approval.

Please wait for those CODEOWNERS reviews before any merge decision.


Generated by autopilot-pr-triage-worker. This comment is AI-generated and may contain errors.

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) added triage/recommended Automated advice completed; not human scope approval. type/bug Something does not work as documented. area/marketplace marketplace.json schema, federation, authoring suite, source parity. labels Sep 23, 2026
The architecture linter requires host/reference coordinates to come from
host_virtual.py, so use repository_owner() and dependency_repository_owner()
instead of splitting repo_url by hand.

Also drop two test asserts CodeQL flags as URL substring sanitization;
the helper already checks the exact owner/repo, and run ruff format.
@danielmeppiel

Copy link
Copy Markdown
Collaborator

APM Review Panel: needs_rework

Resolving tags from the package remote addresses #2928, but two current-head transport/authority defects still need correction.

panel-mode=lean; personas=auth-expert,test-coverage-expert,python-architect,apm-ceo

cc Chandan Kumar (@modelpath-dev) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Reviewed 6373f750349367fbc01f534a253422a552321bb0. The package-versus-catalog selection is the right direction, and the canonical dependency parser and repository-owner helpers are reused. 356 focused repository unit tests passed in 7.70s. Broader session-only probes then reproduced two defects: an external package inherits the catalog's non-default port, and an explicit SSH package URL becomes HTTPS on its SSH port.

The eight additional probes produced 5 failed assertions covering those two defects, with 3 passing controls in 0.43s. They exercise the real marketplace resolver, version resolver, RefResolver and git command construction; metadata, auth/config and subprocess boundaries are mocked. Nested GitLab repository paths, catalog-local lookup and a correctly configured SSH RefResolver passed their controls. This is unit-level call-path evidence, not actual remote/SSH, CLI lifecycle, integration-fixture, full-suite or CI evidence.

Dissent. The initial auth specialist's 11 helper checks passed, but one explicitly treated SSH-to-HTTPS conversion as expected and none covered foreign catalog-port inheritance. The orchestrator's broader executed probes supersede that clean assessment. The auth-scope findings below are those orchestrator corrections, not findings returned by the initial specialist.

Aligned with: Portable by manifest: preserve declared SSH transport. Multi-host support: select package authority independently of the catalog. Secure by default: keep auth and transport coordinates consistent.

Panel summary

Persona B R N Takeaway
Auth Expert 2 0 0 Initial helper-only assessment corrected by two orchestrator-reproduced transport/port defects.
Test Coverage Expert 0 1 0 Add a repository regression trap for catalog-local dict sources with a semver version spec.
Python Architect 0 1 0 Canonical owners are reused; the future source-type coverage suggestion has no demonstrated current fault.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 3 follow-ups

  1. [Auth Expert scope; orchestrator verification] (blocking-severity) Keep the external package's own port, including its default -- a catalog on :8443 currently makes a default-HTTPS package fail RefResolver's canonical authority check before ls-remote. Cover both packed URLs and GitHub shorthand.
  2. [Auth Expert scope; orchestrator verification] (blocking-severity) Preserve explicit SSH transport through version lookup -- carry matching transport/user/port configuration into RefResolver, not just a URL. The current command targets https://host:2222/... instead of the declared SSH service.
  3. [Test Coverage Expert] Add the catalog-local dict-source + semver regression trap -- the session probe confirms correct behavior today, but it is not a committed regression guard.

Recommendation

Recommend reworking the two reproduced defects before shipping, with repository regression tests for their public resolver paths. The catalog-local coverage addition is worthwhile; defer the architect's hypothetical future-type exhaustiveness guard unless a concrete gap appears. Preserve the existing review requests for danielmeppiel and sergio-sisternes-epam, and wait for both CODEOWNERS reviews before any merge decision, as requested in the existing discussion. This advisory does not replace those reviews.


Full per-persona findings

Auth Expert

The raw specialist return had no findings. These two corrections were established by the orchestrator's subsequent session-only probes on the same head.

  • [blocking] External package inherits a foreign catalog port at resolver.py:845 and resolver.py:880.
    With catalog https://catalog.example.invalid:8443/catalog-owner/catalog-repo and package https://github.com/acme/tool, version lookup calls AuthResolver.resolve('github.com', org='acme', port=8443) and constructs RefResolver(host='github.com', port=8443) while passing remote_url='https://github.com/acme/tool'. The real RefResolver raises GitLsRemoteError: The canonical remote URL does not match the configured host or dependency coordinates. No ls-remote is reached. This is an authority mismatch, not evidence of credential disclosure.
    Suggested: Use the external package's own port, including None for the protocol default. Retain catalog coordinates only for genuinely catalog-relative sources.
    Proof (failed, unit; session-only): test_pr3044_remote_contract.py::test_package_transport_reaches_git[default-https-package-not-rejected-for-catalog-port]. The packed-URL and type: github shorthand coordinate probes independently capture the same inherited port.

  • [blocking] Explicit SSH package URL becomes HTTPS on the SSH port at resolver.py:878.
    A supported packed source {"source":"url","url":"ssh://[email protected]:2222/team/repo.git"} reaches the real command constructor as git ls-remote --tags --heads https://git.acme.invalid:2222/team/repo. The default to_clone_url() conversion loses the explicitly declared SSH transport and key-auth path.
    Suggested: Carry the canonical dependency's transport, SSH user and port into version resolution as well as the remote URL. Keeping only the SSH URL with an HTTPS-configured RefResolver is insufficient.
    Proof (failed, unit; session-only): test_pr3044_remote_contract.py::test_package_transport_reaches_git[ssh-not-rewritten-to-https]: expected scheme ssh, actual https. The control test_native_refresolver_preserves_explicit_ssh_control passes with transport_scheme='ssh', ssh_user='git', port=2222 and preserves the original SSH URL. Subprocess execution is mocked; no real SSH endpoint was contacted.

Test Coverage Expert

  • [recommended] Add the catalog-local dict-source + semver preservation guard in tests/unit/marketplace/test_marketplace_resolver.py.
    The bounded test search found external-source version checks but no direct assertion for a dict source matching the catalog with a semver version_spec. The orchestrator's session-only test_in_marketplace_dict_keeps_catalog_coordinates passes with owner_repo='catalog-owner/catalog-repo', remote_url=None and the catalog host. Add that invariant to the repository suite; passing scratch evidence does not create a durable regression trap.
    Proof (missing, unit): a committed test of that combined scenario. Existing detection tests provide indirect coverage.

Python Architect

  • [recommended; deferred in synthesis] Consider a source-type partition coverage guard around _dependency_reference_from_packed_source and _coords_from_package_locator.
    This is a future-maintenance suggestion, not a demonstrated current split-authority defect. No broader parser redesign is recommended for this bounded fix.

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

Preserve contributor history while validating against the current base.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator

APM Review Panel: needs_rework

PR #3044 targets package-owned version tags for #2928, but local candidate 8019368 still fails foreign-port and explicit-SSH source-CLI cases.

panel-mode=full; all personas and CEO: gpt-6-astra

cc Chandan Kumar (@modelpath-dev) Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

The failing session-only tests test_package_tag_remote_foreign_catalog_port and test_package_tag_remote_explicit_ssh lead this assessment: both expected installation success but returned 1. The test reviewer exercised real local bare Git origins and current-source CLI subprocesses; the no-port HTTPS control installed package-only tags and verified deployed bytes and the locked package commit. This establishes a working baseline and two broken consumer cases on local candidate 8019368, not packaged-binary lifecycle or CI certification. The candidate is a clean, unpushed merge of main; live PR head remains 6373f75. Named defects remain unmodified.

The repeated architecture, auth, UX, security and coverage findings collapse into two defects, not additional votes: external packages inherit the catalog port, and explicit SSH identity becomes HTTPS during tag lookup. Auth's isolated mocked-unit rerun independently recorded 5 failures and 3 passes; other manual probes supply bounded diagnosis, not durable regression protection. The five selected committed unit tests passed, including tests/unit/marketplace/test_marketplace_resolver.py::TestResolveMarketplacePluginGitLabMonorepo::test_packed_url_version_spec_queries_package_remote, whose assertion is mock_ref_resolver.return_value.list_remote_refs.assert_called_once_with( "team/repo", remote_url=package_url, ). That proves the mocked routing contract, not real transport or lifecycle closure. Preserve strict authority validation and existing transport/auth ownership. No credential disclosure is demonstrated; the SSH fixture does not authenticate against a real SSH server.

Package-only lifecycle and builder canonical-URL regression gaps concern portability promises and deserve substantial weight despite their recommended classification. Invalid external locators falling back to catalog tags are a separate, in-scope fail-closed correction, not a demonstrated traversal exploit. Performance found no evidenced incremental regression by static review, not a benchmark result. The earlier-head metadata-owner report cannot certify this candidate. Keep the work bounded to source identity, durable tests and concise version documentation; preserve modelpath-dev's original three commits and their already-resolved fixes. Daniel and Sergio's existing CODEOWNERS review gates remain intact, and this advisory neither authorizes merge nor requests reviewers.

Aligned with: External package versions must come from the package repository; catalog-local sources must retain catalog lookup, with durable install, replay and update evidence. Keep package authority and selected transport consistent with authentication scope, reject invalid external locators, and retain RefResolver's strict checks. Exact-head owner verification and Daniel/Sergio review gates remain required; this advisory grants no merge authority. Preserve canonical host, port, scheme and SSH user through tag enumeration rather than projecting every package onto HTTPS. Preserve modelpath-dev's original history and credit existing resolutions; do not present the author's earlier fixes as new review work. Document literal CLI refs versus manifest ranges and make package-owned tag selection reliable without requiring duplicate catalog tags.

Panel summary

Persona B R N Takeaway

| python-architect | 2 | 0 | 0 | Package-remote routing is sound in intent, but mixed catalog/package ports and dropped SSH identity cause two reproduced caller/owner defects. |

| auth-expert | 2 | 0 | 0 | Two blocking auth/transport defects reproduced on 8019368 (5 failed, 3 passed, mocked unit probes); no external connections or real credential reads. |

| test-coverage-expert | 1 | 2 | 0 | Five focused unit tests pass, but real-fixture source-CLI probes expose two routing failures; package-only lifecycle and producer URL-forwarding regression traps remain missing. |

| performance-expert | 0 | 0 | 0 | No evidenced incremental performance regression: ref-listing call-site counts and loop counts are unchanged; both builder paths use consistent URL cache keys. Static review only; no benchmarks run. |

| devx-ux-expert | 2 | 1 | 0 | Package routing passes mocked unit checks, but catalog-port inheritance and SSH conversion break source identity. Unsafe diagnostic URLs were rejected; version-selection docs need an example. |

| supply-chain-security-expert | 2 | 1 | 0 | Preserve complete package authority and explicit SSH transport; reject invalid external locators rather than consulting catalog tags. No credential disclosure demonstrated. |

B = blocking-severity findings, R = recommended, N = nits. Counts are signal strength, not gates. The maintainer ships.

Top follow-ups

  1. Preserve the external package port, including None, in both coordinate branches; derive authentication and RefResolver configuration from that same identity. The foreign-catalog-port source-CLI case fails, and mocked-unit checks locate the mismatch before Git execution. Keep strict authority validation. Add durable packed-URL and GitHub-source cases with a :8443 catalog and default-port package, real-fixture CLI assertions for deployed bytes and the locked commit, and failure-state preservation checks. Extend the existing registered boundary with an executed mutation regression against catalog-port inheritance; keep diagnostics safely parsed rather than relying on URL substrings.

  2. Carry explicit scheme, SSH user, package port and matching canonical URL through the existing transport selector and authentication owners into version resolution. The explicit-SSH source-CLI case fails, and auth's mocked-unit test fails assert urlparse(ls_remote[0][-1]).scheme == expected_scheme. Preserve token-free SSH without globally changing to_clone_url. Add durable custom-user/custom-port marketplace tests at the Git boundary, a raw-tag bypass control, and executed boundary mutations for dropped transport/user. Verify the selected transport with real local Git fixtures without claiming real SSH-server authentication.

  3. Reject recognized but invalid external locators instead of interpreting parse failure as a catalog-local source. The manual mocked-unit probe returned a catalog-derived tag for an invalid external locator. That is a missing durable secure-default guardrail, not evidence of completed unsafe installation. Add a safely worded validation failure and automated assertions that rejected locators reach neither package authentication nor tag-query execution; reserve catalog fallback for positively identified catalog-local sources.

  4. Strengthen the existing package-only-tag lifecycle and retain an explicit catalog-local dictionary-plus-semver control. Current lifecycle fixtures mirror release tags onto both origins and therefore mask [BUG]In last version (0.30.0) It is not possible to install package with git tag #2928. Extend test_custom_pattern_closes_install_update_outdated_lifecycle in place: assert no package release tags exist on the separate catalog, then cover register, range install, replay, next package-only release, catalog refresh, update and converged update with deployed-byte, lock and snapshot assertions. Retain catalog-local lookup coverage. Execute the installed/package CLI lifecycle on the repaired exact head; the passing source-CLI installation control does not establish that evidence.

  5. Defend builder canonical-URL forwarding for explicit tags and version ranges with recording unit doubles and a parametrized real-fixture producer case. Existing doubles ignore remote_url and SHA-based integration scenarios bypass both changed lookups. Within the existing nested-HTTPS/encoded-ADO module, pack from the exact canonical source URL using a tag or range, assert the emitted URL and package commit, and compare repeated artifact bytes. Obtain the registered touched-owner verification on the resulting exact head; the earlier-head report and consumer installs do not certify metadata enrichment. Do not broaden this fix into metadata-fetch behavior changes.

Architecture
classDiagram
    direction LR
    class MarketplaceResolver {
      <<Module>>
      +resolve_marketplace_plugin()
      -_package_version_remote()
    }
    class VersionResolver {
      <<Module>>
      +resolve_version_constraint()
    }
    class MarketplaceBuilder {
      +_resolve_explicit_ref()
      +_resolve_version_range()
    }
    class DependencyReference {
      <<Dataclass>>
      +parse()
      +to_clone_url()
      +explicit_scheme
      +ssh_user
      +port
    }
    class TransportSelector {
      <<Strategy>>
      +select()
    }
    class RefResolver {
      <<Facade>>
      +list_remote_refs()
      -_git_url_and_env()
    }
    class RefCache
    class AuthResolver
    MarketplaceResolver ..> DependencyReference : parses package identity
    MarketplaceResolver ..> VersionResolver : requests version tag
    MarketplaceResolver ..> AuthResolver : resolves credentials
    VersionResolver ..> RefResolver : constructs
    MarketplaceBuilder o-- RefResolver : per-host resolvers
    RefResolver *-- RefCache : caches refs
    RefResolver ..> AuthResolver : Git environment
    TransportSelector ..> DependencyReference : reads explicit transport
    note for DependencyReference "Dataclass-as-value-object: repository and transport coordinates"
    note for VersionResolver "Marketplace adapter omits transport_scheme and ssh_user"
    note for MarketplaceBuilder "Composition: delegates remote I/O to RefResolver"
    class MarketplaceResolver:::touched
    class VersionResolver:::touched
    class MarketplaceBuilder:::touched
    classDef touched fill:#fff3b0,stroke:#d47600
Loading
flowchart TD
    A["apm install: remote marketplace package with version constraint"] --> B["[I/O] [NET] src/apm_cli/marketplace/resolver.py: resolve_marketplace_plugin; get_marketplace_by_name; fetch_or_cache"]
    B --> C{"resolver.py: _package_version_remote: parsed dependency or external dict?"}
    C -->|yes| D["DependencyReference.parse / to_clone_url; package host, but catalog port fallback"]
    C -->|no| E["Catalog owner/repo, host and port; remote_url=None"]
    D --> F["[I/O] resolver.py: _extract_auth -> AuthResolver.resolve"]
    E --> F
    F --> G["src/apm_cli/marketplace/version_resolver.py: resolve_version_constraint; RefResolver defaults to HTTPS"]
    H["apm marketplace build: remote entry requiring tag/ref lookup"] --> I{"src/apm_cli/marketplace/builder.py: _resolve_entry; entry.ref present?"}
    I -->|yes, not full SHA| J["_resolve_explicit_ref: forward source_url"]
    I -->|no| K["_resolve_version_range: forward source_url"]
    G --> L["[LOCK] src/apm_cli/marketplace/ref_resolver.py: list_remote_refs; per-remote lock and RefCache"]
    J --> L
    K --> L
    L -->|cache hit| R["Return RemoteRef list to caller"]
    L -->|miss, online| M{"_git_url_and_env: URL matches configured host, port, path and transport?"}
    M -->|no| X["GitLsRemoteError before Git invocation"]
    M -->|yes| N["[EXEC] [NET] list_remote_refs._run_remote -> git_remote_refs: git ls-remote --tags --heads"]
    N -->|returncode != 0, no successful auth recovery| X
    N -->|returncode 0| R
    R -->|version_resolver caller| S{"Matching stable semver tags?"}
    S -->|no| T["NoMatchingVersionError"]
    S -->|yes| U["Highest matching tag/SHA; resolver.py applies reference override"]
    R -->|builder caller| V["_resolve_explicit_ref or _resolve_version_range selects requested ref/version"]
Loading

Recommendation

Recommend repairing the two reproduced source-identity defects and folding the six bounded follow-ups before seeking a ship decision. Re-run focused tests, real-local-Git consumer cases, packaged lifecycle and applicable owner checks on the resulting exact head; report each evidence tier separately. Preserve original author history and leave any merge decision to Daniel and Sergio after both required reviews. This is an advisory recommendation, not a binary verdict or an automated merge gate.

Full per-persona findings

python-architect

  • [blocking] Preserve the package's absent port instead of inheriting the catalog port at src/apm_cli/marketplace/resolver.py:880

The new package-remote adapter changes host/repository to the package but uses the catalog's port whenever the parsed package port is None, in both _coords_from_package_locator (line 845) and _package_version_remote (line 880). None here means the package's default port, not an unresolved coordinate. With catalog https://catalog.acme.invalid:8443/team/catalog.git and package https://git.acme.invalid/team/repo.git, remote_url has no port while RefResolver is configured with 8443. Its existing _git_url_and_env authority check at ref_resolver.py:332 correctly rejects the mismatch before Git. The same failure occurs for an explicit github.com/team/repo source. This is a reproduced correctness defect in the changed routing path, not a hypothetical host policy concern: the caller has created an authority that neither original source owns.

Suggested: Once package identity is selected, forward its port unchanged, including None, in both helper paths. Retain catalog coordinates only for catalog-relative identity. Keep RefResolver's authority validation intact. Add public-consumer regression cases for both parsed packed URLs and host-qualified GitHub entries, plus a registered static boundary/mutation guard against catalog-port fallback on parsed package identity.

  • [blocking] Carry explicit transport and SSH user through version-tag resolution at src/apm_cli/marketplace/resolver.py:878

The new call to dep_ref.to_clone_url() at line 878 is not transport selection: reference.py:2005 delegates it to to_github_url(), which produces HTTPS for an explicit SSH dependency. The five-element return tuple discards explicit_scheme and ssh_user, and version_resolver.py:94-108 constructs RefResolver without either transport_scheme or ssh_user. Public resolver probes for ssh://[email protected]:2222/team/repo.git and ssh://[email protected]:2222/team/repo.git both reached the mocked Git boundary as https://git.acme.invalid:2222/team/repo, although the returned dependency still held its original SSH scheme/user. The correctly configured RefResolver SSH control preserved the URL, proving this is a caller/owner seam failure rather than a missing executor capability. This bypasses the existing git-transport-selection owner's explicit-scheme decision and compounds into tag lookup and package download using different transports. No credential disclosure is asserted.

Design patterns

  • Used in this PR: Dataclass-as-value-object -- DependencyReference supplies parsed repository coordinates; Facade -- RefResolver owns remote validation and Git execution; Composition -- MarketplaceBuilder delegates reference lookup to per-host resolvers.
  • Pragmatic suggestion: none -- preserve the existing DependencyReference and TransportSelector seams instead of introducing another remote model or changing to_clone_url globally.

Suggested: Keep the parsed dependency through transport selection, use the existing canonical URL builders for the selected scheme, and forward matching transport_scheme, ssh_user, port and authentication context into resolve_version_constraint/RefResolver. Apply the same rule to _coords_from_package_locator. Extend the registered transport boundary to this consumer and pair it with public-resolver tests and executable guard mutations for dropped scheme/user; retain an explicit custom-user/custom-port SSH case.

auth-expert

  • [blocking] Preserve explicit SSH transport and user during package tag lookup at src/apm_cli/marketplace/resolver.py:878

On head 8019368, the session-only public-resolver probe declares ssh://[email protected]:2222/team/repo.git but captures git ls-remote targeting https://git.acme.invalid:2222/team/repo. DependencyReference.to_clone_url() is an HTTPS projection, not a transport-preserving URL builder. Both this branch and _coords_from_package_locator at line 843 use it, while version_resolver.py passes neither transport_scheme nor ssh_user to RefResolver, whose default is HTTPS. This violates the existing TransportSelector explicit-scheme contract and makes SSH-only package version resolution use the wrong protocol and authentication channel. The explicitly configured native RefResolver SSH control passes, locating the fault in the marketplace handoff. I reran the supplied probes with isolated HOME/APM_HOME/config/cache, scrubbed credentials, environment isolation retained across patch.dict clears, and network/unmocked subprocess calls blocked. This is mocked unit evidence, not a real Git or CLI integration run.

Suggested: Carry the parsed package DependencyReference through version resolution and use the existing transport selector and canonical URL builders. Forward the selected transport_scheme, ssh_user and port to RefResolver, preserving token-free SSH authentication. Do not globally change to_clone_url semantics. Add durable resolver tests for explicit SSH with a custom username and port.

  • [blocking] Do not inherit the catalog port for an external package at src/apm_cli/marketplace/resolver.py:880

The new package-remote tuple substitutes source.port whenever the parsed package port is None, here and in _coords_from_package_locator at line 845. None is the package's valid default-port identity, not a missing catalog setting. With a catalog at https://catalog.example.invalid:8443/catalog-owner/catalog-repo and a package at https://github.com/acme/tool, the rerun records AuthResolver.resolve('github.com', org='acme', port=8443) and RefResolver(port=8443), while remote_url still has no port. The real RefResolver authority check at ref_resolver.py:332 rejects this mismatch before the mocked ls-remote call. Both packed URL and github shorthand branches fail the port assertions. Thus valid external-package installs fail, and auth lookup is scoped to the wrong authority before the rejection. The catalog-local dict control passes. These results are from the isolated mocked unit probe rerun on 8019368, not live credentials or network.

Suggested: Once an external package identity is parsed, preserve its port exactly, including None, in both branches. Use catalog coordinates only for genuinely catalog-local sources, and derive auth scope and the RefResolver URL/configuration from the same selected identity. Add durable packed-URL and shorthand regression tests with a nondefault catalog port and a default-port package, retaining a catalog-local control.

test-coverage-expert

  • [blocking] Add a marketplace-mediated default-port regression trap; the real consumer path currently fails. at tests/unit/marketplace/test_marketplace_resolver.py:1167

The user promise is that an external HTTPS package uses its own authority, not the catalog's non-default port. Bounded searches for remote_url, version_spec, 8443, 2222 and transport_scheme in tests/unit/marketplace and the assigned integration files found no marketplace-to-package default-port scenario. The new foreign-marketplace tests mock resolve_version_constraint and use a catalog without a port. test_ssh_semver_transport_contract.py declares direct git dependencies, so it bypasses the changed marketplace resolver. A fresh session-only pytest probe used two real local bare origins, a catalog URL on :8443, a default-port HTTPS package, and current-head source-CLI subprocesses with no production mocks. Registration succeeded; install expected returncode=0 but returned 1 with 'The canonical remote URL does not match the configured host or dependency coordinates.' The identical no-port control installed the package and matched deployed skill bytes and its locked commit. This is a reproduced consumer failure plus a missing committed regression trap, not a failing committed test.

Suggested: Add a foreign-catalog-port parameter to the existing real-fixture marketplace tag-pattern scenario rather than a separate broad suite. Register an HTTPS catalog on :8443, publish the matching tag only in a default-port external HTTPS package origin, then invoke the real CLI install. Assert success, deployed skill bytes and the package commit; never replace RefResolver or subprocess. The shared fixture can be reused by test_custom_pattern_closes_install_update_outdated_lifecycle.

  • [recommended] The existing lifecycle fixtures mask the package-only-tag regression. at tests/integration/test_marketplace_tag_pattern_lifecycle.py:140

Searched the assigned marketplace integration files for version_spec, tag_pattern, resolve_version_constraint and catalog/tag references, then read the matching lifecycle fixtures. _new_scenario tags the package and _pack_and_publish_marketplace tags the catalog with the same version; the update phase repeats this. test_marketplace_producer_consumer_closure.py also explicitly publishes each package tag on the catalog. These fixtures cannot distinguish package tag lookup from the old catalog lookup. The new test_packed_url_version_spec_queries_package_remote passed in this review, but replaces RefResolver and therefore certifies only unit routing. A session-only real-Git/source-CLI control with no catalog version tags passed and checked actual deployed bytes and the lock commit; it does not create a durable regression trap or certify installed-binary lifecycle replay/update. No lifecycle test was added or adjusted by this PR.

Suggested: Extend test_custom_pattern_closes_install_update_outdated_lifecycle in place: stop mirroring package release tags onto the separate catalog origin and assert that the catalog lacks those tags. Keep its existing sequence: register catalog -> install range -> replay install -> publish the next package tag and refresh catalog metadata -> update -> converged update. Retain the deployed-file byte assertions and snapshot-equivalence assertions. This strengthens an existing lifecycle test without another expensive lifecycle module.

  • [recommended] Builder tests accept but do not defend the newly forwarded canonical remote URL. at src/apm_cli/marketplace/builder.py:872

Bounded searches for remote_url and source_url in tests/unit/marketplace and the assigned marketplace integration files found only the newly widened mock signatures for builder forwarding, not assertions that consume the argument. _MockRefResolver.list_remote_refs ignores remote_url and indexes only owner_repo. The matching TestResolveExplicitRef and TestResolveVersionRange tests in test_marketplace_builder_hermetic.py use MagicMock resolvers and do not supply source_url. The encoded-ADO lifecycle test uses an explicit 40-character SHA, which bypasses both changed list_remote_refs calls; producer-consumer closure likewise packs explicit commit SHAs. Thus the identified tests do not distinguish retaining from dropping source_url at these two changed calls. This is a specific producer contract gap, not a request for general builder coverage.

Suggested: Add one parametrized real-fixture producer test beside the existing encoded-ADO scenario, selecting an explicit tag or a version range instead of a commit SHA. Use a local bare origin reachable through the exact encoded canonical source URL, invoke pack, and assert the emitted marketplace source URL and resolved commit against the fixture. A standalone test within the existing module is justified because the current offline/dry-run SHA test deliberately bypasses remote lookup. Also make the unit resolver double record remote_url so either changed call losing the keyword fails immediately.

performance-expert

No findings.

devx-ux-expert

  • [blocking] A package on the default HTTPS port inherits the catalog's custom port and cannot resolve versions. at src/apm_cli/marketplace/resolver.py:880

A catalog registered at https://catalog.example.invalid:8443/team/catalog.git can legitimately publish https://packages.example.invalid/team/repo.git. The package's absent port means its own default port, not permission to inherit 8443. Lines 880 and 845 instead configure tag lookup with the catalog port while forwarding the package's default-port URL. An isolated public-resolver probe reached the real RefResolver and failed authority validation before any git ls-remote. The resulting instruction to re-add the dependency with its original URL cannot repair this internal mismatch. This contradicts the documented promise that remote package entries retain their own source identity.

Suggested: Keep the parsed package port, including None, in both package-coordinate branches. Use catalog authority only for catalog-local sources. Add a regression that resolves a default-port package from a :8443 catalog without changing its origin, and verify install failure leaves the manifest, lockfile, and deployments unchanged.

  • [blocking] Semver lookup silently changes an explicitly selected SSH package to HTTPS. at src/apm_cli/marketplace/resolver.py:878

For a packed source URL ssh://[email protected]:2222/team/repo.git, resolving ^1.0.0 passes https://packages.example.invalid:2222/team/repo to tag enumeration. The RefResolver constructor receives host and port but no SSH transport or username. The package URL conversion at line 878, also used at line 843, therefore loses explicit consumer intent before lookup. The shipped dependency guide explicitly promises that selected transport governs semver tag enumeration and that cross-protocol retry is opt-in. A raw v1.0.1 override bypasses enumeration, so changing only the version selector unexpectedly changes transport behavior. This is a demonstrated handoff defect, not a claim of successful SSH installation or a credential-leak finding.

Suggested: Carry the selected scheme, SSH username, and package port through the existing transport-selection and canonical-URL builders into RefResolver. Add a custom-user/custom-port SSH version-range regression that asserts the actual Git transport, alongside a raw-tag bypass control.

  • [recommended] Explain which repository supplies version tags and distinguish CLI raw tags from manifest ranges. at packages/apm-guide/.apm/skills/apm-usage/dependencies.md:258

The assigned consumer page has no version-selection example, and the shipped dependency guide says the resolver lists Git tags without naming the repository. That leaves the central behavior of this fix undiscoverable: external packages use their own repository's tags, while genuinely catalog-local packages use the catalog repository. The existing guide correctly says raw refs bypass resolution, but does not connect that distinction to apm install pkg@catalog#v1.0.1. A direct parser probe accepted that raw-tag form and rejected pkg@catalog#^1.0.0, so a range-shaped CLI example would promise a flow that does not exist.

Suggested: Add matching short examples here and in docs/src/content/docs/consumer/installing-from-marketplaces.md: apm install pkg@catalog#v1.0.1 selects a literal Git ref; an apm.yml marketplace object with version: "^1.0.0" selects the highest matching tag using source.tag_pattern. State package-versus-catalog tag ownership and that no match fails rather than falling back to a catalog tag or raw ref.

supply-chain-security-expert

  • [blocking] A default-port package inherits the catalog port and fails remote identity validation. at src/apm_cli/marketplace/resolver.py:880

The new lookup tuple combines the package hostname and clone URL with source.port whenever the package port is None. None means the package's default port, not an unspecified catalog field. At reviewed head 8019368, an isolated public-resolver probe with a catalog on :8443 and package https://git.example.invalid/team/repo requested auth for git.example.invalid, org=team, port=8443. The real RefResolver then rejected the URL because its port was None, before invoking the mocked Git executor. The same failure occurred for type=github, repo=acme/tool: auth targeted github.com:8443 while the remote URL targeted default-port GitHub. This is a concrete package-only-tag resolution failure, not demonstrated credential disclosure: both cases made zero remote calls. The duplicate fallback at resolver.py:845 has the same defect.

Suggested: Keep a parsed package's port unchanged, including None, in both tuple construction paths. Use the catalog authority only for positively identified catalog-local sources. Add foreign-catalog-port cases that exercise the real RefResolver, and keep its strict authority comparison intact.

  • [blocking] The package lookup converts explicit SSH identity into an HTTPS request. at src/apm_cli/marketplace/resolver.py:878

DependencyReference preserves explicit_scheme and ssh_user, but this tuple calls to_clone_url(), which delegates to the HTTP-oriented to_github_url(). Neither the tuple nor resolve_version_constraint configures RefResolver.transport_scheme or ssh_user. An isolated public-resolver probe for packed ssh://[email protected]:2222/team/repo.git reached the mocked executor as https://git.example.invalid:2222/team/repo, losing both SSH and the requested user. Against an actual SSH service that would attempt HTTPS on the SSH port; selecting HTTP-oriented auth also violates the token-free SSH policy expressed in host_providers.py. This is an observed transport-routing defect, not proof that real credentials were disclosed. A directly configured RefResolver with transport_scheme=ssh and ssh_user=release preserved the SSH URL in the control. The second to_clone_url() call at resolver.py:843 has the same loss.

Suggested: Carry the parsed dependency's transport, SSH user, port, and repository identity through the existing transport-selection and AuthResolver owners, and construct the matching canonical remote. Configure RefResolver consistently rather than changing global to_clone_url semantics. Add a custom-user/custom-port SSH regression case at the executor boundary.

  • [recommended] Reject invalid external package locators instead of falling back to catalog tags. at src/apm_cli/marketplace/resolver.py:837

The new helper catches DependencyReference.parse failures and returns None, which _package_version_remote treats like absence of an external source and replaces with catalog coordinates. A public-resolver probe using type=github, repo=https://git.example.invalid/team/../repo therefore resolved catalog auth, queried https://catalog.example.invalid/catalog/market.git, and returned the invalid package canonical with the catalog's pkg--v1.0.0 tag. This conflates rejected identity with a genuine catalog-local package. The legacy path also consulted catalog tags, so this is recommended fail-closed hardening of the new classifier, not a newly proven traversal exploit or completed unsafe installation.

Suggested: Propagate a safely worded validation error for a recognized external locator that cannot be parsed. Reserve catalog fallback for positively identified catalog-local sources, and assert invalid locators reach neither package auth resolution nor the tag-query executor.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

Resolve package-only tags without borrowing catalog ports or dropping SSH identity. Protect the canonical handoff with real Git consumer and producer lifecycles, catalog-local controls, and executable owner mutations.

Co-authored-by: Copilot App <[email protected]>
Keep the exhaustive semantic guard contract in sync with the newly registered marketplace package remote boundary; do not relax the inventory assertion.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator

Reviewed unpushed local candidate ad5ae5b; live PR remains ee1f31c. This candidate is not ready to ship. The two new defects are being folded within the approved scope before the next push.

APM Review Panel: needs_rework

PR #3044 repairs package-only tag resolution in covered flows, but two residual remote-identity faults still warrant in-scope rework.

panel-mode=delta; all personas and CEO: gpt-6-astra

cc Chandan Kumar (@modelpath-dev) Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

All seven actual delta panel returns were considered at ad5ae5b. The prior fixes have substantive evidence: 532 focused tests passed, and the completed exact-head packaged validation suite reports 17 passed, including one static transition-catalog check rather than 17 end-to-end executions. Test Coverage independently passed three selected packaged cases; these overlap the supplied suite and are not three additional scenarios. That completed evidence supersedes the earlier unfinished-run observations in the brief and some returns. The passing promises stand: tests/integration/test_marketplace_tag_pattern_lifecycle.py::test_catalog_local_dictionary_semver_lifecycle asserts assert (consumer.root / _SKILL_PATH).read_bytes() == _skill_document("1.0.0").encode() and _assert_same_state(installed, _snapshot(consumer)); both selector cases of tests/integration/test_marketplace_nested_https_source_lifecycle.py::test_pack_resolves_tags_using_canonical_source_url assert assert source["sha"] == commit.sha and assert_unchanged(before_failure, ArtifactSnapshot.capture(project)). These establish the exercised catalog-local and producer contracts, not universal remote-identity correctness.

Two distinct correctness faults remain. Auth and Supply Chain independently reproduced the SAME locality-classification defect at resolver.py:876: an explicit package locator sharing the catalog hostname and repository path can inherit the catalog's port, scheme and authentication coordinates despite declaring different coordinates. Supply Chain additionally showed that an invalid package port bypasses parsing on that same shortcut. Count these reports and variants as one bug, not two or three. Separately, Architecture reproduced a split identity for accepted bare cross-repository git-subdir/gitlab sources: tag lookup inherits the catalog host, while the returned dependency has no DependencyReference and reparses onto github.com. The GitHub shorthand control agrees correctly. Both reports are bounded manual unit-level reproductions with mocked boundaries, not failing durable tests, completed unsafe installations or evidence of credential disclosure. They nevertheless identify concrete wrong-remote decisions in the changed adapter. The previously passing scenarios do not exercise these forms and cannot arbitrate them away; durable regression coverage for these reproduced portability and security promises belongs with the fixes.

The material delta is therefore substantial repair plus two narrowly scoped residual identity faults, not a repeat of the initial panel's already-addressed findings. Performance found no incremental regression; Doc Writer found no actionable documentation delta and was legitimately newly active because consumer documentation and apm-guide paths changed. Those scoped conclusions do not certify the residual forms. Fold both identity corrections within the accepted package-versus-catalog scope, retaining existing source semantics and transport/auth owners rather than adding syntax or redesigning fallback. Preserve modelpath-dev's original commits and authorship, the accepted issue and Sergio authorization history, and both Daniel's and Sergio's required human reviews. The frozen-inventory repair and local results are not certification of final GitHub CI; no green-final-CI or native SSH authentication claim is made.

Aligned with: The repository used to select a version must be the same identity returned for installation, including accepted bare-source forms. Validate explicit package locators before locality shortcuts; preserve their authority and transport, and reject invalid ports before package-auth selection or tag lookup. Keep non-GitHub hosts and explicit SSH coordinates intact without changing protocol fallback or claiming native SSH authentication coverage. Retain modelpath-dev's contribution history and Daniel's and Sergio's required reviews; distinguish repaired cases from genuinely new residual findings. Repair existing marketplace source semantics without introducing new syntax or requiring consumers to duplicate package tags on the catalog.

Panel summary

Persona B R N Takeaway

| python-architect | 1 | 0 | 0 | The two prior defects are repaired, but bare cross-repo git-subdir/gitlab entries still split tag-lookup authority from the returned dependency. |

| auth-expert | 1 | 0 | 0 | Prior cross-repo cases are fixed; one same-host/path authority defect remains. Packaged exact-head evidence was incomplete at inspection; no native SSH authentication claim. |

| test-coverage-expert | 0 | 0 | 0 | Prior coverage gaps now have real-Git lifecycle regression traps. Independent packaged execution passed all 3 selected cases; no new high-confidence delta findings. |

| performance-expert | 0 | 0 | 0 | No incremental performance regression evidenced. Existing ref-listing calls retain cache ownership; the new guard consumes shared facts for four named functions. Static review only. |

| devx-ux-expert | 0 | 0 | 0 | Prior port, SSH and documentation findings are addressed; no new syntax. Exact-head focused tests: 532 passed. Packaged validation pending at inspection (unfinished log; no JUnit). |

| supply-chain-security-expert | 1 | 0 | 0 | One residual same-host/path authority-validation gap. Packaged completion is unverified; local Git rewrites do not prove native SSH credentials. |

| doc-writer | 0 | 0 | 0 | The new docs match package-versus-catalog tag selection, remote identity preservation, and literal-ref versus manifest-range behavior. No actionable delta findings. |

B = blocking-severity findings, R = recommended, N = nits. Counts are signal strength, not gates. The maintainer ships.

Top follow-ups

  1. Fold in PR: validate explicit package identity before the catalog-local shortcut, consolidating the matching Supply Chain finding into this single repair. At src/apm_cli/marketplace/resolver.py:876, parse recognized explicit URL/SSH/host-qualified locators through the existing DependencyReference owner before locality classification. Retain the declared port, including None, scheme and SSH user even when host/path match the catalog. An invalid port must fail before package-auth resolution or Git tag lookup. Preserve genuinely relative and accepted bare catalog-local controls. Add durable real-RefResolver cases for catalog :8443 versus default package port, HTTPS catalog versus deploy SSH :2222, and invalid port; extend the real-Git packaged lifecycle with same-host/path positive and rejection/state-preservation coverage. Auth and Supply Chain independently corroborate one root cause; neither demonstrates credential disclosure.

  2. Fold in PR: use one canonical package identity for both version lookup and the returned dependency of bare git-subdir/gitlab sources. At src/apm_cli/marketplace/resolver.py:853, eliminate lookup-only host defaults: resolve the accepted source through existing source semantics once and carry that same DependencyReference through lookup and return, preserving the subdirectory. Add a public-resolver regression comparing lookup authority with the returned dependency's parsed authority for both bare cross-repository forms, retaining GitHub shorthand and catalog-local controls. Extend the registered boundary/mutation guard to the return handoff rather than only named lookup edges. This is a separate version-to-install identity mismatch, not another variant of the locality-shortcut bug; keep the change within the marketplace adapter and its regression coverage.

Recommendation

Recommend folding the two precise identity repairs and their durable regression traps before shipping, starting with the explicit-locator locality and validation bypass. The passing exact-head evidence credits the earlier repairs but does not cover these residual forms. Keep the work on the original contribution history, retain both Daniel's and Sergio's mandatory human review gates, and obtain fresh exact-head validation and CI evidence after any fold. This is advisory, not merge authorization; no merge, auto-merge or reviewer change is requested.

Full per-persona findings

python-architect

  • [blocking] Use the same package identity for tag lookup and the returned dependency at src/apm_cli/marketplace/resolver.py:853

The new helper supplies the catalog host and port to bare cross-repo git-subdir/gitlab locators, but this identity exists only in the version-lookup branch. For catalog https://git.example.invalid/catalog/market.git and source {type: git-subdir, repo: team/pkg, path: plugin}, resolve_marketplace_plugin queries https://git.example.invalid/team/pkg, then returns canonical team/pkg/plugin#v1.2.3 with dependency_reference=None. Parsing that result through the existing DependencyReference owner produces github.com/team/pkg, not the repository whose tags were queried. The same result occurs for type: gitlab; the type: github control correctly uses github.com for both. This is a reproduced split-authority fault in the new adapter: version selection can bind a tag from one remote to a dependency identifying another. The original catalog-versus-package bug is therefore not repaired for these already-accepted hand-authored forms. No actual package download or credential disclosure is asserted.

Suggested: Resolve each accepted package source to one canonical DependencyReference and reuse it for both version lookup and the returned dependency, preserving its subdirectory and existing source semantics. Do not introduce a lookup-only host default. Keep the catalog-local and GitHub shorthand controls. Add a public-resolver regression asserting equality of lookup and returned dependency authority for bare cross-repo git-subdir/gitlab entries, and extend the registered boundary/mutation guard to cover this handoff.

auth-expert

  • [blocking] Preserve explicit package coordinates before the catalog-local shortcut at src/apm_cli/marketplace/resolver.py:876

On head ad5ae5b, this condition delegates locality to _is_in_marketplace_source, whose URL comparison checks hostname and repository path but ignores port, scheme and SSH username. A supported type: github dictionary with an explicit repo URL sharing the catalog's host/path therefore skips package parsing and uses the catalog reference. I executed isolated inline probes through resolve_marketplace_plugin with the actual version and RefResolver implementations, mocked catalog/auth/Git boundaries, blocked other subprocesses, and disabled pin/shadow side effects. For catalog https://git.example.invalid:8443/acme/pkg.git and package https://git.example.invalid/acme/pkg.git, the captured lookup and AuthResolver port are 8443 instead of None. For an HTTPS catalog at the same host/path and package ssh://[email protected]:2222/acme/pkg.git, lookup and auth-environment selection use HTTPS with no port or SSH user. In both cases the returned install canonical still contains the declared package URL. A different-path SSH control preserves deploy and port 2222. Thus the lookup URL, auth coordinates and environment policy agree with each other but describe the wrong remote; unchanged RefResolver strictness cannot catch that. These are mocked unit-level observations, not packaged CLI or native SSH authentication proof.

Suggested: Honor an explicit dictionary repo URL's parsed identity before applying the catalog-local shortcut, preserving its port including None and its explicit transport/user. Keep catalog inheritance for genuinely relative or catalog-local unqualified sources. Add same-host/same-path controls with differing ports and explicit SSH user/port to TestPackageVersionRemoteContract; do not weaken RefResolver validation or change transport fallback.

test-coverage-expert

No findings.

performance-expert

No findings.

devx-ux-expert

No findings.

supply-chain-security-expert

  • [blocking] Parse explicit package coordinates before classifying a dictionary source as catalog-local. at src/apm_cli/marketplace/resolver.py:876

The new _package_version_remote helper trusts _is_in_marketplace_source before parsing the locator. That existing matcher compares hostname and repository path but ignores port and SSH identity. At exact head ad5ae5b, a catalog registered as https://git.example.invalid:8443/team/repo.git and a type=github package whose repo is https://git.example.invalid/team/repo caused the real public resolver and RefResolver to request catalog auth at port 8443 and query the catalog URL, while returning the default-port package canonical. Replacing the package locator with ssh://[email protected]:2222/team/repo.git likewise queried HTTPS on 8443, discarding the explicitly requested transport, user and port. A third probe used https://git.example.invalid:invalid/team/repo: DependencyReference.parse rejected it with ValueError in isolation, but the public resolver bypassed that validation and queried the catalog. All three probes returned the mocked catalog-only pkg--v2.0.0 tag. These are the same residual classification defect, not three separate findings. The ordinary different-path authority cases are fixed, but the accepted requirement to preserve explicit package identity and reject invalid external locators is still violated when host/path coincide. No real network or credentials were used, and credential disclosure or a completed unsafe installation is not demonstrated.

Suggested: Parse and validate recognized explicit URL/SSH/host-qualified package locators through DependencyReference before trusting the catalog-local predicate, and retain their exact authority and transport even when hostname/repository match the catalog. Preserve the existing fallback for genuinely catalog-relative sources and accepted bare catalog dictionary forms. Add real-RefResolver regression cases for identical host/path with a default package port versus catalog :8443, explicit deploy SSH on :2222, and an invalid port; the invalid case must reach neither package auth resolution nor Git tag lookup.

doc-writer

No findings.


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

Validate explicit dictionary coordinates before catalog locality, preserve existing bare-source defaults, and reuse the selected reference for installation. Add same-project authority and bare-source real Git lifecycle traps plus matching owner mutations.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_with_followups

PR #3044 repairs package-tag lookup/install identity at 2e4bbb5; fold one test-only invalid-port ordering assertion to complete the scoped regression evidence.

panel-mode=delta; all personas and CEO: gpt-6-astra

cc Chandan Kumar (@modelpath-dev) Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

At exact head 2e4bbb5, architecture, auth and supply-chain reviewers agree that the prior production defects are repaired: supported explicit package coordinates are validated before locality can override them, bare sources retain their existing defaults, and version lookup and installation share the selected dependency reference. The existing adapter and enterprise sentinel remain intact. DevX, performance and documentation report no actionable delta findings. Completed evidence is substantial but bounded: 540 focused unit/component/static passes in 68.19s, 22 selected fresh-binary-run passes in 188.21s including one static case, and 11 detected-and-restored runtime mutations, not mutated-binary executions. Coverage independently reran the five dictionary lifecycle cases: 5 passed in 44.47s, overlapping rather than adding to those 22. In tests/integration/test_marketplace_tag_pattern_lifecycle.py::test_dictionary_lookup_and_install_share_identity, the passing assertions include assert (consumer.root / _SKILL_PATH).read_bytes() == _skill_document("1.0.0").encode(), _assert_same_state(installed, _snapshot(consumer)), and _assert_same_state(before_decoy, _snapshot(consumer)); these substantiate deployed package bytes, replay stability and preservation after catalog-only decoy rejection.

Coverage's remaining recommendation is real and is the highest-priority follow-up, not a production failure: test_dictionary_lookup_and_install_share_identity[invalid-port] passes on both the retained ad5ae5b binary and the fixed binary because its end-state assertions cannot distinguish early input validation from later lookup failure. The other four new cases fail on the old binary. The passing unit test tests/unit/marketplace/test_marketplace_resolver.py::TestPackageVersionRemoteContract::test_invalid_external_locator_does_not_query_catalog[same-project-invalid-port] asserts remote.assert_not_called() and auth.resolve.assert_not_called(). That proof stands at its mocked boundary; the invalid-locator mutation is also detected, but fails at the expected ValueError before reaching those no-call assertions. Neither supplies the missing integration ordering assertion. Because this concerns secure-by-default package authority and manifest identity, recommend folding the bounded test improvement now rather than treating it as polish: extend the existing invalid-port case to assert the port-validation diagnostic and no version-tag ls-remote after marketplace registration, excluding legitimate catalog fetch/branch traffic, while retaining the state-preservation assertions. Demonstrate the intended old-binary failure and fixed-binary pass.

This fold is test-only: no product behavior change, new source syntax, auth-policy redesign or native SSH expansion is warranted. Local bare Git with URL rewrites proves requested transport coordinates, not native SSH/key exchange; Git trace must not be claimed to prove credential-resolution ordering. The architect's retain-the-adapter observation requests no code change and does not become work. Preserve modelpath-dev's authorship/history and Daniel/Sergio's existing review gates. Final-head CI confirmation and any merge decision remain with the orchestrator and human reviewers; these local results do not establish either.

Aligned with: Package coordinates and the selected tag now remain consistent from lookup through installation; the remaining test fold protects invalid-input ordering. Early rejection before mocked package auth/Git is proven at unit tier; strengthen the existing CLI case to prove no version-tag query before rejection without claiming live credential coverage. Explicit HTTPS/SSH coordinates and existing bare-source defaults are preserved; the evidence does not certify native SSH authentication or live GitLab behavior. Preserve modelpath-dev's contribution and Daniel/Sergio's review gates; request only the evidence improvement justified within the accepted scope. Retain the existing adapter and parsing owners; extend one existing lifecycle case instead of introducing another parser, scenario or module.

Panel summary

Persona B R N Takeaway

| python-architect | 0 | 0 | 1 | No actionable architectural defects remain in the scoped delta: lookup and return share one reference, with bare-source defaults and the enterprise sentinel preserved. |

| auth-expert | 0 | 0 | 0 | Prior bypass fixed: None port, SSH user/port and returned ref preserved; invalid ports rejected before package auth/Git. Isolated contract: 13 passed in 3.34s. No native SSH-auth claim. |

| test-coverage-expert | 0 | 1 | 0 | Five packaged scenarios passed independently; four catch the old binary. Invalid-port early rejection still lacks a regression-sensitive integration assertion. |

| performance-expert | 0 | 0 | 0 | No incremental performance concern found: remote-operation handoffs are unchanged, and the guard still uses shared facts for four named functions. Static evidence only. |

| devx-ux-expert | 0 | 0 | 0 | At 2e4bbb5, bare-source defaults and explicit identity are preserved; failed selection preserves state. Verified packaged logs: 22 passed in 188.21s (one static). No DevX findings. |

| supply-chain-security-expert | 0 | 0 | 0 | Authority bypass repaired; identity, bare-source defaults and enterprise sentinel preserved. 29 scoped tests pass; 22 packaged passes verified. No new token-leak path found; live SSH auth unproven. |

| doc-writer | 0 | 0 | 0 | The added same-host/path authority and bare-source defaults prose matches the resolver delta. No actionable documentation findings. |

B = blocking-severity findings, R = recommended, N = nits. Counts are signal strength, not gates. The maintainer ships.

Top follow-ups

  1. Fold a test-only extension to test_dictionary_lookup_and_install_share_identity[invalid-port]: assert the port-validation error and no version-tag ls-remote in the install trace captured after registration; retain unchanged-state and missing-skill checks. The current case passes the old binary and therefore cannot catch regression of early validation. Exclude legitimate catalog fetch/branch traffic and run the extended case against both retained old and fixed packaged binaries, verifying failure for the intended reason only on the old binary. Preserve the passing unit no-auth/no-Git assertions; do not reinterpret Git trace as credential-ordering proof or expand to native SSH.
Architecture
Procedural delta: no class definitions changed. Modules below expose the changed entry points and their existing problem-space collaborators.
```mermaid
classDiagram
  direction LR
  class ResolverModule {
    <<Adapter>>
    +resolve_marketplace_plugin()
    _dependency_reference_from_packed_source()
    _package_version_remote()
  }
  class MarketplaceSource
  class MarketplacePlugin
  class MarketplacePluginResolution {
    +canonical
    +dependency_reference
    +cross_repo_misconfig_risk
  }
  class DependencyReference {
    +parse()
    +parse_from_dict()
    +to_canonical()
    +reference
  }
  class CrossRepoMisconfigRisk
  class TransportSelectionModule {
    <<Pure>>
    +initial_transport_scheme()
  }
  class VersionResolverModule {
    +resolve_version_constraint()
  }
  class RefResolver {
    +list_remote_refs()
    +close()
  }
  class AuthResolver {
    +resolve()
    +git_env_for_remote()
  }
  class TransportAuthPlatformCheck {
    _check_marketplace_package_remote()
  }
  ResolverModule ..> MarketplaceSource
  ResolverModule ..> MarketplacePlugin
  ResolverModule ..> DependencyReference : delegates parsing
  ResolverModule ..> MarketplacePluginResolution : returns
  MarketplacePluginResolution o-- DependencyReference : same selected reference
  MarketplacePluginResolution o-- CrossRepoMisconfigRisk
  ResolverModule ..> TransportSelectionModule
  ResolverModule ..> AuthResolver
  ResolverModule ..> VersionResolverModule
  VersionResolverModule ..> RefResolver
  TransportAuthPlatformCheck ..> ResolverModule : guards owner edges
  note for ResolverModule "Adapter: marketplace fields become canonical parser input; no lookup-only host authority"
  class ResolverModule:::touched
  class TransportAuthPlatformCheck:::touched
  classDef touched fill:#fff3b0,stroke:#d47600
Loading

```mermaid
Bounded runtime flow for the Git-backed semver branch used by apm install. CLI exit-code mapping is outside the assigned files; exception outcomes are shown without inventing exit codes.
```mermaid
flowchart TD
  A["apm install: resolver.py resolve_marketplace_plugin"] --> B["[I/O] get_marketplace_by_name; [NET/I/O] fetch_or_cache"]
  B --> C["_dependency_reference_from_packed_source"]
  C --> D{"Packed or accepted explicit source?"}
  D -->|yes| E["DependencyReference.parse_from_dict"]
  E -->|invalid coordinate| X["Raise ValueError before package auth/Git"]
  E -->|valid| F["dep_ref.to_canonical"]
  D -->|no| G["resolve_plugin_source; existing catalog-local git+path and host-prefix routing"]
  F --> H["_compute_cross_repo_misconfig_risk"]
  G --> H
  H --> I["_package_version_remote"]
  I --> J{"dep_ref exists?"}
  J -->|yes| K["return dep_ref"]
  J -->|no| L{"_is_in_marketplace_source?"}
  L -->|yes| M["_extract_in_repo_path_and_ref; _gitlab_in_marketplace_dependency_reference"]
  L -->|no| N["DependencyReference.parse(canonical)"]
  K --> O["dep_ref = lookup; transport_selection.py initial_transport_scheme"]
  M --> O
  N --> O
  O --> P{"transport_scheme == ssh?"}
  P -->|yes| Q["build_ssh_url or build_ado_ssh_url"]
  P -->|no| R["lookup.to_clone_url"]
  Q --> S["[I/O] _extract_auth: AuthResolver.resolve and git_env_for_remote"]
  R --> S
  S --> T["[NET/EXEC] version_resolver.py resolve_version_constraint: RefResolver.list_remote_refs"]
  T --> U{"Matching stable tag satisfies_range?"}
  U -->|no| V["Raise NoMatchingVersionError"]
  U -->|yes| W["dep_ref.reference = resolved_override; canonical = dep_ref.to_canonical"]
  W --> Y["[I/O/FS] check_ref_pin and record_ref_pin; [NET/I/O] detect_shadows"]
  Y --> Z["Return MarketplacePluginResolution with selected dep_ref and retained sentinel"]

</details>

### Recommendation

The scoped production repairs are supported; an unconditional ship_now would overstate the integration evidence. Recommend one bounded, test-only fold before final handoff: make the existing invalid-port packaged case detect early validation on the fixed binary and fail for that specific reason on the retained old binary. Do not change product behavior or expand into native SSH testing. Preserve modelpath-dev's authorship and Daniel/Sergio's review gates; the orchestrator must confirm final-head CI, and the human reviewers retain the ship decision. This advisory authorizes no merge, auto-merge or reviewer request.

<details>
<summary>Full per-persona findings</summary>

#### python-architect

- **[nit] Architecture assessment: retain the existing reference adapter**

**Design patterns**
- Used in this PR: Adapter -- resolver.py maps marketplace source fields into DependencyReference.parse_from_dict instead of implementing another coordinate parser.
- Pragmatic suggestion: none -- the current shape is the simplest correct design at this scope. This is the architectural assessment, not a requested code change.

Suggested: 

#### auth-expert

No findings.

#### test-coverage-expert

- **[recommended] Make the invalid-port lifecycle case distinguish early validation from later lookup failure.** at `tests/integration/test_marketplace_tag_pattern_lifecycle.py:792`

The invalid-port branch checks exit 1, unchanged durable state and absence of the skill, but not whether version lookup ran before rejection. The supplied old-binary log confirms this case passes on ad5ae5b, while the other four new cases fail. The public-resolver unit test correctly requires ValueError and no auth or Git calls, and the invalid-locator runtime mutation detects its removal; that is useful unit proof, not an integration regression trap for validation ordering. Scoped rg/view probes of the owned lifecycle modules for invalid-port, GIT_TRACE and the dictionary scenario found no such assertion: the existing Git trace assertion belongs to the separate SSH transport case. This is a tier-floor gap, not an observed failure of the fixed binary or a request for native SSH/authentication testing.

Suggested: Extend test_dictionary_lookup_and_install_share_identity[invalid-port], rather than adding a scenario or module. After marketplace registration, capture Git trace for install of the invalid-port dictionary source; assert the named port-validation failure and no version-tag query, excluding legitimate catalog fetch/branch traffic. Keep the existing snapshot and missing-skill assertions. Run the extended case against both retained old and fixed packaged binaries so it fails on the former for the intended early-validation reason. Keep the unit assertion that auth.resolve is not called; Git trace alone must not be presented as proof of credential-resolution ordering.

#### performance-expert

No findings.

#### devx-ux-expert

No findings.

#### supply-chain-security-expert

No findings.

#### doc-writer

No findings.

</details>

---

Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

Assert existing admission diagnostics, absence of version-tag queries and unchanged state. Preserve the distinction from direct-resolver early-validation mutations: this CLI admission control also passes the prior binary.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator

Final pushed head 810efa4, composed with main d14fa7d. No merge or auto-merge. Daniel and Sergio review requests remain intact.

Post-synthesis CI confirmation: CI and the required Merge Gate are now successful on this exact head. The complete check rollup has no pending or failed checks. Fresh GitHub state is MERGEABLE / BLOCKED; this advisory does not bypass human review or repository protection. Version-2 owner evidence is schema-valid and semantically verified for both touched owners, mapped to 15 executed functional cases.

The four specialist returns below reviewed the unchanged repaired code before the final main-only compositions; their earlier pending-run remarks are historical. The CEO assessed the final published head with fresh 540-test, 22-case, 11-mutation and owner evidence. No prior-head execution has been relabelled. The reused binary's source/build inputs are verified byte-identical, and the final-head scenarios were actually rerun.

APM Review Panel: ship_now

PR #3044 restores package-tag lookup/install identity; final-head evidence supports shipping the scoped fix, subject to required CI and human review.

panel-mode=delta; all personas and CEO: gpt-6-astra

cc Chandan Kumar (@modelpath-dev) Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

At head 810efa4 against base d14fa7d, the evidence supports the original package-remote repairs and both residual fixes: explicit dictionary coordinates cannot be overridden by catalog locality, and bare-source lookup agrees with the returned install dependency. outer3-old-binary-negative.log records four real-Git failures on the retained old binary: same-project HTTPS/SSH and bare git-subdir/gitlab; all four corresponding final-head JUnit nodes pass. Their test, tests/integration/test_marketplace_tag_pattern_lifecycle.py::test_dictionary_lookup_and_install_share_identity, includes assert (consumer.root / _SKILL_PATH).read_bytes() == _skill_document("1.0.0").encode(), proving the installed package bytes, not merely a successful exit. The requested bf0d746..810efa4 diff is empty for resolver.py, version_resolver.py, builder.py and this lifecycle module; the reviewed repairs have not changed.

The prior CEO follow-up was mistaken and should be withdrawn, not forced into an old-binary failure. Existing manifest admission invokes the canonical parser and filters the malformed plugin before package-remote resolution; the proposed raw-port diagnostic assertion therefore failed on both binaries. The corrected invalid-port case passes both as a preservation control. In tests/integration/test_marketplace_tag_pattern_lifecycle.py::test_dictionary_lookup_and_install_share_identity[invalid-port], assert "source: github requires a valid non-local owner/repository field" in output, assert version_queries == [], and _assert_same_state(before, _snapshot(consumer)) establish the actual validate diagnostic, no version-tag query after registration and unchanged captured consumer state. Separately, tests/unit/marketplace/test_marketplace_resolver.py::TestPackageVersionRemoteContract::test_invalid_external_locator_does_not_query_catalog[same-project-invalid-port] passes with remote.assert_not_called() and auth.resolve.assert_not_called() at mocked boundaries. Its mutation fails at the expected ValueError before those assertions; neither it nor CLI Git trace proves live credential ordering.

I checked the completed 810efa4 logs and JUnit: 540 focused passes; 22 selected passes comprising 19 marketplace cases, one required replay, one generated CLI sequence and one static catalog check, with zero failures/errors/skips. Eleven runtime mutations were detected and restored, nine also statically detected; lint, 63 quality tests and 80 workflow contracts completed successfully. The owner report matches the exact base/head, and mapped positive consumer and producer nodes pass for transport selection and metadata certifiability. The d050e09-built binary's SHA-256 matches the ledger, and src/build/pyproject.toml/uv.lock are byte-identical through 810efa4; the 22 scenarios were actually rerun at the final head. These completed artifacts supersede the refresh's earlier pending observations. The four delta personas report no findings; prior architecture/performance/docs reviews are historical provenance, not fresh spawns. Evidence remains bounded to local Git fixtures and mocked auth boundaries, not native SSH/key exchange or live token exchange.

Aligned with: Package coordinates, selected tags and installed bytes stay consistent across lookup, installation and replay. Malformed manifest entries retain safe admission rejection; direct-resolver early rejection has separate unit/mutation coverage without overstating credential evidence. Preserve modelpath-dev's original commits and authorship, and Daniel/Sergio's mandatory review requests; withdraw an unsupported review demand rather than manufacture work. Repair the accepted package-resolution contract without new source syntax, another parser or an unrelated authentication redesign.

Panel summary

Persona B R N Takeaway

| test-coverage-expert | 0 | 0 | 0 | Final invalid-port lifecycle passed independently. Existing admission, diagnostic, no tag query and state preservation are covered; withdraw the prior unreachable CLI regression request. |

| devx-ux-expert | 0 | 0 | 0 | No DevX findings. Test-only delta verifies existing admission, no tag lookup and unchanged state; old/fixed both pass, not a regression trap. Final packaged run incomplete. |

| auth-expert | 0 | 0 | 0 | CLI admission is a preservation control, not a regression trap; resolver unit/mutation guards early rejection before mocked auth/Git. No credential-order claim from trace; no delta findings. |

| supply-chain-security-expert | 0 | 0 | 0 | Production unchanged. Invalid-port CLI control preserves admission, no version lookup and unchanged state on old/fixed; early resolver guard is unit/mutation evidence. No native-auth or CI claim. |

B = blocking-severity findings, R = recommended, N = nits. Counts are signal strength, not gates. The maintainer ships.

Top follow-ups

Recommendation

Recommend shipping the scoped code at 810efa4 with no remaining in-scope follow-up. This is a code/evidence recommendation, not certification of merge readiness: CI workflow 36698083518 is still pending in the supplied status, not green. The orchestrator must observe required final-head CI and human reviews, preserving Daniel/Sergio's mandatory requests and modelpath-dev's authorship/history. No merge or auto-merge is authorized.

Full per-persona findings

test-coverage-expert

No findings.

devx-ux-expert

No findings.

auth-expert

No findings.

supply-chain-security-expert

No findings.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit d3c5cd9 into microsoft:main Sep 30, 2026
22 checks passed
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Sep 30, 2026
Preserve landed Claude discovery and selected-store authority from #2952, OpenCode enabled semantics from #3102, and package-remote marketplace tags from #3044. Union existing dependency-identity selectors with the standalone reader/frozen routes; regenerate combined conformance. No unmerged prerequisite branch is imported.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/marketplace marketplace.json schema, federation, authoring suite, source parity. triage/recommended Automated advice completed; not human scope approval. type/bug Something does not work as documented.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]In last version (0.30.0) It is not possible to install package with git tag

5 participants