feat(marketplace): inherit description/version from local-path apm.yml#1581
Draft
imbabamba wants to merge 2 commits into
Draft
feat(marketplace): inherit description/version from local-path apm.yml#1581imbabamba wants to merge 2 commits into
imbabamba wants to merge 2 commits into
Conversation
Local-path packages (`source: ./...`) now use the same fallback as remote sources when the curator entry under `marketplace.packages` omits `description` or `version`: `apm pack` reads the field from the package's own `apm.yml` and writes it to `marketplace.json`. A curator-side value still wins when set. Path resolution is constrained to the project root, and a source that resolves to the marketplace's own `apm.yml` is skipped. Follow-up to microsoft#1061, which added the same behavior for remote sources.
246ac18 to
023c1be
Compare
|
@imbabamba please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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.
TL;DR
apm packnow auto-fillsdescriptionandversioninmarketplace.jsonfrom each local-path package's ownapm.yml--the same fallback the remote source path has used since #1061.
A curator-side value under
marketplace.packagesstill wins whenset, and the local read is path-traversal-guarded against the
project root. Validated against the full unit suite (15837 tests)
with 13 new tests covering the local fallback path.
Problem (WHY)
The remote branch in
ClaudeMarketplaceMapper.composealready readsdescriptionandversionfrom each resolved package's ownapm.ymlwhen the curator entry omits them;_fetch_remote_metadatapopulates that lookup over HTTPS.
The local branch had no such fallback. It emitted only what the
curator wrote in root
apm.yml'smarketplace.packages[]. A stalecomment in
_prefetch_metadataeven claimed "Local-path packages areskipped (they carry their own metadata)" -- but the local code path
never read any metadata at all.
For a monorepo marketplace using
source: ./plugins/<name>entries,that gap leaves producers with two options:
apm.yml'smarketplace.packages[]and eachplugins/<name>/apm.yml. Thetwo copies drift over time -- the producer edits one and forgets
the other.
apm packto keep them aligned.Remote sources do not have this gap. This PR closes it for local
sources by mirroring the existing remote behavior exactly.
Approach (WHAT)
builder._prefetch_metadata{}under--offline.--offline). Returns one dict the mapper consumes the same way regardless of source kind.builder._fetch_local_metadata<project_root>/<subdir>/apm.yml, extractsdescriptionandversion. Path-traversal-guarded viaensure_path_within. Skips a source that resolves to the project root itself.output_mappers.ClaudeMarketplaceMapper.compose(is_localbranch)docs/reference/manifest-schema.mddescriptionrow read "Pass-through tomarketplace.json" with no mention of the fallback.marketplace.packagestable covers the fallback for both source kinds.Remote-source override semantics are unchanged, including the
verbose diagnostic that logs divergence between curator and package
manifest. Local sources log the equivalent diagnostic with
(package: ...)instead of(remote: ...).Implementation (HOW)
src/apm_cli/marketplace/builder.py_fetch_local_metadata(pkg), mirroring the_fetch_remote_metadatashape -- readspkg.subdirfrom disk, validates path containment, returns dict orNone._prefetch_metadatarewritten to process local packages serially first (no thread pool needed), then remote concurrently. Stale "Local-path packages are skipped" comment removed.src/apm_cli/marketplace/output_mappers.pyis_localbranch inClaudeMarketplaceMapper.composereadsmeta = remote_metadata.get(pkg.name, {})and applies the same curator-wins-else-meta hierarchy as the remote branch. Verbose diagnostic on divergence.tests/unit/marketplace/test_builder.pyTestFetchLocalMetadataclass -- 8 tests: happy path (description + version), description-only, missing apm.yml, missing subdir, path-escape, project-root edge, malformed YAML, emptysubdirfield.tests/unit/marketplace/test_local_path_compose.pyapm.yml.docs/src/content/docs/reference/manifest-schema.mdmarketplace.packagestable covering the fallback rule.Edge cases handled
apm.yml: returnsNone; no key emitted.None; error logged at debug level;the build continues.
ensure_path_withinraises;_fetch_local_metadatacatches and returnsNone.returns
Noneso the marketplace's ownapm.ymlis never readas a package manifest.
subdiron theResolvedPackage: defensive earlyreturn.
--offline: local reads always run (filesystem, no network);remote reads are still skipped.
Validation evidence
Tests:
15837 passed, 1 skipped, 21 xfailed(fulltests/unit+tests/test_console.py, ~1:25).1418 passedacrosstests/unit/marketplace, including the 13 new tests added in thisPR.
Follow-up to #1061
#1061 added the remote-source fallback (
_fetch_remote_metadata)to close the "remote-source pass-through metadata dropped" gap.
The same gap existed for local sources. This PR closes it.