Repository navigation
fix(pack): use the apm.yml version in the bundled plugin.json - #3408
Conversation
A stale authored plugin.json made `apm pack` produce a self-contradicting bundle: the directory came from the apm.yml version (build/<pkg>-1.0.3) while the manifest inside still declared the previous release's version. Reconcile the manifest version to apm.yml, warn when the authored value diverged, and preserve every other authored field. Closes microsoft#3351
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change aligning bundled manifest versions with apm.yml.
No open issues 🎉
What changed in this PR
Fixes the bundled-manifest version mismatch reported in #3351 by making apm.yml authoritative for the version emitted by apm pack. Authored source manifests remain unchanged.
Changes:
- Reconciles the bundled
plugin.jsonversion and warns when it differs, preserving other authored fields. - Adds regression coverage for stale, matching, and missing versions, input immutability, and bundle-directory consistency.
- Records the fix in the changelog.
| File | Description |
|---|---|
tests/unit/test_plugin_exporter.py |
Adds reconciliation tests and updates the expected bundled-version contract. |
src/apm_cli/bundle/plugin_exporter.py |
Reconciles the manifest version during export and warns on mismatches. |
CHANGELOG.md |
Documents the corrected bundle version behavior under Unreleased. |
Review effort: Balanced
|
Thank you for contributing this fix. APM starts with an issue, not an implementation (https://github.com/microsoft/apm/blob/main/CONTRIBUTING.md). Please ask a maintainer to review and accept the scope in #3351 before implementation proceeds, including whether this should update only the packed plugin.json or also the source manifests described in the issue. This PR is labelled status/deferred until then. Current review requests include Daniel Meppiel (@danielmeppiel) and Sergio Sisternes (@sergio-sisternes-epam). Generated by autopilot-pr-triage-worker. This comment is AI-generated and may contain errors. |
Co-authored-by: Copilot App <[email protected]>
Folds the microsoft#3351 scope gaps into microsoft#3408. The approved scope requires every plugin.json in the bundle output to carry the apm.yml version regardless of a previous build, a regression test on POSIX and Windows, and updated docs and CHANGELOG. The warning now names the authored manifest path so the author knows which file to fix (it is never rewritten), and an authored manifest without a version is filled silently since nothing contradicts apm.yml. The parametrized regression test seeds a stale build/<pkg>-1.0.2 and a stale .claude-plugin/plugin.json, asserts both bundled manifests (root and the hooks native copy) say 1.0.3, keeps authored and old-build bytes unchanged, and is marked windows_compat so the PR-time Windows gate runs it. CHANGELOG entry moves into the existing Unreleased Fixed section and cites (microsoft#3408). Addresses Step 0.P plan gaps G1-G6 (scope record issuecomment-6824141350). Co-authored-by: abhishekacharya200 <[email protected]> Co-authored-by: Copilot App <[email protected]>
When apm.yml declares target:, apm pack writes the source ecosystem manifest and preserves an existing one without --force, so a version bump yields both the existing skip warning and the new bundle-version warning for the same file. The reference now names --force as the regeneration path and links the Overwrite and dry-run section, keeping the page consistent with itself. Addresses panel doc-writer finding on docs/src/content/docs/reference/cli/pack.md:168. Co-authored-by: abhishekacharya200 <[email protected]> Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| DevX UX Expert | 0 | 0 | 0 | Warning wording is actionable and ASCII; apm.yml-is-canonical model matches npm/cargo; source never edited; ship. |
| Test Coverage Expert | 0 | 0 | 0 | All five scope items have targeted tests with mutation-break confirmation; ship. |
| Doc Writer | 0 | 1 | 0 | Docs and CHANGELOG match the code; one gap (no --force pointer for generated manifests), now folded. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Recommendation
Three panelists unanimous, zero open findings after the doc fold, every scope item test-covered, CI green on the merged head. Ready for maintainer review; no follow-ups to track.
Folded in this run
- (scope gap) Regression test seeds a stale
build/<pkg>-1.0.2/and a stale.claude-plugin/plugin.json, asserts the new bundle says1.0.3, and checks authored and old-build bytes are unchanged -- resolved in 3e0a296. - (scope gap) Regression test marked
windows_compat, so the PR-time Windows Compatibility Gate runs it (POSIX and Windows) -- resolved in 3e0a296. - (scope gap) Hooks case asserts the native
.claude-plugin/plugin.jsoncopy in the bundle also carries theapm.ymlversion -- resolved in 3e0a296. - (scope gap) Docs updated:
reference/cli/pack.md,producer/pack-a-bundle.md-- resolved in 3e0a296. - (scope gap) CHANGELOG bullet moved into the existing Unreleased
Fixedsection, citing (fix(pack): use the apm.yml version in the bundled plugin.json #3408) with contributor credit -- resolved in 3e0a296. - (scope gap) Warning names the authored manifest path; an authored manifest without a version is filled silently -- resolved in 3e0a296.
- (panel: doc-writer)
pack.mdpoints users with atarget:-generated manifest to--force-- resolved in 6ef3607.
Copilot signals reviewed
- Overview review 5682298404 -- NOT-LEGIT (nothing actionable): approval recommended with zero inline items; second fetch found no new comments.
Regression-trap evidence (mutation-break gate)
tests/unit/test_plugin_exporter.py::TestReconcilePluginJsonVersion::test_stale_build_and_manifest_pack_with_apm_yml_version-- deleted the_reconcile_plugin_json_versionassignment inexport_plugin_bundle; the test (andtest_uses_existing_plugin_json) FAILED as expected; guard restored.
Lint contract
On b35eac0 (merged with current main): ruff check and format --check silent, pylint R0801 clean, lint-auth-signals.sh clean, lint-architecture-boundaries.sh exit 0.
CI
23 checks pass, 3 skipping, 0 failing at b35eac0 (Build & Test, Lifecycle Smoke, Windows Compatibility Gate, Spec conformance, Merge Gate, CodeQL); license/cla pass (after 0 CI fix iterations).
Mergeability status
| PR | head SHA | CEO stance | iters | folds | defers | Copilot rounds | CI | mergeable | mergeStateStatus | notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #3408 | b35eac0 |
ship_now | 1 | 7 | 0 | 2 | green | MERGEABLE | BLOCKED | pending required review |
Convergence
1 outer iteration; 2 Copilot rounds. Final panel stance: ship_now. Closes #3351 via the existing Fixes #3351 in the PR body. Ready for maintainer review.
This panel is advisory. It does not block merge.
Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.
Co-authored-by: Copilot App <[email protected]>
Avoids landing-order conflicts with other queued PRs. Co-authored-by: Copilot App <[email protected]>
Lane L: main merged for landing
This comment was generated by an AI agent (Lane L landing desk) on behalf of Daniel Meppiel (@danielmeppiel). |
7b50e18
into
microsoft:main
Clean merge of eight main commits (#3408, #2231, #2602, #3640, #3611, #3645, #3602, #3646); no lockfile or autopilot package conflicts and apm audit --ci passes with no drift. Co-authored-by: sergio-sisternes-epam <[email protected]> Co-authored-by: Copilot App <[email protected]>
Fixes #3351.
Problem
apm packnames the bundle directory from theapm.ymlversion but takes the manifest from a disk-first read of an existingplugin.json. After a version bump, the two disagree:So the artifact's own identity contradicts its directory name, and whatever consumes that
plugin.json(host, registry, marketplace) keeps seeing the previous release.Reproduced on
mainwith a project whoseapm.ymldeclares1.0.3and whose.claude-plugin/plugin.jsonstill declares1.0.2; before this change the packed manifest kept1.0.2.Fix
export_plugin_bundlenow reconciles the manifest version to theapm.ymlversion and warns when the authored value differed, naming both versions so the author can fix the source file instead of re-bumping on every pack. Every other authored field is preserved as before (find_or_synthesize_plugin_jsonis still disk-first), and the input dict is not mutated.This matches the existing rule already documented on
build_plugin_manifest:apm.ymlis the source of truth for the generated manifest.Note on scope:
apm packdoes not write the ecosystem manifests at the repository root (.claude-plugin/plugin.json,.github/plugin/plugin.json) — those are produced by the build orchestrator — so this change does not rewrite source files. It makes the bundle it emits internally consistent.Tests
TestReconcilePluginJsonVersioncovering: stale authored version reconciled, matching version untouched and silent, missing version filled, input not mutated, and an end-to-end pack assertingbuild/demo-pkg-1.0.3/plugin.jsondeclares1.0.3.test_uses_existing_plugin_jsonasserted the old contract (authored2.0.0preserved inside atest-pkg-1.0.0bundle). Updated to the new contract with the reason documented in the test docstring; the authorednameassertion is unchanged.Verification
tests/unit/test_plugin_exporter.py: 111 passed, 5 skipped.tests/unit/bundle tests/unit/test_packer.py tests/unit/test_plugin_exporter.py: 274 passed, 5 failed — the same 5 symlink/case-sensitivity tests fail identically onmainin this Windows checkout (no symlink privilege).tests/integration/test_remaining_modules_coverage.py: 154 passed.ruff checkandruff format --checkclean on both touched Python files.tests/spec_conformancecould not be used as a signal here: it fails on Windows symlink privileges and then stalls past a 4-minute bound in this environment, unrelated to the change.