Skip to content

feat(marketplace): add package category option - #2637

Merged
Daniel Meppiel (danielmeppiel) merged 11 commits into
microsoft:mainfrom
WilliamK112:feat/marketplace-package-category
Nov 12, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 11 commits into
microsoft:mainfrom
WilliamK112:feat/marketplace-package-category

Conversation

@WilliamK112

@WilliamK112 Ching Wei Kang (WilliamK112) commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add --category TEXT to apm marketplace package add and apm marketplace package set, following the existing --tags authoring path.

The category is persisted on the target marketplace.packages[] entry and remains independent of metadata in the source package manifest. Existing marketplace schema validation rejects blank values; the round-trip editor restores the original file when validation fails.

This also updates the CLI reference, bundled command guide, and marketplace authoring examples.

Fixes #2625

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Current-main reconciliation

  • Merged current main at aa8a6820 in merge commit 309c3f82.
  • Preserved the newer executable-trust details in the bundled apm doctor documentation while adding --category to the package add/set rows.
  • Retained the parsed-YAML assertions and bundled command-guide update requested by Copilot.
  • The PR remains limited to the same 8 implementation, test, and documentation files relative to current main.

Testing

  • Tested locally
  • All existing tests pass (full repository suite not run)
  • Added tests for new functionality

Validation performed on the reconciled tree:

  • Marketplace unit/integration tests plus CLI documentation contracts: 1,677 passed, 10 skipped
  • Focused package command/editor tests: 71 passed
  • Full ruff check src/ tests/: passed
  • Full ruff format --check src/ tests/: 1,695 files already formatted
  • Mypy passed for all changed source files
  • Architecture boundary linter passed
  • Docs build passed: 124 pages and 995 relative links checked
  • Docs link test suite: 14 passed
  • git diff --check origin/main: passed

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

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

Adds first-class --category TEXT support to marketplace package authoring commands so maintainers can set marketplace-owned package categories via CLI (parallel to the existing --tags workflow) and persist them onto marketplace.packages[].

Changes:

  • Add --category option to apm marketplace package add and apm marketplace package set, persisting to marketplace.packages[].category via the round-trip YAML editor.
  • Extend YAML editor support for writing/updating category on package entries (validated via existing schema revalidation + restore-on-failure behavior).
  • Update CLI reference + producer authoring docs examples; add unit tests for persistence and blank-value rejection.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/marketplace/test_yml_editor.py Adds coverage that category is written on add/update paths.
tests/unit/commands/test_marketplace_plugin.py Adds CLI tests ensuring --category is present and persisted; adds blank-category error/rollback checks.
src/apm_cli/marketplace/yml_editor.py Adds category to add/update entry mutation logic.
src/apm_cli/commands/marketplace/plugin/set.py Adds --category Click option and passes through to update logic.
src/apm_cli/commands/marketplace/plugin/add.py Adds --category Click option and passes through to add logic.
docs/src/content/docs/reference/cli/marketplace.md Documents the new --category flag in the CLI reference table.
docs/src/content/docs/producer/publish-to-a-marketplace.md Updates authoring examples to show --category usage.
Suppressed comments (1)

tests/unit/commands/test_marketplace_plugin.py:244

  • This assertion depends on the YAML text formatting (e.g., quoting). To test the behavior (category persisted on the target package entry), parse the YAML and assert on the loaded data structure instead of substring-matching the serialized file.
        )
        assert result.exit_code == 0, result.output
        assert "category: productivity" in yml.read_text(encoding="utf-8")


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

@WilliamK112

Copy link
Copy Markdown
Contributor Author

Resolved the current-main conflict in 309c3f82 by merging aa8a6820.

The only content conflict was in the bundled command guide. The resolution preserves the newer upstream apm doctor executable-trust text and keeps --category documented for both marketplace package add and set. The two earlier Copilot requests remain addressed.

Fresh validation on the merged tree:

  • marketplace plus CLI docs-contract coverage: 1,677 passed, 10 skipped
  • focused command/editor coverage: 71 passed
  • full Ruff, Mypy, and architecture checks: passed
  • docs build: 124 pages; 995 relative links; 14 link tests passed

GitHub now reports the PR as mergeable.

@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: #2626.

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 #2626 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
#2626; 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 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
@danielmeppiel Daniel Meppiel (danielmeppiel) removed the status/deferred Not invited for implementation now; no release commitment. label Nov 12, 2026
Bring the branch current with main (0b076ef). Git auto-merged the
apm-usage command guide by re-inserting the stale apm doctor row and
duplicate package add/set rows; resolve by keeping main's newer
apm doctor text and adding --category to the existing add/set rows.

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

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_with_followups

Adds --category to marketplace add/set, closing the Codex authoring gap for external contributor Ching Wei Kang (@WilliamK112) -- clean architecture, four in-scope polish items to fold before landing.

panel-mode=lean; personas=python-architect,devx-ux-expert,doc-writer,test-coverage-expert,apm-ceo

cc Ching Wei Kang (@WilliamK112) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

All four panelists converge: this is a well-scoped, cleanly implemented feature that mirrors the existing --tags authoring path through Click option -> yml_editor -> _write_and_validate -> yml_schema with rollback on validation failure. The python-architect returned zero findings -- a strong signal that the implementation introduces no abstraction debt. The remaining findings are all recommended-tier polish that the merge worker can fold in-PR.

The orchestrator flagged a tension between devx-ux-expert and doc-writer on the producer guide example. On inspection, these are compatible, not contradictory: devx wants the apm marketplace package add example kept minimal (no --category flag), while doc-writer wants the prose and reference table to link --category to the Codex requirement. Both are right. The add example should show the shortest viable invocation; the set example and the Codex paragraph should show --category and explain when it is required.

The test-coverage-expert surfaced a genuine scope gap: the Done-when criterion names 'replace' but no test starts from a fixture with an existing category value and asserts overwrite. The merge worker's planned end-to-end CLI-authored test covers the compose path but not this unit-level replace assertion, so both are needed. The CHANGELOG entry is a process requirement and should be folded as the final item.

Dissent. devx-ux-expert and doc-writer appear to disagree on whether --category should appear in the producer doc's add example. They target different surfaces and are compatible -- fold both: keep the add example minimal, link --category to the Codex requirement in the prose and reference row.

Aligned with: Governed by policy: Category is a catalog-owned governed field; the CLI now exposes it through the same validated, rollback-safe path as --tags, reinforcing the single-schema-owner model. Portable by manifest: Category is persisted in apm.yml, so the authoring result is manifest-portable across hosts and harnesses -- no sidecar state. Oss community driven: External contributor Ching Wei Kang (@WilliamK112) authored the feature and responded to inline review feedback. Landing this with credit reinforces the contributor flywheel. Pragmatic as npm: Mirrors the --tags flag pattern exactly: same Click option shape, same yml_editor call, same schema validation. Zero new abstractions to learn.

Growth signal. The CHANGELOG entry should credit Ching Wei Kang (@WilliamK112) by name; the release note can frame it as community-driven Codex authoring support.

Panel summary

Persona B R N Takeaway
Python Architect 0 0 0 Clean, well-scoped feature that mirrors the --tags path: Click option -> add/set -> yml_editor -> _write_and_validate -> yml_schema (canonical owner) with rollback on validation failure. No new abstraction needed.
DevX UX Expert 0 2 0 Help text for --category uses internal jargon and lacks an example value; producer doc overwrites the minimal-path example.
Doc Writer 0 2 0 Docs and apm-usage guide list --category as the scope requires. Two follow-ups: link the flag to the Codex requirement, and add the missing CHANGELOG entry.
Test Coverage Expert 0 1 0 New --category tests cover persist, blank-rejection and file-restore on both add and set; pre-existing output-mapper tests prove Claude/Codex carry category. One gap: no test overwrites an existing category value (the scope 'replace' criterion).

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

Top 5 follow-ups

  1. [Test Coverage Expert] Add a unit test that starts from a fixture with category: old-value and asserts update_plugin_entry(..., category='new-value') overwrites it. -- The scope Done-when names 'replace' as a criterion. Evidence outcome is missing (not opinion).
  2. [DevX UX Expert] Change --category help text from 'Marketplace-owned package category' to "Package category (e.g. 'developer-tools')" in both add.py and set.py; update the marketplace.md reference row to match. -- 'Marketplace-owned' is internal jargon; peer flags (--version, --tag-pattern) include an example value.
  3. [Doc Writer] In the CLI reference row and producer guide Codex paragraph, link --category to the Codex requirement. -- The scope Done-when says an entry authored with --category must satisfy the Codex requirement without hand-editing apm.yml; the docs should connect the flag to the requirement.
  4. [DevX UX Expert] Keep the producer doc's add example without --category; show --category only on the set example. -- --category is optional for non-Codex marketplaces. Showing it on every example suggests it is mandatory.
  5. [Doc Writer] Add CHANGELOG.md Unreleased/Added entry crediting Ching Wei Kang (@WilliamK112) (feat(marketplace): add package category option #2637). -- Project process requires a CHANGELOG entry for every merged PR that changes code, tests, or docs.

Recommendation

The implementation is architecturally sound (zero findings from python-architect) and all follow-ups are recommended-tier polish the merge worker can fold in-PR before landing. Highest-signal fold is the missing replace-path unit test. After the folds and CI green, this is ready for maintainer merge.


Full per-persona findings

Python Architect

No findings.

DevX UX Expert

  • [recommended] --category help text uses jargon and omits an example value, unlike peer flags at src/apm_cli/commands/marketplace/plugin/add.py:42
    --version says 'Semver range (e.g. >=1.0.0)', --tag-pattern says 'Tag pattern (e.g. v{version})'. --category says 'Marketplace-owned package category' -- 'Marketplace-owned' is an internal ownership distinction meaningless to users, and there is no example value to hint at valid input.
    Suggested: help="Package category (e.g. 'developer-tools')" in add.py and set.py; update the marketplace.md row to match.
  • [recommended] Producer doc replaces both minimal examples with --category, hiding the simplest invocation at docs/src/content/docs/producer/publish-to-a-marketplace.md:218
    --category is optional (required only when codex output is selected); showing it on every example suggests it is mandatory. Keep add minimal and show --category on the set example only.
    Suggested: Keep the add line without --category; show --category only on the set line.

Doc Writer

  • [recommended] The --category description does not say that Codex output requires a category. at docs/src/content/docs/reference/cli/marketplace.md:310
    The scope Done-when says an entry authored with --category must satisfy the Codex category requirement without hand-editing apm.yml. The reference row and click help say 'Marketplace-owned package category.' and do not tell a reader when the flag is needed; the producer guide states the Codex rule without mentioning the flag.
    Suggested: Reference row: 'Package category. Required for every package when outputs includes codex.'; same in click help; producer guide: 'When codex is selected, every package must define category (set it with --category).'
  • [recommended] CHANGELOG.md has no Unreleased entry for this PR. at CHANGELOG.md:10
    .github/instructions/changelog.instructions.md requires an entry for every merged PR that changes code, tests or docs, crediting external contributors with '-- by @username (#PR)'.
    Suggested: Under Unreleased / Added: '- apm marketplace package add and apm marketplace package set accept --category ... -- by Ching Wei Kang (@WilliamK112) (feat(marketplace): add package category option #2637)'

Test Coverage Expert

  • [recommended] set --category replace path untested: no test overwrites an existing category value at tests/unit/marketplace/test_yml_editor.py:239
    The scope record names 'replace' as a Done-when criterion. TestPackageSet::test_category_is_persisted and TestUpdatePluginHappy::test_update_category both add category to a package with no existing category field. No test starts from a fixture where category is already set and asserts --category new-value overwrites it.
    Suggested: Add a fixture with category: old-value and assert update_plugin_entry(..., category='new-value') overwrites it.
    Proof (missing at): tests/unit/marketplace/test_yml_editor.py::TestUpdatePluginHappy::test_update_category_replaces_existing -- proves: set --category overwrites an existing category value rather than silently ignoring or appending [devx]

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.

The help text said 'Marketplace-owned package category', which is
internal jargon with no example value, and neither the reference row
nor the producer guide told readers that --category is how to satisfy
the Codex per-package category requirement. Addresses panel follow-ups
from devx-ux-expert (help wording) and doc-writer (link flag to Codex).

Co-authored-by: WilliamK112 <[email protected]>
Co-authored-by: Copilot App <[email protected]>
The apm-scope:v1 record for microsoft#2625 requires tests that set replaces an
existing category and that a CLI-authored entry reaches Claude and
Codex output and satisfies the Codex category requirement without
hand-editing apm.yml. Add an editor replace test and an end-to-end CLI
class (add/set into a claude+codex apm.yml, then compose both outputs;
add without --category is rejected and the file is restored).
Mutation-break: dropping the add passthrough or the set _SIMPLE_FIELDS
entry fails 8 tests. Addresses test-coverage-expert follow-up.

Co-authored-by: WilliamK112 <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Every merged PR needs an Unreleased entry crediting external
contributors. Addresses doc-writer follow-up.

Co-authored-by: WilliamK112 <[email protected]>
Co-authored-by: Copilot App <[email protected]>
The guide's sample config selects only the claude output, where
category is optional, so the add example should show the shortest
invocation. The set example still shows --category, and the Codex
paragraph says when the flag is required. Addresses devx-ux-expert
follow-up from the PR review panel.

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

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_now

Delta pass: all five prior follow-ups folded, four delta panelists return zero findings -- Ching Wei Kang (@WilliamK112)'s --category feature is ready to land.

panel-mode=delta; personas=python-architect,devx-ux-expert,doc-writer,test-coverage-expert,apm-ceo

cc Ching Wei Kang (@WilliamK112) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

The iteration-1 advisory returned ship_with_followups with five recommended-tier items: help-text jargon fix, replace-path unit test, Codex-linkage in docs and reference row, minimal add example, and CHANGELOG credit. All five are now resolved in commits 1192c31 through a26f672. The most material fold is de90653, which delivered both the replace-path unit test and an end-to-end TestCategoryReachesMarketplaceOutputs suite covering add-with-category, add-without-category-rejected, and set-replaces-value -- with a mutation-break proof that removing the add passthrough or set _SIMPLE_FIELDS entry fails 8 of those tests.

The one follow-up that changed shape during folding was the devx 'keep add example minimal' item. The merge worker initially declined it on the incorrect premise that the producer guide's sample config selects codex output (making --category mandatory). The devx delta reviewer corrected the premise -- the sample config selects only claude -- and the worker folded it in a26f672.

Four delta panelists (devx-ux-expert, test-coverage-expert, python-architect, doc-writer) each returned zero findings against the folded head. Local lint is silent; 82 targeted tests pass; main merges landed without conflicts in PR files. No new Copilot review round was triggered. There is nothing left to fold.

Aligned with: Governed by policy: Category is a catalog-governed field now exposed through the same validated, rollback-safe yml_editor path as --tags; the end-to-end tests prove Codex output rejects a missing category at exit 2. Portable by manifest: Category is persisted in apm.yml; the authoring result is manifest-portable with no sidecar state. Oss community driven: External contributor Ching Wei Kang (@WilliamK112) authored the feature, responded to inline review, and is credited in CHANGELOG. Pragmatic as npm: Mirrors the --tags flag pattern exactly: same Click option shape, same yml_editor call, same schema validation gate.

Growth signal. The CHANGELOG entry credits Ching Wei Kang (@WilliamK112) by name; the release note can frame --category as community-contributed Codex authoring support.

Panel summary

Persona B R N Takeaway
Python Architect 0 0 0 Delta is help-text polish and well-structured integration tests; no new architectural concerns beyond prior clean review.
DevX UX Expert 0 0 0 Both prior findings folded (help text + reference row). The add-example premise was wrong (sample config selects claude only); the worker then folded the minimal add example in a26f672.
Doc Writer 0 0 0 Both prior findings are fixed. The flag text now covers the Codex requirement in the reference, producer guide and help. CHANGELOG entry credits Ching Wei Kang (@WilliamK112). No new concerns.
Test Coverage Expert 0 0 0 Prior replace-path finding resolved: test_update_category_replaces_existing_value (unit) and test_set_category_replaces_value_in_claude_and_codex (integration) both pass. 76 tests green. No new gaps.

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

Folded in this run

  • (merge) Merged current main three times; the first auto-merge duplicated the apm-usage guide rows, resolved by keeping main's newer apm doctor row and adding --category to the existing add/set rows -- resolved in 4caf9a0.
  • (panel: devx-ux-expert) --category help text now reads "Package category (e.g. 'developer-tools'); required for Codex output" -- resolved in 1192c31.
  • (panel: doc-writer) Reference row and producer guide tie --category to the Codex category requirement -- resolved in 1192c31.
  • (panel: test-coverage-expert + scope Done-when) Replace-path tests, plus end-to-end CLI-authored Claude and Codex output tests (add with --category emits category in both outputs; add without it into a Codex marketplace exits 2 and restores apm.yml; set replaces the value in both outputs) -- resolved in de90653.
  • (panel: doc-writer) CHANGELOG entry crediting Ching Wei Kang (@WilliamK112) -- resolved in 1ae0df5.
  • (panel: devx-ux-expert) Producer guide add example kept minimal; --category shown on set -- resolved in a26f672.

Copilot signals reviewed

  • tests/unit/commands/test_marketplace_plugin.py:154 -- LEGIT: assertions depended on YAML serialization; now parse the YAML (resolved in 3e498fb).
  • src/apm_cli/commands/marketplace/plugin/add.py:40 -- LEGIT: apm-usage guide lacked --category (resolved in 3e498fb).

Regression-trap evidence (mutation-break gate)

  • TestCategoryReachesMarketplaceOutputs, test_update_category_replaces_existing_value and the add/set persistence tests -- removed category=category in add.py and "category" from _SIMPLE_FIELDS in yml_editor.py; 8 tests FAILED as expected; guards restored (76 passed).

Lint contract

Full CI-mirror lint (ruff check, ruff format --check, pylint R0801, lint-auth-signals, lint-architecture-boundaries) silent at 829de4e.

CI

All 23 checks pass at 829de4e, including license/cla (after 1 CI fix iteration: rerun of an unrelated timing flake in tests/red_team/http/test_resource_exhaustion.py::TestDispatchThreadCap, then Merge Gate rerun).

Mergeability status

PR head SHA CEO stance iters folds defers Copilot rounds CI mergeable mergeStateStatus notes
#2637 829de4e ship_now 2 6 0 1 green MERGEABLE BLOCKED pending required review

Recommendation

All five iteration-1 follow-ups are folded and verified. Four delta panelists return zero findings. Lint is silent and 82 targeted tests pass, including mutation-break proof on the new guards. Ready for maintainer merge once CI confirms green at the final head.


Full per-persona findings

Python Architect

No findings.

DevX UX Expert

No findings.

Doc Writer

No findings.

Test Coverage Expert

No findings.

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.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit e038a4e into microsoft:main Nov 12, 2026
40 of 42 checks passed
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. 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