Repository navigation
feat(marketplace): add package category option - #2637
Daniel Meppiel (danielmeppiel) merged 11 commits into
Conversation
There was a problem hiding this comment.
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
--categoryoption toapm marketplace package addandapm marketplace package set, persisting tomarketplace.packages[].categoryvia the round-trip YAML editor. - Extend YAML editor support for writing/updating
categoryon 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.
…age-category # Conflicts: # packages/apm-guide/.apm/skills/apm-usage/commands.md
|
Resolved the current-main conflict in The only content conflict was in the bundled command guide. The resolution preserves the newer upstream Fresh validation on the merged tree:
GitHub now reports the PR as mergeable. |
PR triage recommendationneeds-issue Recommendation only, not merge or scope approval. A responsible Linked issue#2625 -- open, labelled Proposed classification
Suggested next actionWait for a responsible human maintainer to record bounded scope, CODEOWNERS review requests currently include danielmeppiel and Suggested PR commentThank 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. |
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]>
APM Review Panel:
|
| 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
- [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).
- [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.
- [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.
- [DevX UX Expert] Keep the producer doc's
addexample without --category; show --category only on thesetexample. -- --category is optional for non-Codex marketplaces. Showing it on every example suggests it is mandatory. - [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 addandapm marketplace package setaccept--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]>
Co-authored-by: Copilot App <[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]>
Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| 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
mainthree times; the first auto-merge duplicated theapm-usageguide rows, resolved by keeping main's newerapm doctorrow and adding--categoryto the existing add/set rows -- resolved in 4caf9a0. - (panel: devx-ux-expert)
--categoryhelp 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
--categoryto 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
--categoryemits category in both outputs; add without it into a Codex marketplace exits 2 and restoresapm.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
addexample kept minimal;--categoryshown onset-- 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_valueand the add/set persistence tests -- removedcategory=categoryinadd.pyand"category"from_SIMPLE_FIELDSinyml_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.
e038a4e
into
microsoft:main
Description
Add
--category TEXTtoapm marketplace package addandapm marketplace package set, following the existing--tagsauthoring 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
Current-main reconciliation
mainataa8a6820in merge commit309c3f82.apm doctordocumentation while adding--categoryto the package add/set rows.main.Testing
Validation performed on the reconciled tree:
ruff check src/ tests/: passedruff format --check src/ tests/: 1,695 files already formattedgit diff --check origin/main: passedSpec conformance (OpenAPM v0.1)