Skip to content

Add --category to marketplace package add/set - #2626

Open
Tech Guy (lukiod) wants to merge 2 commits into
microsoft:mainfrom
lukiod:feat-marketplace-category-option
Open

Tech Guy (lukiod) wants to merge 2 commits into
microsoft:mainfrom
lukiod:feat-marketplace-category-option

Conversation

@lukiod

Copy link
Copy Markdown
Contributor

Closes #2625.

Marketplace manifest entries already support a category field — the schema validates it (yml_schema.py, "must be a non-empty string") and the output mappers already emit it (output_mappers.py), per the issue's own description. The CLI only exposed --tags, so getting a category into marketplace.packages[] required a manual apm.yml edit.

Adds --category TEXT to both apm marketplace package add and apm marketplace package set, mirroring the existing --tags plumbing through yml_editor.py's add_plugin_entry/update_plugin_entry, with the same non-empty validation the schema already enforces on read (so an invalid/blank value fails immediately with an actionable message rather than persisting bad data that only fails later on check).

Verified end-to-end manually (marketplace package add ... --category "Productivity" persists correctly; --category " " fails with 'category' must be a non-empty string), plus new unit tests in test_yml_editor.py covering both the happy path and the validation error for add and set. Full marketplace test suite: 1511 passed. ruff check clean on all changed files.

Acceptance criteria from the issue:

  • Both commands accept --category
  • Invalid or blank categories fail with an actionable error
  • The field is persisted in marketplace.packages[]
  • apm marketplace check and apm pack preserve and emit category (already worked once present — pre-existing code, not touched here)
  • Command help and tests cover the new option

Marketplace manifest entries already support a category field (read,
validated, and emitted by the existing schema/output code), but the
CLI only exposed --tags, forcing manual apm.yml edits for categories.
Adds --category to both commands, mirroring the existing --tags
plumbing, with the same non-empty validation the schema already
enforces on read.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for a category field on marketplace plugin entries, including CLI flags, YAML editing logic, validation, and unit tests.

Changes:

  • Introduces category option to plugin add and plugin set commands.
  • Adds category to marketplace YAML add/update flows with validation.
  • Expands unit tests to cover category persistence and blank-category errors.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/unit/marketplace/test_yml_editor.py Adds assertions and new tests for category handling in add/update flows.
src/apm_cli/marketplace/yml_editor.py Adds _validate_category and wires category into add/update entry logic.
src/apm_cli/commands/marketplace/plugin/set.py Adds --category flag and passes it through to update fields.
src/apm_cli/commands/marketplace/plugin/add.py Adds --category flag and passes it through to entry creation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/apm_cli/marketplace/yml_editor.py Outdated
Comment on lines +154 to +157
def _validate_category(category: str) -> None:
"""Validate *category* is a non-empty string."""
if not isinstance(category, str) or not category.strip():
raise MarketplaceYmlError("'category' must be a non-empty string")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5b89a07. _validate_category() now returns the stripped value and both call sites store what it returns, so --category " Productivity " writes Productivity. Two regression tests cover the add and update paths.

Comment on lines +238 to +239
if category is not None:
new_entry["category"] = category

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5b89a07: the stripped value is what gets stored, at both call sites.

Comment thread src/apm_cli/marketplace/yml_editor.py Outdated
Comment on lines 285 to 289
if key == "subdir":
_validate_subdir(fields[key])
elif key == "category":
_validate_category(fields[key])
entry[key] = fields[key]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5b89a07: the stripped value is what gets stored, at both call sites.

@lukiod

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@danielmeppiel Daniel Meppiel (danielmeppiel) added the status/deferred Not invited for implementation now; no release commitment. label Sep 14, 2026
@sergio-sisternes-epam

Copy link
Copy Markdown
Collaborator

PR triage recommendation

needs-issue

Recommendation only, not merge or scope approval. A responsible
human maintainer must approve. Labels, automated advice, and
silence are not approval.

Linked issue

#2625 -- open, labelled status/deferred (not status/accepted).
A human maintainer withdrew prior acceptance (2026-09-12) and
recorded a capacity hold with status/deferred on the issue and
this PR (2026-09-14). Overlapping implementation: #2637.

Proposed classification

theme/governance, area/marketplace, area/package-authoring,
type/feature (aligned with #2625; this PR had no conflicting
human type/area/theme labels).

Suggested next action

Wait for a responsible human maintainer to record bounded scope,
acceptance criteria, and a review contact on #2625 before treating
this PR as in-scope. Do not rebase or extend the branch while it is
deferred. When capacity returns, coordinate with #2637 on the issue
thread, preserving authorship. This recommendation does not invite
merge.

CODEOWNERS review requests currently include danielmeppiel and
sergio-sisternes-epam. This comment does not add or remove review
requests.

Suggested PR comment

Thank you for contributing this pull request. APM starts with an
issue, not an implementation
(https://github.com/microsoft/apm/blob/main/CONTRIBUTING.md).

#2625 is the linked issue, but it is not labelled status/accepted.
A maintainer has withdrawn prior acceptance and labelled both the
issue and this PR status/deferred until bounded scope and a review
contact are recorded. Please keep discussion on #2625 rather than
opening a second issue, and please do not rebase or extend this
branch for APM while it is on hold.

This PR is labelled status/deferred. That is not acceptance,
assignment, or a merge invitation. Overlapping work is tracked on
#2637; any later review branch should be chosen with a maintainer
on the issue thread.

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) added triage/recommended Automated advice completed; not human scope approval. theme/governance Governed by policy. apm-policy, audit, enforcement, enterprise rollout. area/marketplace marketplace.json schema, federation, authoring suite, source parity. area/package-authoring apm pack/unpack, plugin authoring, vendoring guidance, bundle format. type/feature New capability, new flag, new primitive. labels Sep 16, 2026
_validate_category only checked that the stripped form was non-empty, so
`--category "  Productivity  "` passed validation and the padding was
written straight into the yml. The validator now returns the stripped
value and both call sites store what it returns.

This branch has not been deployed

No deployments
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. area/package-authoring apm pack/unpack, plugin authoring, vendoring guidance, bundle format. status/deferred Not invited for implementation now; no release commitment. theme/governance Governed by policy. apm-policy, audit, enforcement, enterprise rollout. triage/recommended Automated advice completed; not human scope approval. type/feature New capability, new flag, new primitive.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --category support to apm marketplace package add and set

4 participants