Skip to content

bug: apm marketplace check resolves sourceBase entries against github.com (exit 128) #1762

@leocamello

Description

@leocamello

Summary

After #1736 (closes #1519) added marketplace.sourceBase, apm pack resolves a relative package source against the declared base correctly — but apm marketplace check does not. For any entry whose effective host isn't the default (a sourceBase-composed relative source, or the pre-existing #1288 host.tld/owner/repo shorthand), check runs git ls-remote against github.com with no token and fails with exit 128, even though pack against the same apm.yml succeeds.

apm marketplace check is the CI gate the publishing guide recommends, so this blocks sourceBase authors — the feature's headline audience — from validating their marketplace in CI.

Environment

Reproduction

# apm.yml
name: sb
version: 0.0.1
marketplace:
  owner: { name: t }
  outputs: { claude: {} }
  sourceBase: https://gitlab.example.com/group/sub/team/project
  packages:
    - name: my-package
      source: my-package        # relative -> composes onto sourceBase
      version: "^0.1.0"
apm pack              # succeeds: marketplace.json has the composed gitlab URL + sha
apm marketplace check # fails:  [x] my-package -- "Git failed during ls-remote" (exit 1)

Deterministic confirmation of where check points (no network needed):

parsed entry         : host=None  source='my-package'   # sourceBase composes on the build path, not parse
check would ls-remote : https://github.com/my-package    # wrong host, no token -> exit 128

Root cause

src/apm_cli/commands/marketplace/check.py:

resolver = RefResolver(offline=offline)          # default host (github.com), no token
refs = resolver.list_remote_refs(entry.source)   # entry.source is the *relative* path; entry.host ignored

#1736 composes sourceBase at build time (MarketplaceBuilder._remote_source_coordinates), so the parsed PackageEntry keeps host=None and the relative source. check never goes through the builder, so it neither composes the base nor selects a per-host token — it just probes github.com. pack works only because composition + the per-host resolver live on the builder path that check doesn't share.

This was flagged on #1736 before merge but the routing fix didn't land with it.

Fix

PR #1763 makes check mirror the builder's routing: compose a host-less source onto sourceBase (via the shared split_source_base), honour per-entry host overrides, resolve the host's token through a shared marketplace/auth_helpers.resolve_token_for_host, and short-circuit local ./ packages. Adds three check regressions (composed → base host + token; host-prefixed override → github; local → zero ls-remote). Verified end-to-end against a real self-managed GitLab.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/marketplacemarketplace.json schema, federation, authoring suite, source parity.priority/highShips in current or next milestonestatus/in-flightA PR is open and progressing.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.type/bugSomething does not work as documented.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions