Repository navigation
fix(bundle): keep a directory source package out of the bundle path - #3447
JohnnyXu (xubenqiang) wants to merge 6 commits into
Conversation
`apm install <dir>` sends every directory with a plugin.json at its root down the local-bundle path, even when the directory is a normal APM source package with an apm.yml and no pack manifest. That path warns about an older APM version, copies the source tree verbatim and records no dependency. Only treat a directory with an apm.yml as a bundle when its lockfile carries the pack manifest written by `apm pack`; otherwise it stays a local dependency. Fixes microsoft#3443
|
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 #3443 before implementation proceeds. 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. |
The scope record on microsoft#3443 requires a regression showing that a single argument apm install DIR records a source package with apm.yml, plugin.json and .apm/skills as a local dependency identical to apm install DIR DIR, while real apm pack output (directory and archive) and legacy manifestless bundles keep the local-bundle path. The unit tests only exercise detect_local_bundle; this drives the packaged CLI. Mutation-break: disabling the apm.yml guard fails the single-arg test. Addresses scope record 6772320901 Done-when on microsoft#3443. Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot <[email protected]>
Bundle detection for directories now requires the apm pack manifest when apm.yml is present, so the deploy-a-bundle detect step, the fall-through note and the apm-usage commands reference would otherwise overstate when a plugin.json directory installs as a bundle. Adds the CHANGELOG entry. Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot <[email protected]>
A source package that has already run apm install carries an apm.lock.yaml without a pack section. The existing unit test only pinned the no-lockfile case, so a regression treating any lockfile as a pack manifest would misroute such directories to the bundle path unnoticed. Mutation-break: returning True for any lockfile fails the new variant. Addresses CEO follow-up from test-coverage-expert (panel lean, PR microsoft#3447). Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| DevX UX Expert (lean) | 0 | 0 | 0 | Removes argument-count-dependent install behavior; aligns with npm ./dir semantics. No UX regressions. |
| Python Architect (lean) | 0 | 0 | 0 | Owner-extension correct; non-pack dirs route through the canonical NormalizationPlanner; no split authority. |
| Test Coverage Expert (delta) | 0 | 0 | 0 | Fold closes the prior finding; lockfile-without-pack variant is mutation-proven. No remaining gap. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Recommendation
All prior findings are resolved, coverage is mutation-proven, and the panel has zero open findings. Ship once the contributor signs the CLA.
Folded in this run
- (panel) Installed-CLI regression (
requires_apm_binary,tests/integration/test_install_dir_source_package_lifecycle.py): single-argumentapm install DIRrecords the local dependency (apm.yml + lockfilesource: local) and deploys identically toapm install DIR DIR; realapm packdirectory and archive output still install as bundles; legacy manifestless bundles keep the warning and bundle path -- resolved in be1cf3b. - (panel) Doc drift:
consumer/deploy-a-bundle.mddetect step and fall-through note, apm-guidecommands.md, CHANGELOG Fixed entry -- resolved in 939f811. - (panel) Unit variant: a source package whose
apm.lock.yamlhas nopackkey is not a bundle -- resolved in dbc001c.
Copilot signals reviewed
- review 5739656277 -- NOT-LEGIT: quota notice only ("unable to review ... insufficient remaining quota"); no review content.
Regression-trap evidence (mutation-break gate)
test_single_argument_dir_install_matches_two_argument_dependency_install-- deleted theapm.yml/_has_pack_manifestguard; test FAILED as expected; guard restored.test_detect_local_bundle_skips_source_package_with_apm_yml[no-lockfile]-- deleted the same guard; test FAILED as expected; guard restored.test_detect_local_bundle_skips_source_package_with_apm_yml[lockfile-without-pack]-- replaced the pack-mapping check withreturn lockfile is not None; test FAILED as expected; guard restored.
Lint contract
The full CI-mirror lint chain passed on dbc001c after merging current main: ruff check and ruff format --check reported nothing, pylint R0801 scored 10.00/10, lint-auth-signals was clean, and lint-architecture-boundaries exited 0.
CI
CI on dbc001c (fork runs approved): 23 SUCCESS, 2 NEUTRAL, 1 SKIPPED, including Lint, Build & Test Shards 1-2, PR Binary Smoke, Lifecycle Smoke, Spec conformance and Merge Gate. Only license/cla is QUEUED (contributor CLA unsigned; not CI). The new installed-CLI module runs in the merge-group integration lane; at the exact head it passed locally: 9 passed in 8.08s (after 0 CI fix iterations).
Mergeability status
| PR | head | stance | iterations | folds | deferrals | copilot rounds | CI | mergeable | merge state | notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #3447 | dbc001c | ship_now | 2 | 3 | 0 | 2 | green | MERGEABLE | BLOCKED | CLA unsigned; pending required review |
Full per-persona findings
DevX UX Expert
No findings.
Python Architect
No findings.
Test Coverage Expert
Lean pass (resolved in dbc001c):
- [recommended] The source-package guard was untested for the
apm.ymlplus lockfile-without-pack-key edge, attests/unit/bundle/test_local_bundle.py:120.
A source package that already ranapm installcarries an apm.lock.yaml without a pack section, and only the no-lockfile and pack-present states were pinned.
Suggested: Parametrize the skips-source unit test with a lockfile-without-pack variant.
Delta pass: 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-merge-worker. This comment is AI-generated and may contain errors.
|
Thank you for this fix, JohnnyXu (@xubenqiang) -- the change itself is in good shape and matches the approved scope on #3443. We can only merge contributions once the Microsoft Contributor License Agreement (CLA) is signed, and this PR has been waiting on it for more than 7 days. Per our maintainer policy we are closing it for now so the queue reflects what can actually land. This is not a rejection. As soon as the CLA is signed (follow the Posted with AI assistance on behalf of Daniel Meppiel (@danielmeppiel) (APM maintainer backlog policy, 2026-11-11). |
…3604) * fix(bundle): keep a directory source package out of the bundle path (#3443) A directory with apm.yml and a root plugin.json but no pack manifest in apm.lock.yaml is an APM source package, so 'apm install DIR' now resolves it as a local dependency, matching 'apm install DIR DIR'. Real apm pack output, archives and legacy manifestless bundles keep the bundle path. Credit: approach from #3447 by @xubenqiang. Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot App <[email protected]> * docs(changelog): note single-arg source package install fix (#3604) Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: danielmeppiel <[email protected]> Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot App <[email protected]>
Fixes #3443
Problem
apm install <dir>takes the local-bundle path whenever the argument is a directory with aplugin.jsonat its root:A normal APM source package that has an
apm.yml(and noapm packlockfile) also matches, soapm install ../demo-pkgwarns that the bundle "was produced by an older APM version", copies the source tree under the target root instead of integrating it, and records no dependency. Passing the same directory twice resolves it as a normal local dependency — the outcome depends only on the argument count.Fix
A directory with an
apm.ymlis a bundle only when its lockfile carries the pack manifest written byapm pack:_has_pack_manifest()readsapm.lock.yamland checks thepackmapping. Directories withoutapm.ymlkeep the current behaviour (legacy bundles that lack a lockfile are still detected), and archives are unchanged.Verification
I called
detect_local_bundle()directly against two fixture directories (the CLI path is the only caller of this function for the reported case):Before the change:
After:
Two regression tests are added to
tests/unit/bundle/test_local_bundle.py:test_detect_local_bundle_skips_source_package_with_apm_ymltest_detect_local_bundle_keeps_packed_bundle_with_apm_ymlruff checkandruff format --checkpass on both changed files.Note on the full suite: this machine's sandbox cannot create pytest
tmp_pathdirectories (PermissionErroronpytest-of-<user>), so the two new tests were verified through the direct call above rather thanpytest tests/unit/bundle/test_local_bundle.py. The existing tests in that file are unchanged.Notes
apm.ymlstays a bundle, which the second test pins.plugin.jsoncollections withoutapm.ymlis intentionally untouched.