Repository navigation
fix(install): retire a dropped harness's native plugin enable entry (#4874) - #4895
Conversation
…4874) Narrowing targets: so a harness is no longer declared left that harness's enabledPlugins entry for a whole native plugin set to true. The install phase now computes the harnesses target contraction retires (the #4744 rule in target_governance) and the registrar stops declaring the plugin to them, so the settings owner removes APM's entry and, once empty, its marketplace. User-authored entries and explicit false values are kept. apm-spec-waiver: bug fix restoring documented native-plugin settings retirement; no spec surface change Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Critical ownership and frozen-preflight gaps can remove user-authored plugin settings or allow partial harness retirement under --frozen while leaving the lock inconsistent.
2 open issues
What changed in this PR
This PR addresses #4874 by extending native-plugin reconciliation to retire a dropped harness's enable entry when project targets narrow, while keeping the plugin available to remaining harnesses.
Changes:
- Reuses target-governance rules to identify retired harnesses and pass them through declaration planning and reconciliation.
- Adds two lifecycle regression cases, their coverage obligations, and a bug-ledger record.
- Documents partial harness retirement and adds a changelog fragment.
| File | Description |
|---|---|
tests/quality/lifecycle_obligations.json |
Marks both native-plugin narrowing cases as required. |
tests/lifecycle/scenarios/test_ownership_siblings.py |
Tests dropped-harness cleanup and preservation of unrelated user entries. |
tests/fixtures/lifecycle_bug_ledger/bugs/4874.json |
Records the bug and its regression coverage. |
src/apm_cli/install/target_governance.py |
Adds retired-native-harness calculation using existing contraction rules. |
src/apm_cli/install/phases/claude_plugins.py |
Passes retired harnesses into planning and reconciliation. |
src/apm_cli/claude_plugins/registrar.py |
Excludes retired harnesses from native declarations. |
docs/src/content/docs/consumer/install-plugins.md |
Explains cleanup when only some harnesses are dropped. |
changelog.d/4895.fixed.md |
Announces the native-plugin enable-entry cleanup. |
Review effort: Balanced
…efuses (#4874) Review folds: in a harness target contraction retired, APM owns only the plugins it declared there (native_declared, plus Copilot's suppression for a Claude-declared plugin), so a user's own enable entry and its marketplace stay and are not adopted. dropped_target_files now also reports a partial native-harness retirement, so install --frozen and audit --ci refuse it before any write. apm-spec-waiver: bug fix restoring documented native-plugin settings retirement; no spec surface change Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Target narrowing can leave stale native declarations while discarding retired harness settings paths, allowing frozen installs to remove enable entries without updating lock ownership.
3 open issues
2 resolved since last review
Review effort: Balanced
…ive user binding (#4874) Review folds: a retired harness's native enable entry is a dropped path whatever manifest_targets records (apm lock refresh, a prior --target run), so --frozen refuses before any write; unknown native_declared names are ignored. Retiring APM's entries keeps the marketplace binding while a user's own enable of a plugin the catalog still deploys needs it. apm-spec-waiver: bug fix restoring documented native-plugin settings retirement; no spec surface change Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
An active target-reconciliation bug incorrectly rejects an unchanged frozen native-plugin replay by treating Claude as retired despite its inclusion in the current run’s targets.
1 open issue
3 resolved since last review
Review effort: Balanced
…ll names (#4874) Review fold: the frozen preflight passes this run's --target to the native declaration check, so repeating a --target claude,copilot install with --frozen no longer reports Claude as dropped; audit keeps the manifest-only check. apm-spec-waiver: bug fix restoring documented native-plugin settings retirement; no spec surface change Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Regenerated tests/quality/lifecycle_obligations.json with python -m tests.lifecycle.generator; --check is clean. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… to required #4895 landed first, so train 5 drops the strict #4874 known cell (test_a_narrowed_target_retires_a_whole_plugins_enable_entry) and regenerates the ledger and known_cell_issue_states (H4). Co-authored-by: Copilot App <[email protected]>


Description
At project scope a Claude-format plugin installs whole to
.agents/plugins/<plugin>/and is enabled in each harness's settings (#4559). Narrowingtargets:so a harness is no longer declared left that harness'senabledPluginsentry attrue, so the dropped harness kept loading the plugin.Root cause:
registrar._declared_harnesseskeeps every harness whose settings file already names the plugin unless this run evaluated that harness; a harness dropped fromtargets:is never evaluated, so it was never retired.Fix (reuses the #4744 / #4751 owner):
target_governance.retired_native_harnessesapplies the existing contraction rule (target_retired: apm.yml declares targets and neither they nor this run name the harness) to the native harnesses.claude_pluginsinstall phase computes it once and passes it toplan_native_declarationsandreconcile_native_plugins._declared_harnessesstops declaring the plugin to a retired harness. The settings owner (native_plugins/settings.apply_declaration) then removes APM'strue, and the APM marketplace entry once that harness loads no plugin. User entries and explicitfalsevalues are untouched (existing ownership rules). For[copilot] -> [claude], Copilot gets APM's existing cross-target suppressionfalse(Copilot also reads.claude/settings.json).apm lock, uninstall and prune are unchanged (they pass no retired harnesses).Issue and approved scope
Issue: Fixes #4874
Human scope-approval comment: #4874 (comment)
Does this PR complete the issue, or what remains? Completes it.
Note: open PR #4758 (corpus train 5) carries a strict
Known(#4874)fortest_target_history_sources.py::test_a_narrowed_target_retires_a_whole_plugins_enable_entry; whichever lands second drops that Known row.Type of change
Testing
Red-first:
tests/lifecycle/scenarios/test_ownership_siblings.py::test_a_narrowed_target_retires_a_whole_plugins_enable_entry[single-narrowed|multi-narrowed]fail on main (dropped claude still enables/dropped copilot still enables) and pass with the fix. Each also seeds a user-authoredenabledPluginsentry in both harness files and asserts it survives. They witness W2b cellspair|SRC=native-plugin|TGT=single-narrowedandmulti-narrowed(baseline -> required inlifecycle_obligations.json); bug-ledger row4874.jsonadded.Validation evidence:
uv run --extra dev pytest -q tests/lifecycle/scenarios/test_ownership_siblings.py::test_a_narrowed_target_retires_a_whole_plugins_enable_entry-- 2 failed on main, 2 passed with fix.uv run --extra dev pytest -n 8 tests/unit/install tests/integration/test_native_project_scope.py tests/integration/test_native_project_plugin_lifecycle.py tests/integration/test_copilot_project_settings_precedence.py tests/integration/test_claude_native_hook_lifecycle.py tests/lifecycle/scenarios/test_ownership_siblings.py tests/lifecycle/scenarios/test_file_routing.py ...-- 4946 passed (excludingtest_unix_install_ownership.py, which fails identically on main in this environment).uv run --extra dev pytest -n 8 tests/quality-- 662 passed; 3test_ci_topology.pylifecycle tests flaked under xdist and passed serially.tests.quality.taxonomy --changed,tests.lifecycle.generator --check, file length -- all clean.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.
apm-spec-waiver: bug fix restoring documented native-plugin settings retirement; no spec surface change