fix: dedup deployed_files and scope --update to named packages (closes #1558)#1567
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes apm install --update <pkg> behavior so a named positional package update remains scoped to that package (instead of falling back to “install everything in apm.yml” when validation says it’s already present). Also canonicalizes lockfile output by deduplicating deployed_files during serialization to avoid repeated-path churn.
Changes:
- Add
commands.install._only_packages_from_validation(...)and use it to computeInstallContext.only_packagesbased on validation outcomes (including “already present” packages). - Deduplicate
LockedDependency.deployed_filesat lockfile serialization time. - Add regression tests covering
--updatescoping anddeployed_filesdeduplication.
Show a summary per file
| File | Description |
|---|---|
src/apm_cli/commands/install.py |
Computes only_packages from validation outcomes so named --update stays scoped. |
src/apm_cli/deps/lockfile.py |
Deduplicates deployed_files when serializing a lock entry. |
tests/unit/commands/test_install_phase3.py |
Adds a regression test ensuring --update owner/target only installs that package. |
tests/test_lockfile.py |
Adds a regression test asserting deployed_files is serialized as a sorted, unique list. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 2
| with ( | ||
| patch("apm_cli.commands.install._validate_package_exists", return_value=True), | ||
| patch( | ||
| "apm_cli.commands.install._install_apm_dependencies", | ||
| return_value=InstallResult(installed_count=1, diagnostics=None), | ||
| ) as install_apm, | ||
| ): | ||
| result = CliRunner().invoke(install, ["--update", "owner/target"]) | ||
|
|
| assert result.exit_code == 0, result.output | ||
| assert install_apm.call_args.args[3] == ["owner/target"] |
Addresses Copilot review on the update scoping test by making argv deterministic and avoiding brittle positional call assertions. Also folds the panel lockfile consistency follow-up by deduplicating deployed_files in memory before serialization. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Addresses the CI install.py line-budget failure by moving scoped package selection into apm_cli.install while preserving the Click boundary behavior covered by the regression test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
BBS shepherd final advisory: ship_nowThe shepherd pass folded the in-scope Copilot and panel follow-ups for the #1558 scoped-update and deployed_files dedup fix. CI is green on head 5edc25c. Folded in this run
Copilot signals reviewed
DeferredNone. Lint evidenceFull lint contract passed locally: ruff check, ruff format --check, pylint R0801, and lint-auth-signals. CI evidenceGitHub checks are green: 13 successful, 0 failing, 0 pending. CI run: https://github.com/microsoft/apm/actions/runs/26748437952 Mergeability
|
* fix(tests): skip POSIX execute-bit assertions on Windows
Two unit tests asserted st_mode & 0o111 == 0o111, which fails on
Windows because NTFS does not honor POSIX execute bits. Guard both
with pytest.mark.skipif(sys.platform == 'win32'), matching the
existing convention used elsewhere in the suite.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(scripts): guard empty PYTEST_EXTRA_ARGS array under bash 3.2
scripts/test-integration.sh runs under `set -euo pipefail`. On macOS
the default /bin/bash is 3.2, where expanding an empty array with a
bare "${arr[@]}" raises an unbound-variable error. Local integration
runs (PYTEST_EXTRA_ARGS unset) aborted before pytest with
'extra_args[@]: unbound variable'. Use the ${arr[@]+"${arr[@]}"}
guard so the empty-array expansion is safe; CI behaviour (with
PYTEST_EXTRA_ARGS set) is unchanged.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: release v0.16.1
Roll the [Unreleased] changelog into a dated 0.16.1 block and bump
pyproject.toml + uv.lock. Adds the previously-missing user-facing
entries for #1539 (apm doctor), #1566, #1569, #1567, #1553, #1552,
and #1538 surfaced by enumerating merged PRs since v0.16.0.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: parallelise macOS release integration tests to fix 20min timeout
The v0.16.1 release pipeline failed on the macOS x86_64 (Intel) build:
the consolidated job's "Run integration tests" step hit its 20-minute
timeout at ~61% progress. The tests were passing -- the slower Intel
runner simply could not finish the full suite serially in time, and the
arm64 runner was also near the edge.
Unlike ci-integration.yml, which shards the suite across four runners,
the release workflow runs the whole integration suite on a single
scarce macOS runner. Parallelise it in-process with xdist (-n 2,
matching ci-integration's per-shard width to bound shared-PAT API
concurrency) using --dist loadgroup so the home_env xdist_group markers
keep HOME-mutating tests serialized on one worker. Also raise the step
timeout to 30 minutes for headroom on the slow Intel runner.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: danielmeppiel <danielmeppiel@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Context
Fixes #1558. Positional install requests that validate as already present now keep their canonical package selection, so apm install --update does not fall through to all manifest dependencies. Lockfile serialization also canonicalizes deployed_files by removing duplicate paths before writing.
How to test
Mutation-break verified for both new regression tests.