Skip to content

fix(install): name the package in verbose per-package diagnostics (#4334) - #4426

Merged
Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
bug-sweep/p4334
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
bug-sweep/p4334

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

Fixes #4334 (scope record: #4334 (comment))

apm install --verbose printed Package target restriction: [copilot]; effective targets: [copilot] and [i] perf: materialize sparse=yes size=0.00 MB once per package with identical text, so two subdirectory packages that both declare targets: [copilot] produced duplicate diagnostics. Each line has one printer: log_package_target_restriction (src/apm_cli/install/target_filter.py) and InstallLogger.materialize_result (src/apm_cli/core/command_logger.py). Both now name the package they report on, so every distinct line prints exactly once:

Package target restriction for apm-fixture-org/mono/packages/alpha: [copilot]; effective targets: [copilot]
    [i] perf: materialize github.com/apm-fixture-org/mono/packages/alpha#<sha> sparse=yes size=0.00 MB

The only callers (deployment_plan.prepare_package_deployment and the two github_downloader call sites) pass the package they already hold.

Strict cells flipped

  • install-verbose-diagnostics-repeat (tests/utils/lifecycle_evidence.py): removed; the output oracle no longer sees the repeat.

Issue and approved scope

Issue: Fixes #4334

Human scope-approval comment: #4334 (comment)

Does this PR complete the issue, or what remains? It completes the issue.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally

  • All existing tests pass

  • Added tests for new functionality (if applicable)

  • New installed-CLI test tests/integration/test_install_verbose_diagnostics_lifecycle.py::test_verbose_install_prints_each_package_diagnostic_once (tm006: e2e, promise("P-INV-I9")): two subdirectory packages from one local git repository, install --target copilot --verbose. Before the fix it fails with 'Package target restriction' repeats; after, it passes. It also runs the lifecycle output oracle (I9) on the result.

  • APM_E2E_TESTS=1 APM_BINARY_PATH=.venv/bin/apm uv run --extra dev pytest -n 0 tests/integration/test_install_verbose_diagnostics_lifecycle.py: 1 passed (red without the src/ change: 1 failed).

  • Neighbours: the hook-routing restriction test (assertion updated for the package name), tests/unit/scripts/test_lifecycle_evidence.py and related unit tests: 351 passed. tests/quality/test_lifecycle_bug_ledger.py: 2 passed. python -m tests.quality.taxonomy --changed: clean.

  • Lint mirror: ruff check/format, pylint R0801, auth-signals, architecture boundaries, complexity ratchet: clean.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

Not applicable.

)

apm install --verbose printed identical 'Package target restriction'
and '[i] perf: materialize' lines once per package, so two packages with
the same restriction produced duplicate output. Each owner now names the
package it reports on, so every distinct line prints exactly once.

The strict output cell for this defect is removed, an installed-CLI
regression test fails before the fix and passes after, and a bug-ledger
row records it.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 17:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The integration test’s substring assertion fails on correctly wrapped diagnostics in an 80-column console and needs whitespace normalization to tolerate line wrapping.

1 open issue
What changed in this PR

This PR addresses #4334 by adding package identities to verbose install diagnostics, making target restrictions and materialization results distinguishable across packages.

Changes:

  • Pass package names through the existing diagnostic logging paths.
  • Add an installed-CLI regression test and remove the known duplicate-output exception.
  • Update the related assertion, bug ledger, and changelog.
File Description
tests/​utils/​lifecycle_evidence.py Removes the known duplicate-diagnostic exception.
tests/​integration/​test_package_target_hook_routing_e2e.py Adjusts the assertion for package-labelled output.
tests/​integration/​test_install_verbose_diagnostics_lifecycle.py Adds two-package verbose-output regression coverage.
tests/​fixtures/​lifecycle_bug_ledger.json Records #4334 and its regression test.
src/​apm_cli/​install/​target_filter.py Names the package in target-restriction diagnostics.
src/​apm_cli/​install/​deployment_plan.py Passes the package name to the restriction logger.
src/​apm_cli/​deps/​github_downloader.py Passes package identities at both materialization logging sites.
src/​apm_cli/​core/​command_logger.py Includes package identity in materialization diagnostics.
CHANGELOG.md Documents the verbose-output fix.

Review effort: Balanced

assert (
"Package target restriction: [claude]; effective targets: [claude]" in update_result.stdout
"Package target restriction for " in update_result.stdout
and "[claude]; effective targets: [claude]" in update_result.stdout
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 82070be into main Nov 21, 2026
46 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the bug-sweep/p4334 branch November 21, 2026 05:24
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 --verbose repeats target-restriction and perf diagnostic lines

2 participants