Skip to content

fix: pass scope to deps update so -g flag works correctly#575

Closed
danielmeppiel wants to merge 1 commit intomainfrom
fix/deps-update-scope
Closed

fix: pass scope to deps update so -g flag works correctly#575
danielmeppiel wants to merge 1 commit intomainfrom
fix/deps-update-scope

Conversation

@danielmeppiel
Copy link
Copy Markdown
Collaborator

Description

apm deps update -g silently ignored the scope, causing user-scope updates to resolve targets against Path.cwd() instead of Path.home(), deploy files to the wrong directory, and write the lockfile to the wrong location.

Root cause: deps/cli.py:601 called _install_apm_dependencies() without passing scope=scope. The function defaults to InstallScope.PROJECT when scope is not provided.

Fix: One line -- add scope=scope to the call.

Found during architecture audit (see WIP/scope-audit-findings.md).

Type of change

  • Bug fix

Testing

  • All 3,551 tests pass
  • Note: no integration tests exist for deps update -g -- tracked as a test coverage gap

apm deps update -g silently ignored the scope parameter, causing
user-scope updates to resolve targets against Path.cwd() instead
of Path.home(), deploy files to the wrong directory, and write
the lockfile to the wrong location.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a scope propagation bug in apm deps update so that -g/--global correctly performs a user-scope update (resolving paths and writing outputs under the user APM directory rather than the project directory).

Changes:

  • Pass scope=scope through to _install_apm_dependencies() from the deps update command.
Show a summary per file
File Description
src/apm_cli/commands/deps/cli.py Ensures deps update forwards the computed install scope to the install engine so -g updates run in user scope.

Copilot's findings

  • Files reviewed: 1/2 changed files
  • Comments generated: 1

Comment on lines 608 to 612
logger=logger,
auth_resolver=auth_resolver,
target=target,
scope=scope,
)
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a CLI-layer unit test covering apm deps update -g to ensure scope is propagated to _install_apm_dependencies as InstallScope.USER (and not defaulting to project scope). The existing deps-update tests assert other flag wiring but currently don't exercise the global/user-scope path, so this regression could reappear unnoticed.

Copilot uses AI. Check for mistakes.
@danielmeppiel
Copy link
Copy Markdown
Collaborator Author

Moving this fix into #562 which is the active architecture PR.

@danielmeppiel danielmeppiel deleted the fix/deps-update-scope branch April 4, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants