Repository navigation
fix(bundle): keep a directory source package out of the bundle path - #3447
JohnnyXu (xubenqiang) wants to merge 1 commit 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
|
JohnnyXu (@xubenqiang) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
2 similar comments
|
JohnnyXu (@xubenqiang) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
JohnnyXu (@xubenqiang) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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.