Skip to content

fix(install): honor targets: (plural) without singular target: present (closes #1503)#1560

Merged
danielmeppiel merged 2 commits into
mainfrom
fix/targets-plural-no-copilot-leak-1503
May 30, 2026
Merged

fix(install): honor targets: (plural) without singular target: present (closes #1503)#1560
danielmeppiel merged 2 commits into
mainfrom
fix/targets-plural-no-copilot-leak-1503

Conversation

@danielmeppiel
Copy link
Copy Markdown
Collaborator

Fixes #1503.\n\n## Summary\n- honors parsed apm_package.targets when target: is absent\n- prevents the legacy greenfield copilot fallback from being merged back into v2-resolved canonical targets\n- adds regression tests for install run() and run_targets_phase()\n\n## Validation\n- PYTHONPATH=src /Users/danielmeppiel/Repos/awd-cli/.venv/bin/python -m pytest tests/unit/install/phases/test_targets_phase.py tests/unit/install/phases/test_targets_phase_v2.py tests/unit/install/phases/test_read_yaml_targets_list_form.py -q\n- /Users/danielmeppiel/Repos/awd-cli/.venv/bin/ruff check src/ tests/ --quiet\n- /Users/danielmeppiel/Repos/awd-cli/.venv/bin/ruff format --check src/ tests/ --quiet

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 30, 2026 15:27
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 regression in the install targets phase where specifying only the plural targets: field in apm.yml could still result in legacy greenfield auto-detection re-injecting the copilot target into the final deployment set.

Changes:

  • Read targets consistently from the parsed APMPackage model (supporting both target and targets) and normalize them for v2 resolution.
  • Prevent legacy-only canonical targets (notably copilot) from being merged back into the v2-resolved canonical target set.
  • Add regression tests covering run() and run_targets_phase() behavior when only targets: is present.
Show a summary per file
File Description
src/apm_cli/install/phases/targets.py Adds helpers to read/normalize target vs targets, and adjusts legacy/v2 merge logic to avoid reintroducing canonical fallbacks.
tests/unit/install/phases/test_targets_phase.py Adds regression test ensuring targets: [claude] does not deploy .github/ when target: is absent.
tests/unit/install/phases/test_targets_phase_v2.py Extends v2 phase tests to cover apm_package.targets driving directory materialization without .github/.

Copilot's findings

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

Comment on lines +159 to 163
# Get config target from apm.yml if available.
config_target = _package_target_value(ctx.apm_package)

# Resolve effective explicit target: CLI --target wins, then apm.yml
_explicit = ctx.target_override or config_target or None
Ensure plural-target parsing errors raised from the package model stay on the targets-phase UsageError path with logger formatting and exit code 2, addressing Copilot inline review and panel follow-ups for PR #1560. Add regression traps for run() and run_targets_phase(), plus the release-note entry for issue #1503.

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

APM Review Panel: ship_now

PR #1560 now honors manifest targets: without leaking the legacy Copilot target, and the folded follow-up keeps target schema conflicts on the intended usage-error path.

cc @sergio-sisternes-epam -- a fresh advisory pass is ready for your review.

The panel signals converged after one fold: Copilot, Python architecture, CLI logging, DevX UX, and test coverage all pointed at the same target-conflict error path. That has been fixed with regression tests for both run() and run_targets_phase(), plus the release-note entry requested by the growth lens. Security and docs had no remaining in-scope concerns.

Folded in this run

  1. [copilot] _package_target_value() raised UsageError before targets-phase handling in run() -- resolved in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.
  2. [panel] Preserve logger formatting and exit code 2 for target/targets conflicts in run() and run_targets_phase() -- resolved in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.
  3. [panel] Add CHANGELOG entry for the install targets bug fix -- resolved in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.

Copilot signals reviewed

  1. 3328940822 at src/apm_cli/install/phases/targets.py:173: LEGIT -- the early package-model target parse could bypass the existing UsageError handler and turn a user schema error into the wrong install failure path. Folded in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.

Deferred

None.

Validation evidence

  • Targeted tests: PYTHONPATH=.../driver-1560-wt/src .../.venv/bin/python -m pytest tests/unit/install/phases/test_targets_phase.py::test_plural_targets_without_singular_does_not_keep_legacy_copilot_fallback tests/unit/install/phases/test_targets_phase.py::test_run_conflicting_target_fields_exits_with_usage_code tests/unit/install/phases/test_targets_phase_v2.py::test_plural_yaml_targets_attribute_creates_only_declared_dir tests/unit/install/phases/test_targets_phase_v2.py::test_run_targets_phase_conflicting_target_fields_exits_with_usage_code tests/integration/test_target_resolution_e2e.py::test_s05c_apm_yml_both_target_and_targets_error -q -> 5 passed.
  • Mutation-break: removing the new run() UsageError guard made test_run_conflicting_target_fields_exits_with_usage_code fail; restoring it passed. Removing the new run_targets_phase() guard made test_run_targets_phase_conflicting_target_fields_exits_with_usage_code fail; restoring it passed.
  • Lint: ruff check src/ tests/, ruff format --check src/ tests/, pylint R0801, and scripts/lint-auth-signals.sh passed locally.
  • CI: gh pr checks 1560 --repo microsoft/apm --watch observed all checks successful on ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.

Mergeability snapshot

PR Head CEO stance Iterations Folds Deferrals Copilot rounds CI Mergeable Merge state Notes
#1560 ad08ac3 ship_now 1 3 0 2 green MERGEABLE BLOCKED pending required review

This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.

2 similar comments
@danielmeppiel
Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_now

PR #1560 now honors manifest targets: without leaking the legacy Copilot target, and the folded follow-up keeps target schema conflicts on the intended usage-error path.

cc @sergio-sisternes-epam -- a fresh advisory pass is ready for your review.

The panel signals converged after one fold: Copilot, Python architecture, CLI logging, DevX UX, and test coverage all pointed at the same target-conflict error path. That has been fixed with regression tests for both run() and run_targets_phase(), plus the release-note entry requested by the growth lens. Security and docs had no remaining in-scope concerns.

Folded in this run

  1. [copilot] _package_target_value() raised UsageError before targets-phase handling in run() -- resolved in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.
  2. [panel] Preserve logger formatting and exit code 2 for target/targets conflicts in run() and run_targets_phase() -- resolved in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.
  3. [panel] Add CHANGELOG entry for the install targets bug fix -- resolved in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.

Copilot signals reviewed

  1. 3328940822 at src/apm_cli/install/phases/targets.py:173: LEGIT -- the early package-model target parse could bypass the existing UsageError handler and turn a user schema error into the wrong install failure path. Folded in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.

Deferred

None.

Validation evidence

  • Targeted tests: PYTHONPATH=.../driver-1560-wt/src .../.venv/bin/python -m pytest tests/unit/install/phases/test_targets_phase.py::test_plural_targets_without_singular_does_not_keep_legacy_copilot_fallback tests/unit/install/phases/test_targets_phase.py::test_run_conflicting_target_fields_exits_with_usage_code tests/unit/install/phases/test_targets_phase_v2.py::test_plural_yaml_targets_attribute_creates_only_declared_dir tests/unit/install/phases/test_targets_phase_v2.py::test_run_targets_phase_conflicting_target_fields_exits_with_usage_code tests/integration/test_target_resolution_e2e.py::test_s05c_apm_yml_both_target_and_targets_error -q -> 5 passed.
  • Mutation-break: removing the new run() UsageError guard made test_run_conflicting_target_fields_exits_with_usage_code fail; restoring it passed. Removing the new run_targets_phase() guard made test_run_targets_phase_conflicting_target_fields_exits_with_usage_code fail; restoring it passed.
  • Lint: ruff check src/ tests/, ruff format --check src/ tests/, pylint R0801, and scripts/lint-auth-signals.sh passed locally.
  • CI: gh pr checks 1560 --repo microsoft/apm --watch observed all checks successful on ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.

Mergeability snapshot

PR Head CEO stance Iterations Folds Deferrals Copilot rounds CI Mergeable Merge state Notes
#1560 ad08ac3 ship_now 1 3 0 2 green MERGEABLE BLOCKED pending required review

This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.

@danielmeppiel
Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_now

PR #1560 now honors manifest targets: without leaking the legacy Copilot target, and the folded follow-up keeps target schema conflicts on the intended usage-error path.

cc @sergio-sisternes-epam -- a fresh advisory pass is ready for your review.

The panel signals converged after one fold: Copilot, Python architecture, CLI logging, DevX UX, and test coverage all pointed at the same target-conflict error path. That has been fixed with regression tests for both run() and run_targets_phase(), plus the release-note entry requested by the growth lens. Security and docs had no remaining in-scope concerns.

Folded in this run

  1. [copilot] _package_target_value() raised UsageError before targets-phase handling in run() -- resolved in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.
  2. [panel] Preserve logger formatting and exit code 2 for target/targets conflicts in run() and run_targets_phase() -- resolved in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.
  3. [panel] Add CHANGELOG entry for the install targets bug fix -- resolved in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.

Copilot signals reviewed

  1. 3328940822 at src/apm_cli/install/phases/targets.py:173: LEGIT -- the early package-model target parse could bypass the existing UsageError handler and turn a user schema error into the wrong install failure path. Folded in ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.

Deferred

None.

Validation evidence

  • Targeted tests: PYTHONPATH=.../driver-1560-wt/src .../.venv/bin/python -m pytest tests/unit/install/phases/test_targets_phase.py::test_plural_targets_without_singular_does_not_keep_legacy_copilot_fallback tests/unit/install/phases/test_targets_phase.py::test_run_conflicting_target_fields_exits_with_usage_code tests/unit/install/phases/test_targets_phase_v2.py::test_plural_yaml_targets_attribute_creates_only_declared_dir tests/unit/install/phases/test_targets_phase_v2.py::test_run_targets_phase_conflicting_target_fields_exits_with_usage_code tests/integration/test_target_resolution_e2e.py::test_s05c_apm_yml_both_target_and_targets_error -q -> 5 passed.
  • Mutation-break: removing the new run() UsageError guard made test_run_conflicting_target_fields_exits_with_usage_code fail; restoring it passed. Removing the new run_targets_phase() guard made test_run_targets_phase_conflicting_target_fields_exits_with_usage_code fail; restoring it passed.
  • Lint: ruff check src/ tests/, ruff format --check src/ tests/, pylint R0801, and scripts/lint-auth-signals.sh passed locally.
  • CI: gh pr checks 1560 --repo microsoft/apm --watch observed all checks successful on ad08ac32d9900ee7ea8880f90e9f2fa72f04bfb3.

Mergeability snapshot

PR Head CEO stance Iterations Folds Deferrals Copilot rounds CI Mergeable Merge state Notes
#1560 ad08ac3 ship_now 1 3 0 2 green MERGEABLE BLOCKED pending required review

This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.

@danielmeppiel danielmeppiel merged commit 622cd75 into main May 30, 2026
13 checks passed
@danielmeppiel danielmeppiel deleted the fix/targets-plural-no-copilot-leak-1503 branch May 30, 2026 19:20
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.

apm install: targets: (plural) leaks copilot deploy when target: (singular) absent

2 participants