Skip to content

fix(install): retire a dropped harness's native plugin enable entry (#4874) - #4895

Merged
Daniel Meppiel (danielmeppiel) merged 7 commits into
mainfrom
cloud-4874-narrowed-native-plugin
Nov 23, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 7 commits into
mainfrom
cloud-4874-narrowed-native-plugin

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

At project scope a Claude-format plugin installs whole to .agents/plugins/<plugin>/ and is enabled in each harness's settings (#4559). Narrowing targets: so a harness is no longer declared left that harness's enabledPlugins entry at true, so the dropped harness kept loading the plugin.

Root cause: registrar._declared_harnesses keeps every harness whose settings file already names the plugin unless this run evaluated that harness; a harness dropped from targets: is never evaluated, so it was never retired.

Fix (reuses the #4744 / #4751 owner):

  • target_governance.retired_native_harnesses applies the existing contraction rule (target_retired: apm.yml declares targets and neither they nor this run name the harness) to the native harnesses.
  • The claude_plugins install phase computes it once and passes it to plan_native_declarations and reconcile_native_plugins.
  • _declared_harnesses stops declaring the plugin to a retired harness. The settings owner (native_plugins/settings.apply_declaration) then removes APM's true, and the APM marketplace entry once that harness loads no plugin. User entries and explicit false values are untouched (existing ownership rules). For [copilot] -> [claude], Copilot gets APM's existing cross-target suppression false (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) for test_target_history_sources.py::test_a_narrowed_target_retires_a_whole_plugins_enable_entry; whichever lands second drops that Known row.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

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-authored enabledPlugins entry in both harness files and asserts it survives. They witness W2b cells pair|SRC=native-plugin|TGT=single-narrowed and multi-narrowed (baseline -> required in lifecycle_obligations.json); bug-ledger row 4874.json added.

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 (excluding test_unix_install_ownership.py, which fails identically on main in this environment).
  • uv run --extra dev pytest -n 8 tests/quality -- 662 passed; 3 test_ci_topology.py lifecycle tests flaked under xdist and passed serially.
  • Lint chain: ruff check, ruff format --check, pylint R0801, lint-auth-signals, lint-architecture-boundaries, complexity ratchet, taxonomy allowances, obligation status ratchet, tests.quality.taxonomy --changed, tests.lifecycle.generator --check, file length -- all clean.

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

apm-spec-waiver: bug fix restoring documented native-plugin settings retirement; no spec surface change

…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]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.38.0 milestone Nov 23, 2026
Copilot AI balanced review requested due to automatic review settings November 23, 2026 01:49

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

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

Comment thread src/apm_cli/claude_plugins/registrar.py Resolved
…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]>

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

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

Comment thread src/apm_cli/claude_plugins/registrar.py Resolved
…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]>

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

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]>

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.

🟢 Approval recommended

No active review issues remain for the native-plugin target-contraction changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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.

🟢 Approval recommended

No active review issues remain for the native-plugin target reconciliation changes.

No open issues 🎉

Review effort: Balanced

Regenerated tests/quality/lifecycle_obligations.json with
python -m tests.lifecycle.generator; --check is clean.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

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.

🟢 Approval recommended

No active review issues are recorded for the change retiring dropped-harness plugin declarations while preserving plugin availability for remaining targets.

No open issues 🎉

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 2b4e751 into main Nov 23, 2026
74 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the cloud-4874-narrowed-native-plugin branch November 23, 2026 08:57
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
… 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]>
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.

[BUG] Narrowing targets leaves a dropped harness enabling a whole native plugin

2 participants