Repository navigation
[0.38] fix(marketplace): registry-routed marketplace entries install and replay (#4009) - #4017
Merged
Daniel Meppiel (danielmeppiel) merged 12 commits intoNov 22, 2026
Conversation
Closed
5 of 14 tasks
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-4009-registry-marketplace
branch
7 times, most recently
from
November 21, 2026 09:12
5024ec0 to
3fe0cf6
Compare
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 21, 2026 09:34
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 21, 2026 09:34
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Registry drift checks incorrectly reject matching SHA-shaped version labels and accept prereleases excluded by stable selectors, causing frozen replay and audit to disagree with registry resolution.
2 open issues
What changed in this PR
This PR addresses #4009 by enabling registry-backed marketplace entries to install by name and replay from the lockfile, including with --frozen, without requiring a Git commit.
Changes:
- Preserve registry-form dependencies and bypass Git validation for registry-routed entries.
- Share registry replay checks and recover registry identity for policy evaluation.
- Add lifecycle and conformance coverage, update documentation, and clarify configuration errors.
| File | Description |
|---|---|
tests/unit/marketplace/test_locked_selection_evidence.py |
Tests registry replay evidence and selector mismatches. |
tests/unit/install/test_registry_wiring.py |
Tests missing-version guidance. |
tests/spec_conformance/test_marketplace_registry_replay_reqs.py |
Adds registry lockfile conformance cases. |
tests/integration/test_marketplace_registry_entry_lifecycle.py |
Covers install, cold replay, failures, and registry policy. |
src/apm_cli/policy/policy_checks.py |
Recovers registry names for replay policy checks. |
src/apm_cli/install/registry_wiring.py |
Clarifies missing registry-version errors. |
src/apm_cli/install/package_resolution.py |
Preserves registry-form manifest entries. |
src/apm_cli/drift.py |
Adds shared registry pin and replay checks. |
src/apm_cli/deps/registry/resolver.py |
Adds a registry configuration remedy. |
src/apm_cli/commands/install.py |
Routes registry entries away from Git probes. |
packages/apm-guide/.apm/skills/apm-usage/dependencies.md |
Documents registry-backed marketplace replay. |
docs/src/content/docs/reference/manifest-schema.md |
Explains registry serialization and lock evidence. |
docs/src/content/docs/reference/lockfile-spec.md |
Documents registry marketplace lock rows. |
docs/src/content/docs/consumer/installing-from-marketplaces.md |
Explains registry install and replay behavior. |
CONFORMANCE.md |
Updates requirement coverage counts. |
CONFORMANCE.json |
Records added conformance test references. |
CHANGELOG.md |
Announces the marketplace registry fix. |
Review effort: Balanced
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-4009-registry-marketplace
branch
from
November 21, 2026 10:17
3fe0cf6 to
f17c112
Compare
Merged
4 of 8 tasks
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-4009-registry-marketplace
branch
from
November 21, 2026 11:05
f17c112 to
ea93bdc
Compare
… form A positional `apm install <plugin>@<catalog>` whose catalog entry routes to a registry was serialized as a `git:` entry and probed on Git, so it could not install. Keep the registry form (id, registry, version selector) and validate it as a registry selector instead of probing Git. Adds the installed-CLI lifecycle test for #4009. Refs #4009 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
An object-form marketplace declaration whose lock row came from a registry was always treated as unlocked, because replay evidence required a commit, so `--frozen` refused it. A registry row is locked evidence when it records its exact version, resolved URL and resolved hash, and any declared selector still accepts the locked version under the existing registry selector rules (req-lk-003, req-lk-019). The selector and complete-pin rules now each have one owner in drift.py. The registry-source policy check judges a replayed row (which names no registry) by the configured registry that owns its locked URL, as its download does, so a required-registry policy keeps applying. A registry row that no configured registry serves now gets an actionable remedy. Refs #4009 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The fail-closed lifecycle steps for an incompatible selector and an incomplete registry pin now assert the --frozen out-of-sync refusal for the declaration, and a unit test pins the distinct replay-evidence reasons. A registry-routed reference with no version (an id:/registry: entry or a catalog entry with registry:) no longer suggests the git: URL form; it says the catalog entry or apm.yml entry must name a version selector. Refs #4009 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…eplay Spec-conformance tests pin that a registry-routed marketplace row replays on resolved_url and resolved_hash without a commit (req-lk-003), that its registry-resolved version is the replayed selection (req-lk-019), and the named refusal reasons. CONFORMANCE.* regenerated from the full spec suite. Refs #4009 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…log replay The scripted Registry HTTP API gateway now serves only seeded packages (#4015 extracted it into tests/utils/local_package_registry.py), so the scenario seeds acme/widget 1.0.0 and simulates changed bytes with the registry's wrong-bytes download fault instead of swapping a served archive. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… replay The marketplace consumption guide no longer says registry-routed entries always re-resolve through the catalog. The guide, lockfile reference, manifest schema and apm-usage dependencies resource describe the registry form written by `apm install plugin@catalog` and the registry lock evidence (exact version, resolved URL, resolved hash, no commit) that replays under --frozen. One CHANGELOG line. Refs #4009 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… rule (#4009) Range coverage used match_version, so a stable range such as ^1.0.0 accepted a locked 1.1.0-rc.1 that the resolver's pick_best would never select. Coverage now asks pick_best, so replay and audit apply the same pre-release eligibility rule. The registry marketplace check also drops its Git-SHA special case: a 40-hex registry version label that equals the locked version is an unchanged selection, not drift. Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-4009-registry-marketplace
branch
from
November 21, 2026 12:31
ec8ba4c to
38f957a
Compare
This was referenced Nov 21, 2026
Co-authored-by: Copilot App <[email protected]>
5 of 9 tasks
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
test_metrics_json_counts re-walked the repository minutes after the linter run, while tests on other xdist workers kept writing files, so its count drifted by one on #4017 integration shard 8 (4959 != 4960, twice). The fixture now snapshots the inventory just before and just after the run; the count must match one of them, and a mismatch names the paths that changed. Co-authored-by: Copilot App <[email protected]>
chessMan (mohitmishra786)
pushed a commit
to mohitmishra786/apm
that referenced
this pull request
Nov 22, 2026
With coverage parallel = true, an xdist worker that finishes early writes .coverage.<host>.<pid>.<random> at the repository root while the others still run. A linter walk and a later re-walk could then disagree by one file, flaking test_metrics_json_counts_reflect_a_read_once_parse_once_clean_run (4959 != 4960 on microsoft#4017 integration shard 8). Root-level .coverage and .coverage.* files are generated (gitignored), so the inventory skips them like apm_modules. .coveragerc and nested names are still inventoried. Co-authored-by: Copilot App <[email protected]>
…idence Both sides added a branch to marketplace_ref_mismatch and a bullet to the marketplace docs: registry-routed entries (#4009) and local catalogs (#4639). They are disjoint (source registry vs local), so keep both. Co-authored-by: Copilot App <[email protected]>
The main merge left marketplace_ref_mismatch with 9 returns (PLR0911, limit 8). Fold the registry (#4009) and local-catalog (#4639) dispatch into _non_git_marketplace_mismatch; the Git evidence checks stay in place so the marketplace-locked-evidence owner routes still hold. Co-authored-by: Copilot App <[email protected]>
5 of 14 tasks
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-4009-registry-marketplace
branch
November 22, 2026 09:27
Merged
3 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
TL;DR
A catalog entry routed to a package registry (
registry:inmarketplace.json) can now be installed by name and replayed with--frozen.Positional
apm install plugin@catalogwrites the registry form toapm.yml, never agit:entry, and validates it without probing Git or GitHub.An object-form
{name, marketplace}declaration replays its registry lock row (exact version,resolved_url,resolved_hash, no commit) without reading the catalog.The lockfile format,
lockfile_versionand the OpenAPM spec are unchanged.Closes #4009
Note
The lifecycle test reuses main's scripted Registry HTTP API gateway from
tests/integration/test_registry_redirect_origin_lifecycle.pyas it is. #4015 moves that fixture intotests/utils, so this import may need to follow it on rebase.Problem (WHY)
apm install plugin@catalogserialized the registry reference through a Git-only helper (install/package_resolution.py::dependency_reference_to_yaml_entry), so it wrotegit: <url>with a semverref:and failed atgit ls-remote.commands/install.py, because the probe-skip predicate only covers default-registry shorthands.drift.py::marketplace_ref_mismatchdemanded a full commit for every marketplace row ("missing locked commit evidence"), so a registry row was always unlocked and--frozenrefused it.sourced from registry 'None'and blocked it.These break the existing registry lock contract, which already defines registry identity without a commit: req-lk-003 ("For every registry-sourced dependency entry the consumer MUST instead record
resolved_urlandresolved_hash") and req-lk-019 ("the registry-resolvedversionMAY remain the exact registry selection used for reinstall, but the integrity anchor is the recordedresolved_hash").Approach (WHAT)
dependency_reference_to_yaml_entrydelegates registry references toDependencyReference.to_apm_yml_entry()(id,registry,version).commands/install.pyvalidates asource == "registry"reference as a registry selector instead of probing Git.marketplace_ref_mismatchaccepts a registry row whenhas_complete_registry_pinholds and any declared selector passesregistry_selector_mismatch. Both rules now have one owner indrift.py, shared with existing registry drift detection and the--frozenpin check._check_registry_sourcerestores a missing registry name from the lockfile URL through the existingdependency_ref_with_registry_name_from_lockfile, as the download path already does._resolve_registry_urlgives a configuration remedy when no configured registry serves a locked row.validate_registry_reftells a registry-routed reference with no version that the catalog orapm.ymlentry must name a version, instead of suggesting thegit:URL form.Implementation (HOW)
src/apm_cli/install/package_resolution.py,src/apm_cli/commands/install.py: write and validation routing only. The sharedshould_skip_github_probe_for_deppredicate is unchanged, becausepackage_resolutionalso uses it for comparisons.src/apm_cli/drift.py: adds a registry branch in the single replay-evidence owner, which install, frozen preflight (install/plan.py) and audit (policy/ci_checks.py) already route through.detect_ref_changeandbuild_download_ref(the--frozenpin check) now call the extracted helpers. Git and semver marketplace evidence is unchanged.src/apm_cli/policy/policy_checks.py:_check_registry_sourcetakes the lockfile it already receives. The name is restored only for registry deps that carry none, using the existing longest-prefix URL match.src/apm_cli/install/registry_wiring.py: changes only the message for a registry-routed reference with no version. The default-registry shorthand message and itsgit:hint are unchanged.src/apm_cli/deps/registry/resolver.py: changes only the_resolve_registry_urlmessage, which now names the configuration remedy (add the registry to theregistries:block inapm.yml). Thedownload_from_lockfileURL check is untouched (mirror tolerance is Registry replay rejects a moved or mirrored endpoint before checking the hash (req-rs-009) #4013).Architecture impact:
owner-extensionofdrift.marketplace_ref_mismatch, the existing single owner, whichtests/integration/test_architecture_marketplace_locked_evidence.pyalready guards. No new owner or second routing path, so the existing static guard covers the change.Trade-offs
apm install plugin@catalogkeeps writing resolved coordinates, now in registry form. Persisting{name, marketplace}from positional installs belongs to [FEATURE] Persist marketplace object-form deps; accept SHA catalog pins #2903 ([0.38] feat(marketplace): root apm.yml marketplaces: map and marketplace.allow policy #4006).resolved_url.--frozenerror ordering. For any registry dependency,--frozenreports the generic "restored MCP declarations differ" refusal before the hash-mismatch or missing-registry error. The run still fails closed with nothing extracted. The tests assert the specific message on plaininstall. After [0.38] fix(registry): lockfile replay tolerates a mirror URL when the hash matches (#4013) #4022 lands, the --frozen fail-closed tests can assert the specific hash/registry message.Benefits
--frozenwith zero catalog, Git or GitHub connections (asserted on every proxy observation after setup).--frozenand coldinstall.registries:remedy.Docs re-home after #3996
consumer/installing-from-marketplaces.md, "Locked entries replay the lockfile"apm installandapm install --frozenreplay the locked commit" bullet)reference/lockfile-spec.mdreference/manifest-schema.mdpackages/apm-guide/.apm/skills/apm-usage/dependencies.mdCHANGELOG.md[0.37.0]### Fixedin the new[Unreleased]above[0.37.0]Rebase onto v0.37.0 (decisions taken under rule S15)
commands/install.py: 0.37 added theidentity_policy_refusesgate before the Git probe. The registry-source condition sits inside that gate (not denied and (dep_ref.source == "registry" or ...)), so a denied registry entry still refuses before any contact. The file is 2084 lines (cap 2100).deps/registry/resolver.py: the 0.37 rulecontracts-tooling-remediation-advicerejects free-text advice to run a state-changingapmcommand. The message keeps the configuration remedy the scope record asks for (theregistries:block) and drops theapm config set .../re-run apm installadvice. The alternative, a newcore/remediation.pycatalog entry with its own installed-CLI proof, was out of scope.test_registry_marketplace_frozen_replay_fails_closed: 0.37 prints the cause line before the--frozenheader, so the test asserts the header and the cause as separate substrings. The refusal and its cause are unchanged.CONFORMANCE.mdandCONFORMANCE.json: regenerated on the rebased tree (req-lk-003 11/12, req-lk-019 13/14).#4015moved the scripted Registry HTTP API totests/utils/local_package_registry.py, which serves only seeded packages. The lifecycle scenario now seedsacme/widget 1.0.0and simulates changed bytes with the registry'swrong-bytesdownload fault (its own test commit).e2e+promise("P-OWN-marketplace-locked-selection", "req-lk-003", "req-lk-019")andunit+promise("req-lk-003", "req-lk-019")). The spec module tests a pure function, so it isunit, notcomponent(assertion-quality AQ003).drift.marketplace_ref_mismatchkeeps 8 returns (PLR0911) by extracting_registry_marketplace_mismatch.### Fixedlines. The marketplace guide anddependencies.mdnow say a registry-routed catalog entry replays "through a registry declared inapm.yml, like any registry dependency", not "from the configured registry that owns the locked URL". That wording would have contradicted [0.38] fix(registry): lockfile replay tolerates a mirror URL when the hash matches (#4013) #4022's mirror and moved-endpoint fallback.Issue and approved scope
Issue: Closes #4009
Human scope-approval comment: #4009 (comment) (
scripts/governance/eligibility.cjsreportsrecord-present; review contact Daniel Meppiel (@danielmeppiel)).Does this PR complete the issue, or what remains? It completes the record's Done when. Mirror tolerance (#4013) and URL-named catalog registries are out of scope.
Type of change
Testing
3fe0cf6(33 pass, 11 skipping), rebased onto main after [0.38] fix(registry): lockfile replay tolerates a mirror URL when the hash matches (#4013) #4022 and [0.38] test(registry): enterprise registry lifecycle stage 1 (#3299) #4015, including both Lifecycle Smoke shards, the Spec conformance gate, Build & Test and the Windows gatesScenario Evidence
apm install widget@corpfor a registry-routed entry writes{id, registry, version}and a registry lock row with marketplace association and no commit, contacting only the registrytests/integration/test_marketplace_registry_entry_lifecycle.py::test_positional_registry_marketplace_install_replays_frozen--frozenand plaininstall: identical bytes, unchanged lock, no catalog...::test_positional_registry_marketplace_install_replays_frozen,...::test_object_form_registry_marketplace_declaration_replays_frozen...::test_registry_marketplace_frozen_replay_fails_closed...::test_required_registry_policy_applies_to_registry_marketplace_replaytests/unit/marketplace/test_locked_selection_evidence.py::test_registry_row_is_locked_evidence_without_a_commit,::test_registry_row_refusal_names_its_reasonresolved_url+resolved_hashwithout a commit, and its registryversionis the replayed selectiontests/spec_conformance/test_marketplace_registry_replay_reqs.py(req-lk-003,req-lk-019)tests/unit/install/test_registry_wiring.py::TestValidateRegistryRef::test_registry_routed_ref_without_version_names_the_entry_not_gitMutation-break checks:
marketplace_ref_mismatchfails 4 unit cases.api.github.comconnection.Validation output
Changelog
## [Unreleased](above[0.37.0]) inCHANGELOG.md(bottom of### Fixed)Spec conformance (OpenAPM v0.1)
tests/spec_conformance/test_marketplace_registry_replay_reqs.pyadds@pytest.mark.req("req-lk-003")and@pytest.mark.req("req-lk-019")tests;CONFORMANCE.{md,json}regenerated from the full spec suite (645 collected).How to test
uv run --extra dev pytest tests/integration/test_marketplace_registry_entry_lifecycle.py -qpasses 4 tests.uv run --extra dev pytest tests/unit/marketplace/test_locked_selection_evidence.py -qpasses.apm experimental enable registries, add a local catalog whose entry hasregistry:, runapm install plugin@catalog.apm.ymlshowsid/registry/version, and after deletingapm_modules/and the catalog,apm install --frozenreinstalls the same files.Co-authored-by: Copilot [email protected]