Repository navigation
fix(install): pin only installed marketplace plugins; name every credential tried - #4419
Merged
Merged
Conversation
…ential tried (#4322) - A requested package that validation rejects withdraws the ref pins it staged, so a partly successful install records pins only for the plugins it installs (extends #4194). - AuthResolver records each secondary credential source sent (gh auth token, git credential helper, ADO chain steps) and the not-found diagnostic names every source tried, in order, never values (extends #4174). Item 3 (cleanup scan cost) landed in #4284 (66032cf). Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 16:39
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…ns; name every credential tried Co-authored-by: Copilot App <[email protected]> # Conflicts: # src/apm_cli/core/auth.py # src/apm_cli/marketplace/version_pins.py # tests/fixtures/lifecycle_bug_ledger.json
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues can commit pins for unselected or rejected dependencies, mix unrelated authentication attempts in diagnostics, and generate recovery commands that lose the requested target or install scope.
5 open issues
What changed in this PR
This PR extends #4217’s install fixes to withdraw marketplace pins for rejected plugins and report secondary credential sources without exposing token values. The supplied stacked diff also includes the broader 0.37 bug sweep.
Changes:
- Stage marketplace ref pins until transaction commit and track pins associated with rejected requests.
- Record credential-source attempts and improve repository failure diagnostics.
- Expand lifecycle coverage, refine CLI output, and update documentation for the stacked fixes.
| File | Description |
|---|---|
| tests/unit/test_install_command.py | Updates partial-install previews and failure expectations. |
| tests/unit/test_command_logger.py | Tests cleanup path lists and counts. |
| tests/unit/marketplace/test_versioned_resolver.py | Mocks staged rather than immediate pins. |
| tests/unit/marketplace/test_registration_fragment_ref.py | Tests shorthand fragment refs. |
| tests/unit/marketplace/test_metadata_enrichment.py | Isolates metadata warning expectations. |
| tests/unit/install/test_target_contraction_logging.py | Adapts cleanup logger test double. |
| tests/unit/install/test_skill_subset_deploy_parity.py | Tests implicit selections and retry flags. |
| tests/unit/install/test_services_rendering.py | Expects every destination folder. |
| tests/unit/install/test_package_selection.py | Tests unlocked local dependency selection. |
| tests/unit/install/test_dry_run_graph.py | Aligns previews with partial-install selection. |
| tests/unit/install/test_drift_pure_helpers.py | Tests advisory drift headers. |
| tests/unit/install/phases/test_cleanup_phase.py | Expects structured cleanup results. |
| tests/unit/deps/test_immutable_requirement_conflicts.py | Tests frozen proxy-route validation. |
| tests/unit/core/test_auth_validation.py | Tests credential-source diagnostics. |
| tests/unit/core/test_auth_outcome.py | Tests repository-not-found classification. |
| tests/unit/commands/test_pack_cli_surface.py | Tests JSON license warnings. |
| tests/unit/commands/test_marketplace_outdated.py | Marks remote fixture explicitly. |
| tests/test_runnable_prompts.py | Expects runnable script-list advice. |
| tests/quality/lifecycle_obligations.json | Refreshes evidence locations and checksum. |
| tests/lifecycle/machines/test_m_source.py | Removes allowances for fixed pin and lock behavior. |
| tests/lifecycle/journeys/goldens/J05/06.txt | Updates frozen marketplace header. |
| tests/lifecycle/journeys/goldens/J02/02.txt | Updates frozen dependency headers. |
| tests/lifecycle/journeys/enterprise/E02-executables-approvals.yaml | Removes retired-hook announcement allowance. |
| tests/lifecycle/journeys/consumer/J11-deploy-bundle.yaml | Removes bundle-destination allowance. |
| tests/lifecycle/journeys/consumer/J09-switch-harness.yaml | Updates cleanup output and fixed cases. |
| tests/lifecycle/journeys/consumer/J08-uninstall-cleanup.yaml | Updates prune output and fixed cases. |
| tests/lifecycle/journeys/consumer/J05-marketplace-plugin.yaml | Removes fixed header and pin allowances. |
| tests/lifecycle/journeys/consumer/J04-skill-from-bundle.yaml | Updates cleanup counts and fixed cases. |
| tests/lifecycle/generator/rules.py | Refreshes source evidence line numbers. |
| tests/lifecycle/generator/factors.py | Corrects a comment’s source location. |
| tests/integration/test_stale_cleanup_diagnostics.py | Verifies deleted paths are announced. |
| tests/integration/test_revision_pin_update_lifecycle.py | Verifies unique update rows and totals. |
| tests/integration/test_required_lifecycle_state_machine.py | Expects directory-folded cleanup output. |
| tests/integration/test_registry_only_chain_lifecycle.py | Tests frozen proxy replay and changed archives. |
| tests/integration/test_prune_deployment_ledger_e2e.py | Tests conditional hook reconciliation announcements. |
| tests/integration/test_pack_deprecation_warning_lifecycle.py | Verifies license warnings in JSON output. |
| tests/integration/test_pack_bundle_roundtrip_lifecycle.py | Tests packing and unpacking shared skills. |
| tests/integration/test_marketplace_registered_ref_lifecycle.py | Exercises shorthand registration refs. |
| tests/integration/test_marketplace_authoring_lifecycle.py | Verifies local entries skip remote checks. |
| tests/integration/test_manifest_rewrite_preservation_lifecycle.py | Tests relative manifest labels in both scopes. |
| tests/integration/test_lock_parked_exec_status_lifecycle.py | Verifies approval-state preservation and convergence. |
| tests/integration/test_install_transaction.py | Tests pin writes across transaction outcomes. |
| tests/integration/test_install_services_phase3w5.py | Updates skill fixtures and obsolete expectations. |
| tests/integration/test_install_services_orchestration.py | Tests complete destination reporting. |
| tests/integration/test_install_compile_copilot_dedup_e2e.py | Tests explained compile skips without warnings. |
| tests/integration/test_init_reinit_targets_lifecycle.py | Verifies manifest-derived target sources. |
| tests/integration/test_failure_next_step_lifecycle.py | Executes recovery hints and checks durable state. |
| tests/integration/test_executables_gate_integration.py | Tests lock-only approval-state carryover. |
| tests/integration/test_executables_deny_retires_hooks_lifecycle.py | Verifies retired hooks are named correctly. |
| tests/integration/test_brownfield_lifecycle.py | Tests local dependency locking and skill adoption. |
| tests/integration/test_audit_drift_exit_contract_lifecycle.py | Tests drift severity against exit behavior. |
| tests/integration/test_architecture_outcome_guards.py | Tests runnable skill-selection recovery hints. |
| tests/integration/test_architecture_contract_guards.py | Adapts the registry gate mock signature. |
| tests/integration/marketplace/test_build_integration.py | Mocks staged marketplace pins. |
| src/apm_cli/models/apm_package.py | Identifies user registry configuration in errors. |
| src/apm_cli/marketplace/version_pins.py | Adds transaction staging and pin withdrawal. |
| src/apm_cli/marketplace/source_identity.py | Identifies shorthand marketplace sources. |
| src/apm_cli/marketplace/resolver.py | Stages resolved ref pins. |
| src/apm_cli/marketplace/registration.py | Parses shorthand fragment refs. |
| src/apm_cli/integration/targets.py | Includes alternate deployment roots in pack prefixes. |
| src/apm_cli/integration/skill_support.py | Centralizes skill counts and adoption labels. |
| src/apm_cli/integration/skill_integrator.py | Tracks adopted pre-existing skills. |
| src/apm_cli/integration/hook_reintegration.py | Snapshots merged hook state. |
| src/apm_cli/integration/hook_integrator.py | Reports whether reconciliation changed hooks. |
| src/apm_cli/integration/cleanup.py | Produces directory-folded deletion announcements. |
| src/apm_cli/install/validation.py | Adds verbose ADO credential-source details. |
| src/apm_cli/install/transaction.py | Commits or discards staged pins. |
| src/apm_cli/install/template.py | Builds skill retry hints and handles implicit locals. |
| src/apm_cli/install/sources.py | Uses consistent resolved-ref headers. |
| src/apm_cli/install/source_helpers.py | Selects readable refs for replay headers. |
| src/apm_cli/install/services.py | Consolidates skill and destination output. |
| src/apm_cli/install/repository_access.py | Centralizes repository failure messages and hints. |
| src/apm_cli/install/presentation/__init__.py | Passes cleanup details to the logger. |
| src/apm_cli/install/plan.py | Supports excluding separately displayed updates. |
| src/apm_cli/install/phases/resolve.py | Adds recovery hints and implicit local selection. |
| src/apm_cli/install/phases/post_deps_local.py | Reports structured local cleanup results. |
| src/apm_cli/install/phases/lockfile.py | Preserves approval state and implicit selections. |
| src/apm_cli/install/phases/cleanup.py | Carries cleanup results into announcements. |
| src/apm_cli/install/package_selection.py | Completes partial installs with unlocked locals. |
| src/apm_cli/install/package_resolution.py | Exempts implicit dependencies from CLI skill overrides. |
| src/apm_cli/install/outcome.py | Builds runnable component-selection recovery commands. |
| src/apm_cli/install/mcp/command.py | Adds relative manifest labels. |
| src/apm_cli/install/local_bundle_handler.py | Reports bundle deployment destinations. |
| src/apm_cli/install/dry_run_plan.py | Mirrors completed partial-install selection. |
| src/apm_cli/install/drift_render.py | Supports advisory drift rendering. |
| src/apm_cli/install/deployed_paths.py | Formats destination folders and bundle summaries. |
| src/apm_cli/install/context.py | Tracks implicitly selected dependencies. |
| src/apm_cli/deps/registry/feature_gate.py | Distinguishes user registry configuration errors. |
| src/apm_cli/deps/registry/config_loader.py | Locates user registry configuration sources. |
| src/apm_cli/deps/immutable_requirements.py | Accepts verifiable commit-less proxy lock rows. |
| src/apm_cli/deps/git_reference_resolver.py | Raises canonical repository-not-found errors. |
| src/apm_cli/deps/clone_engine.py | Preserves not-found classification after clone failure. |
| src/apm_cli/deps/bare_cache.py | Formats repository-not-found clone failures. |
| src/apm_cli/core/script_runner.py | Replaces placeholder advice with apm list. |
| src/apm_cli/core/deployment_state.py | Warns only about claims actually retained. |
| src/apm_cli/core/command_logger.py | Lists removed paths with matching counts. |
| src/apm_cli/core/auth.py | Records and renders credential-source attempts. |
| src/apm_cli/core/auth_outcome.py | Recognizes Git repository-not-found responses. |
| src/apm_cli/core/auth_chain.py | Records credential labels during ADO attempts. |
| src/apm_cli/compilation/distributed_compiler.py | Tracks output suppressed by deduplication. |
| src/apm_cli/commands/update.py | Avoids duplicate revision-pin plan rows. |
| src/apm_cli/commands/uninstall/cli.py | Uses relative manifest names in output. |
| src/apm_cli/commands/targets.py | Reports manifest-derived target provenance. |
| src/apm_cli/commands/prune.py | Names deletions and suppresses no-op hook messages. |
| src/apm_cli/commands/pack.py | Preserves authoring warnings in JSON reports. |
| src/apm_cli/commands/marketplace/outdated.py | Skips local-path entries. |
| src/apm_cli/commands/install.py | Withdraws rejected pins and improves diagnostics. |
| src/apm_cli/commands/compile/cli.py | Suppresses warnings for explained deduplication skips. |
| src/apm_cli/commands/audit.py | Aligns advisory drift output with policy gating. |
| packages/apm-guide/.apm/skills/apm-usage/package-authoring.md | Documents JSON license warnings. |
| docs/src/content/docs/troubleshooting/install-failures.md | Explains credential-source and not-found diagnostics. |
| docs/src/content/docs/troubleshooting/index.md | Distinguishes advisory and failing drift headers. |
| docs/src/content/docs/troubleshooting/common-errors.md | Documents runnable script-list advice. |
| docs/src/content/docs/reference/cli/uninstall.md | Explains cleanup path listings. |
| docs/src/content/docs/reference/cli/targets.md | Documents manifest-derived sources. |
| docs/src/content/docs/reference/cli/prune.md | Documents deletion announcements. |
| docs/src/content/docs/reference/cli/pack.md | Documents warnings in JSON output. |
| docs/src/content/docs/reference/cli/marketplace.md | Documents shorthand refs and local-entry skips. |
| docs/src/content/docs/reference/cli/lock.md | Documents preserved executable approval status. |
| docs/src/content/docs/reference/cli/install.md | Documents implicit locals and cleanup listings. |
| docs/src/content/docs/reference/cli/audit.md | Clarifies advisory drift output. |
| CHANGELOG.md | Records the stacked fixes and follow-ups. |
Review effort: Balanced
| warning_handler=warning_handler, | ||
| ) | ||
| canonical_str, _resolved_plugin = resolution | ||
| pins_by_package[canonical_str] = staged_ref_pin_keys() - pins_before |
|
|
||
| def note_credential_source_tried(self, host_info: HostInfo, source: str) -> None: | ||
| """Record that a secondary credential *source* (a label) was sent to a host.""" | ||
| key = ((host_info.host or "").lower(), host_info.port) |
| """Return the next step for a direct dependency whose repository is missing.""" | ||
| if not is_direct or not reports_repository_not_found(error): | ||
| return "" | ||
| return f" Run 'apm uninstall {dep_ref.get_identity()}' to remove it from apm.yml." |
|
|
||
| args: list[str] = [] | ||
| target = getattr(ctx, "target_override", None) | ||
| if target and getattr(ctx, "target_override_source", None) is None: |
| if not self.committed: | ||
| cleanup_issues = self._resolution.commit() or [] | ||
| self.committed = True | ||
| self._ref_pins.commit() |
5 of 10 tasks
…withdrawal (#4322) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
5 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Stacked on part 1 (#4217,
danielmeppiel-bug-sweep-037@ 92655ce). Items 1 and 2 of #4322 extend code that only #4217 carries: the staged ref pins (#4194) and thecredential tried:diagnostic (#4174). Until #4217 lands, the diff against main also shows #4217's commits; this PR's change is the last commit. Item 3, the cleanup scan cost, already landed in #4284 (66032cf).marketplace/version_pins(RefPinStage.keys/drop,staged_ref_pin_keys,withdraw_ref_pins) + validation incommands/installcore/auth.AuthResolver.note_credential_source_tried+describe_credential_tried;core/auth_chain.run_ado_chainFailing-before evidence
tests/integration/test_marketplace_ref_pin_lifecycle.py::test_mixed_success_marketplace_install_pins_only_the_installed_plugin(installed CLI:apm install example-plugin@company ghost-plugin@company, where the ghost source fails validation)version-pins.jsonalso heldcompany/ghost-plugincompany/example-plugintests/unit/core/test_auth_validation.py::TestDescribeCredentialTried::test_names_secondary_sources_tried_in_order_without_values(owner level: PAT refused, helper answers not found)credential tried: GITHUB_APM_PAT_ACMEcredentials tried: GITHUB_APM_PAT_ACME, git credential helperItem 2 has no installed-CLI test: a GHE 404 is classified as not-found before the secondary chain runs, and a 401-then-404 origin did not reach the not-found renderer in the hermetic world before the cutoff. The owner-level test exercises the real
try_with_fallbackpath.One ledger row (#4322) and two CHANGELOG
Fixedlines.Issue and approved scope
Fixes #4322 (scope record: #4322 (comment))
Does this PR complete the issue, or what remains? It completes items 1 and 2; item 3 landed in #4284.
Type of change
Testing
pytest tests/integration/test_marketplace_ref_pin_lifecycle.py tests/integration/test_repository_not_found_lifecycle.py tests/unit/core/test_auth_validation.py tests/unit/marketplace: 2017 passed. Ledger test passed. Ruff,lint-auth-signals.sh, the architecture boundaries lint and the complexity ratchet are clean.Changelog
### Fixedunder## [Unreleased].Spec conformance (OpenAPM v0.1)
apm-spec-waiver: diagnostic wording and the advisory ref-pin cache only; no OpenAPM-observable behaviour change
Co-authored-by: Copilot [email protected]