Skip to content

[BUG] copy_skill_to_target falls back to project-scope active_targets when targets=None at user scope #538

@sergio-sisternes-epam

Description

@sergio-sisternes-epam

Describe the bug
copy_skill_to_target() accepts user_scope but when targets is None,
it falls back to active_targets(target_base) which performs project-scope
auto-detection. A caller passing user_scope=True without explicit targets
would select project-scope roots instead of user-scope roots.

To Reproduce

  1. Call skill_integrator.copy_skill_to_target(...) with user_scope=True
    and targets=None
  2. The method calls active_targets() which scans project-scope directories
  3. Deployment uses root_dir instead of user_root_dir

Expected behavior
When user_scope=True and targets=None, the method should resolve
user-scope targets (e.g. via a active_targets_user_scope() helper or by
requiring explicit targets when user_scope=True).

Environment (please complete the following information):

  • OS: All (code-level bug, not platform-specific)
  • Python Version: 3.12
  • APM Version: 0.8.9
  • Affected file: src/apm_cli/integration/skill_integrator.py (line ~253)

Logs
N/A -- code-level logic issue, no runtime error logs.

Additional context
Currently low risk because the install path in install.py always passes
explicit targets. Flagged during Copilot review of #537. Options:

  1. Add an active_targets_user_scope() fallback
  2. Raise ValueError when user_scope=True and targets=None
  3. Document that callers must pass explicit targets at user scope

Related: #537, #530

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDeprecated: use type/bug. Kept for issue history; will be removed in milestone 0.10.0.needs-triageDeprecated: use status/needs-triage. Kept for issue history; will be removed in milestone 0.10.0.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions