Skip to content

fix(uninstall): keep surviving bundles' skills: selection (#3760) - #3784

Merged
Daniel Meppiel (danielmeppiel) merged 15 commits into
mainfrom
danielmeppiel-t4-u1-effective-selection
Nov 18, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 15 commits into
mainfrom
danielmeppiel-t4-u1-effective-selection

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

apm uninstall <unrelated-pkg> re-integrated every surviving dependency without its skills: selection, so a bundle pinned to skills: [alpha] got all of its skills redeployed. The extra skill directories were not recorded in apm.lock.yaml and apm audit --ci still passed. Project and -g scope were both affected.

Root cause: four call sites computed the effective deploy selection on their own. Install preflight and install deploy used the CLI --skill overlay, audit replay used the locked ref, and uninstall survivor re-integration computed nothing and fell back to the skill_subset=None default ("deploy all").

Fix (one owner, every caller routed through it, plus a static guard):

  • Owner: effective_dependency_selection(dep_ref, ctx=None) -> EffectiveDependencySelection(skill_subset, target_subset) in src/apm_cli/install/package_resolution.py. dep_ref=None is first-party project content (no selection). The CLI --skill overlay delegates to the existing pure effective_deploy_skill_subset.
  • Routing: install preflight and deploy (install/template.py), audit replay (install/drift.py), uninstall survivor target authorization and re-integration (commands/uninstall/engine.py) and local content (install/services.py) all call the owner.
  • Required keyword: skill_subset is now a required keyword in integrate_package_primitives and prepare_package_deployment, so leaving it out raises TypeError instead of deploying everything. hook_reintegration keeps an explicit None with a comment, because it builds a hooks-only plan.
  • Guard install-deployment-effective-selection: every integrate_package_primitives(, prepare_package_deployment( and DeployableSourcePlan.create( call must pass skill_subset= (and any dep_target_subset=) from the owner. The only exceptions are allowlisted forwarders, the hooks-only None site and the plan-derived skill-adoption site. The guard also requires the keyword to stay required and the owner to be defined exactly once.
  • Owner registry: new dependency-selection entry in .apm/architecture/owners/install-deployment.json, plus a sorted MutationCase and four mutation-break cases. The existing audit-replay guard and its tests now require the owner call.

The diamond-edge selection merge (#3735, PR-3) can extend this owner. Skills leaked by earlier versions are out of scope: APM cannot tell they are its own, so users should delete stray skill directories by hand.

Issue and approved scope

Issue: Fixes #3760

Human scope-approval comment: #3760 (comment)

This PR completes the issue. Out of scope per the record: removing skills leaked by earlier versions, and merging selections across diamond edges (#3735).

Type of change

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

Testing

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

Validation evidence (local, .venv editable install, APM_BINARY_PATH=$PWD/.venv/bin/apm):

Command Result
pytest tests/integration/test_uninstall_skill_selection_lifecycle.py -p no:xdist on v0.36.0 code (2769573 plus the test only) 2 failed (project and user: {'alpha','beta','delta','gamma'} != {'alpha'} after uninstall)
same, after the fix 2 passed
pytest tests/unit/install/test_skill_subset_deploy_parity.py -p no:xdist (owner and TypeError tests) 22 passed
pytest over the 39 non-architecture test files that call the deploy functions, drift replay or uninstall re-integration (-m "not requires_apm_binary") 1419 passed, 1 skipped
pytest tests/integration/test_architecture_install_compound_mutations.py tests/integration/test_architecture_intent_guards.py tests/integration/test_architecture_skill_preflight.py 116 passed and 3 failed on the first run (stale audit-replay literals); after the update, the 6 affected cases pass
pytest tests/integration/test_architecture_owner_rule_mutations.py -k "deploy_selection or install-deployment-effective-selection" 7 passed
pytest tests/integration/test_architecture_owner_rule_mutations.py -k "effective_selection or deploy_selection or audit_replay or coverage or surgical or before_mutation or registry" 222 passed
python scripts/lint_architecture_boundaries.py --root . exit 0
uvx [email protected] check and format --check (CI paths) clean
pylint R0801 (CI paths) 10.00/10
bash scripts/lint-auth-signals.sh clean

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.

…ner (#3760)

apm uninstall re-integrated surviving packages without their skills:
selection, so every skill of a surviving bundle was redeployed and left
unrecorded in the lockfile. Add effective_dependency_selection() in
install/package_resolution.py as the single owner of the effective deploy
selection and route install preflight, install deploy, audit replay and
uninstall re-integration through it. skill_subset is now a required
keyword of integrate_package_primitives and prepare_package_deployment.

apm-spec-waiver: deploy-time skill selection routing fix; no OpenAPM spec requirement covers uninstall re-integration selection

Co-authored-by: Copilot App <[email protected]>
Add the install-deployment-effective-selection architecture guard: every
integrate_package_primitives, prepare_package_deployment and
DeployableSourcePlan.create call passes skill_subset (and any
dep_target_subset) from effective_dependency_selection, with allowlisted
hooks-only and plan-derived sites, and skill_subset stays a required
keyword. Register the dependency-selection owner, add its MutationCase and
mutation-break cases, update the audit-replay guard and its tests to the
owner call, pass skill_subset explicitly in direct test callers, add a
TypeError unit test and the uninstall L7 lifecycle test (project and -g),
and document the uninstall rebuild selection.

apm-spec-waiver: deploy-time skill selection routing fix; no OpenAPM spec requirement covers uninstall re-integration selection

Co-authored-by: Copilot App <[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

The shared conformance fixture omits the now-required skill_subset argument, causing all four cases to raise TypeError before reaching their admission assertions.

1 open issue
What changed in this PR

This PR addresses #3760 by preserving surviving dependencies' skills: selections when uninstall rebuilds integrations in project and global scope. It centralizes deployment selection across install, audit replay, and uninstall; cleanup of previously leaked skills and diamond-edge selection merging remain out of scope.

Changes:

  • Introduces a shared dependency-selection owner and makes skill_subset an explicit, required deployment argument.
  • Adds architecture guards, mutation tests, and project/global lifecycle regression coverage.
  • Updates existing test callers, uninstall documentation, and release notes.
File Description
tests/​unit/​integration/​test_hook_target_selection.py Supplies explicit skill selection.
tests/​unit/​integration/​test_hook_configured_routing.py Updates the deployment helper's arguments.
tests/​unit/​integration/​test_dep_target_intersection.py Updates target-intersection test callers.
tests/​unit/​integration/​test_data_driven_dispatch.py Updates the dispatch helper's arguments.
tests/​unit/​integration/​test_cursor_hook_native_contract.py Updates Cursor hook deployment callers.
tests/​unit/​integration/​test_command_integrator.py Updates command integration callers.
tests/​unit/​integration/​test_canvas_integrator.py Updates canvas integration callers.
tests/​unit/​install/​test_skill_subset_deploy_parity.py Tests the selection owner and required keyword.
tests/​unit/​install/​test_skill_completion_receipt.py Updates completion-receipt callers.
tests/​unit/​install/​test_services.py Updates service test callers.
tests/​unit/​install/​test_services_rendering.py Updates rendering test callers.
tests/​unit/​install/​test_services_phase3.py Updates service branch test callers.
tests/​unit/​install/​test_services_hook_scope.py Updates hook-scope test callers.
tests/​unit/​install/​test_services_branches.py Updates service branch test callers.
tests/​unit/​install/​test_agent_symlink_diagnostics.py Updates the diagnostic test's deployment call.
tests/​unit/​install/​test_agent_plugin_deployment_boundary.py Updates the plugin-boundary deployment call.
tests/​integration/​test_uninstall_skill_selection_lifecycle.py Adds project/global survivor-selection regression tests.
tests/​integration/​test_plugin_bin_trust_posture.py Updates plugin trust test callers.
tests/​integration/​test_install_services_phase3w5.py Updates service integration callers.
tests/​integration/​test_install_services_orchestration.py Updates orchestration test callers.
tests/​integration/​test_hook_integrator_copilot_casing_e2e.py Updates the hook integration helper.
tests/​integration/​test_hook_configured_routing_e2e.py Updates the routing test helper.
tests/​integration/​test_architecture_owner_rule_mutations.py Adds selection-owner bypass mutations.
tests/​integration/​test_architecture_intent_guards.py Requires audit replay to use the selection owner.
tests/​integration/​test_architecture_install_compound_mutations.py Aligns audit mutations with owner-based selection.
src/​apm_cli/​integration/​hook_reintegration.py Explains the hooks-only selection exception.
src/​apm_cli/​install/​template.py Routes preflight and deployment through the owner.
src/​apm_cli/​install/​services.py Requires skill selection and routes local content through the owner.
src/​apm_cli/​install/​package_resolution.py Defines the shared effective-selection owner.
src/​apm_cli/​install/​drift.py Uses the owner for locked-selection replay.
src/​apm_cli/​install/​deployment_plan.py Makes skill_subset required.
src/​apm_cli/​commands/​uninstall/​engine.py Preserves survivor selection during reintegration.
scripts/​architecture_linter/​checks/​install_frozen_and_audit.py Updates the audit-replay guard.
scripts/​architecture_linter/​checks/​install_effective_selection.py Adds selection ownership and required-keyword checks.
scripts/​architecture_linter/​checks/​install_deployment_analyzers.py Registers the selection guard.
docs/​src/​content/​docs/​reference/​cli/​uninstall.md Documents survivor skill-selection preservation.
CHANGELOG.md Records the fix and legacy cleanup guidance.
.apm/​architecture/​owners/​install-deployment.json Registers dependency-selection ownership.

Review effort: Balanced

Comment thread src/apm_cli/install/services.py Resolved
…ve-selection rule (#3760)

apm-spec-waiver: test-only call-site update for the required skill_subset argument; no spec behavior change

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 17, 2026
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

Uninstalling one package no longer redeploys every skill of the bundles that remain installed. Every deploy call site now goes through one selection owner, enforced by a static guard and a real-binary regression test.

panel-mode=lean; personas=python-architect,test-coverage-expert,apm-ceo

cc Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

This PR fixes a silent break in APM's core promise that the manifest decides what lands on disk. It follows the approved design:

  • effective_dependency_selection is the single owner of each dependency's skill and target selection.
  • skill_subset is a required keyword of integrate_package_primitives and prepare_package_deployment, so omitting it raises a TypeError instead of deploying everything.
  • The new install-deployment-effective-selection guard catches deploy calls that bypass the owner, and a MutationCase proves it fires.

Every Done-when item has evidence. The real-binary L7 test (tests/integration/test_uninstall_skill_selection_lifecycle.py, project and -g) failed 2/2 on pre-fix src at the post-uninstall {alpha} assertion and passes at head.

Both panelists find the skill half sound. They point to the same remaining gap: the owner covers less than its registry entry claims. Specifically:

  • The uninstall hook reconcile (hook_integrator.py:1981) still reads dep_ref.target_subset directly.
  • The lockfile builder (install/phases/lockfile.py:401) calls effective_deploy_skill_subset itself.
  • No test checks a survivor's targets: narrowing after uninstall.

None of these reproduces a wrong deploy today. The cheapest high-signal fold is a marker: the regression test is not lifecycle_smoke, so the PR-time lifecycle job does not run it.

Aligned with:

  • Portable by manifest: skills: stays authoritative after an unrelated uninstall.
  • Governed by policy: the lockfile and audit --ci agree after uninstall.
  • Secure by default: an omitted selection fails loudly instead of deploying everything.
  • Pragmatic as npm: removing one package never changes what the remaining packages install.

Panel summary

Persona B R N Takeaway
Python Architect 0 3 0 The owner and the required-keyword design are sound for deploy calls. The guard still misses target selection, aliased call names and the lockfile's recorded subset.
Test Coverage Expert 0 2 0 Every Done-when item is trapped, including a pre-fix-failing real-binary regression test. That test is not in the PR-time lifecycle job, and the target half of uninstall selection is untested.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 5 follow-ups

  1. [Test Coverage Expert] Mark tests/integration/test_uninstall_skill_selection_lifecycle.py as lifecycle_smoke (and integration). Today a revert of the [BUG] apm uninstall re-deploys every skill of surviving skill bundles, ignoring skills: selection #3760 fix would surface only in the merge queue.
  2. [Python Architect] Route LockfileBuilder._attach_skill_subset_override through effective_dependency_selection, and keep effective_deploy_skill_subset inside the owner module. Otherwise the recorded selection and the deployed selection come from two call sites, and they will drift once [BUG] Transitive skill_bundle deduplication silently discards skill subsets when two parents declare different subsets of the same repo #3735 changes selection.
  3. [Test Coverage Expert] Add a project-scope survivor case with targets: [claude]. engine.py:1199 now takes target_subset from the owner, but nothing asserts it.
  4. [Python Architect] Make the owner the only target-selection authority. Route the hook reconcile through it and guard resolve_effective_package_targets with a MutationCase, or narrow the registry text. As it stands, the registry claims more than the guard enforces.
  5. [Python Architect] Resolve aliased imports when the guard matches deploy calls, and add an alias-bypass MutationCase. No alias exists today, so this is the lowest priority.

Recommendation

The bug fix is correct, inside the stated scope, and proven by a real-binary regression test that failed before the fix. Fold the lifecycle_smoke marker in this PR. Close the lockfile single-owner and target-selection gaps before PR-3 (#3786) builds diamond-merge selection on this owner.


Full per-persona findings

Python Architect

  • [recommended] The owner entry claims target selection, but nothing enforces it, and the uninstall hook reconcile still reads dep_ref.target_subset directly (src/apm_cli/integration/hook_integrator.py:1981). The dependency-selection registry entry claims target selection for uninstall survivor re-integration. The guard checks only deploy-call keywords, so changing engine.py:1199 back to dep_ref.target_subset would still pass, and reconcile_after_removal is a second target authority.
    Suggested: Pass effective_dependency_selection(dep_ref).target_subset in the hook reconcile. Then add resolve_effective_package_targets to the guarded calls with a MutationCase, or narrow the registry text.
  • [recommended] The guard finds deploy calls by bare name, so an aliased import or a cls.create call escapes it (scripts/architecture_linter/checks/install_effective_selection.py:74). The required keyword catches an omitted selection at runtime, but not a call that passes a locally computed subset through an alias.
    Suggested: Collect ImportFrom aliases per module and treat the aliased names as deploy names. Add an alias-bypass MutationCase.
  • [recommended] The lockfile phase records the skill subset by calling effective_deploy_skill_subset directly instead of the owner (src/apm_cli/install/phases/lockfile.py:401). Audit replay deploys the locked selection that this builder writes, so "audit --ci agrees" depends on two call sites making the same decision.
    Suggested: Compute the selection with effective_dependency_selection(locked_dep, self.ctx).skill_subset and restrict effective_deploy_skill_subset to the owner module.

Test Coverage Expert

  • [recommended] The [BUG] apm uninstall re-deploys every skill of surviving skill bundles, ignoring skills: selection #3760 regression test is not marked lifecycle_smoke, so a revert of the fix is first caught in the merge queue, not at PR time (tests/integration/test_uninstall_skill_selection_lifecycle.py:19). The required job selects -m 'lifecycle_smoke and not lifecycle_merge_group'.
    Proof (passed): tests/integration/test_uninstall_skill_selection_lifecycle.py -- proves: after an unrelated uninstall, only the selected alpha skill remains, recorded in the lock, at project and user scope. It failed 2/2 on pre-fix src. [portability-by-manifest,governed-by-policy]
  • [recommended] Uninstall survivor targeting reads the target subset from the owner, but no test checks that a survivor's targets: narrowing holds after uninstall (src/apm_cli/commands/uninstall/engine.py:1199).
    Proof (missing at): tests/integration/test_uninstall_skill_selection_lifecycle.py -- proves: an unrelated uninstall does not widen a survivor beyond the targets the consumer narrowed it to. [portability-by-manifest,multi-harness-support,governed-by-policy]

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


Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.

Panel follow-ups on #3784. The lockfile builder recorded the skill subset
by calling effective_deploy_skill_subset itself, and uninstall hook
reconcile plus the explicit-target preflight read dep_ref.target_subset
directly, so the owner covered less than its registry entry claimed.
All three now take the selection from effective_dependency_selection.

The install-deployment-effective-selection guard now also checks every
resolve_effective_package_targets call, keeps effective_deploy_skill_subset
internal to the owner module, and resolves aliased imports of the deploy
functions; four new bypass mutations prove each case.

The #3760 lifecycle test is now lifecycle_smoke (runs in the PR-time
lifecycle job) and gains a survivor targets: narrowing case.

apm-spec-waiver: install deploy-selection routing with no OpenAPM requirement change

Co-authored-by: Copilot App <[email protected]>
Traps the lockfile builder's route through effective_dependency_selection:
it records the persisted plus CLI --skill union for skill bundles only.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 17, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 17, 2026
…real lock entries (#3763)

Align the pairing owner with #3786's explicit-empty rule: an edge whose
skills: or targets: is explicitly empty contributes no skill-target
pairs, and a node whose every edge is empty keeps the empty flat
selection (NodeSelection.lock_selection reconciles audit and uninstall).
effective_dependency_selection only treats a decoded SkillTargetSelection
as a pairing, and the #3784 lockfile overlay test uses LockedDependency.

Co-authored-by: Copilot App <[email protected]>
#3793 guarded the post-uninstall legacy-root assertion with an xfail
until #3760 landed. With the effective-selection owner in place the
survivor keeps only its selected skill, so the conditional would only
mask a future U1 regression.

Co-authored-by: Copilot App <[email protected]>
The U1 x --legacy-skill-paths assertion in the #3793 lifecycle module
only runs in the merge queue. Add a cheap local-path case to the
lifecycle_smoke module so a survivor-selection regression on the legacy
layout fails on every PR. Fails on pre-fix src (all 4 skills
re-integrated), passes at head.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

Uninstall now keeps surviving bundles' skills: and targets: selection. One owner decides what every deploy path ships, and all 5 prior follow-ups are folded.

panel-mode=delta; personas=python-architect,test-coverage-expert,apm-ceo

cc Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Delta since the last advisory (head aab5460):

The architect confirms all three prior findings are folded, and that #3793's merged uninstall and skill-layout code adds no deploy path that skips the owner. Test coverage confirms both prior gaps are trapped. One recommended item is deferred: make dep_target_subset a required keyword. The scope record makes only the skill selection required, every site already takes its targets from the owner, and PR-3 (#3786) stacks on this branch, so the signature change belongs in a follow-up.

Aligned with:

  • Portable by manifest: skills: and targets: hold across uninstall in both skill layouts.
  • Secure by default: an omitted skill selection is a TypeError and a lint failure.
  • Governed by policy: the lockfile, audit --ci and disk agree after uninstall.
  • Multi-harness: target narrowing is proven across copilot and claude.

Panel summary

Persona B R N Takeaway
Python Architect 0 1 0 All three prior findings are folded. #3793 adds no deploy path that skips the owner. Still open: a deploy call that omits dep_target_subset would pass the guard.
Test Coverage Expert 0 1 0 Both prior gaps are trapped and the new mutations are meaningful. The legacy U1 trap ran only in the merge queue; it is now folded into the PR-time module.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 1 follow-ups

  1. [Python Architect] After merge, make dep_target_subset a required keyword on the deploy functions and have the guard flag its omission. Target selection currently relies on the uninstall survivor call pre-narrowing through the owner; requiring the argument turns a future omission into a TypeError, as for skill_subset.

Folded in this run

Deferred (out-of-scope follow-ups)

  • (panel) Required dep_target_subset keyword plus guard -- scope boundary: the approved scope makes only the skill selection a required argument; targets already route through the owner at every site.

Regression-trap evidence (mutation-break gate)

  • test_uninstall_skill_selection_lifecycle.py L7 (project, -g) and the legacy case -- on pre-fix src these FAILED (all skills re-integrated).
  • The survivor targets case -- with the engine's owner target subset replaced by None, it FAILED.
  • test_lockfile_records_the_selection_the_owner_deploys -- with the owner call's ctx dropped, it FAILED.
  • Bypass params aliased-deploy-call, uninstall-local-target-subset, hook-reconcile-local-target-subset and lockfile-records-outside-owner -- each FAILED with its guard check disabled.

Lint contract

At 1a4dc9b: uvx [email protected] check and format --check silent; pylint R0801 10.00/10; scripts/lint-auth-signals.sh clean; bash scripts/lint-architecture-boundaries.sh exit 0.

CI

All checks green at 1a4dc9b: CI, Merge Gate, Spec conformance, CodeQL, NOTICE Drift. One CI fix iteration: the Windows Compatibility Gate failed in the unrelated test_audit_workspace_identity_lifecycle.py[git] because gh auth token timed out on the runner (infra); the rerun was green.

Mergeability status

PR head SHA CEO stance iters folds defers Copilot rounds CI mergeable mergeStateStatus notes
#3784 1a4dc9b ship_with_followups 2 7 1 2 green MERGEABLE BLOCKED pending required review

Full per-persona findings

Python Architect

  • [recommended] dep_target_subset is still optional on the deploy functions, so a call that omits it passes the guard (scripts/architecture_linter/checks/install_effective_selection.py). All callers are correct today. The uninstall survivor call omits it but pre-narrows its targets through the owner at engine.py:1210.
    Suggested: Make it a required keyword-only argument, add it to the guard's required-keyword check, and pass selection.target_subset in the uninstall survivor call. Deferred as a scope boundary; see above.

Test Coverage Expert

  • [recommended] The now-unconditional U1 x legacy-layout assertion only runs in the merge queue (tests/integration/test_legacy_skill_layout_lifecycle.py:134).
    Folded in b775711 as test_uninstall_unrelated_package_keeps_legacy_layout_skill_selection in the lifecycle_smoke module.

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


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit c375d60 into main Nov 18, 2026
26 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-t4-u1-effective-selection branch November 18, 2026 03:40
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
#3735) (#3786)

* fix(uninstall): route every deploy through one effective-selection owner (#3760)

apm uninstall re-integrated surviving packages without their skills:
selection, so every skill of a surviving bundle was redeployed and left
unrecorded in the lockfile. Add effective_dependency_selection() in
install/package_resolution.py as the single owner of the effective deploy
selection and route install preflight, install deploy, audit replay and
uninstall re-integration through it. skill_subset is now a required
keyword of integrate_package_primitives and prepare_package_deployment.

apm-spec-waiver: deploy-time skill selection routing fix; no OpenAPM spec requirement covers uninstall re-integration selection

Co-authored-by: Copilot App <[email protected]>

* fix(install): guard the effective deploy-selection owner (#3760)

Add the install-deployment-effective-selection architecture guard: every
integrate_package_primitives, prepare_package_deployment and
DeployableSourcePlan.create call passes skill_subset (and any
dep_target_subset) from effective_dependency_selection, with allowlisted
hooks-only and plan-derived sites, and skill_subset stays a required
keyword. Register the dependency-selection owner, add its MutationCase and
mutation-break cases, update the audit-replay guard and its tests to the
owner call, pass skill_subset explicitly in direct test callers, add a
TypeError unit test and the uninstall L7 lifecycle test (project and -g),
and document the uninstall rebuild selection.

apm-spec-waiver: deploy-time skill selection routing fix; no OpenAPM spec requirement covers uninstall re-integration selection

Co-authored-by: Copilot App <[email protected]>

* docs(changelog): uninstall keeps skills: selection (#3784)

Co-authored-by: Copilot App <[email protected]>

* fix(deps): merge diamond skill and target selections through one owner (#3735)

WIP: selection-merge owner, resolver edge accumulator, uninstall shrink,
audit via the owner, frozen selection reason, static guard.

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* test(deps): real-binary diamond selection lifecycle (#3735)

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* test(deps): fold RT4 selection-merge lifecycle suite; deterministic parent ties; docs (#3735)

resolved_by ties among equal-depth parents break by lowest parent key, so
manifest order no longer changes apm.lock.yaml bytes.

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* docs(changelog): selection merge entry (#3786)

apm-spec-waiver: lockfile skill_subset/target_subset meaning clarified in lockfile-spec.md only; the normative requirement is deferred to #3763 per approved decision D7.

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* test(audit): declared-selection wording in subset replay lifecycle (#3786)

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* fix(deps): keep download annotations on merged references; trim resolve phase (#3786)

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* test(deps): trap audit target_subset, marketplace keys and dev edges (#3786)

Addresses panel follow-ups FU1-FU3 (test-coverage-expert): the audit
target_subset mismatch branch, the marketplace declaration mapping in
declared_node_selections, and a devDependencies edge contributing its
selection, each proven by a mutation that breaks it.

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* test: pass skill_subset in spec conformance callers; register effective-selection rule (#3760)

apm-spec-waiver: test-only call-site update for the required skill_subset argument; no spec behavior change

Co-authored-by: Copilot App <[email protected]>

* fix(install): route lockfile record and target resolution via owner

Panel follow-ups on #3784. The lockfile builder recorded the skill subset
by calling effective_deploy_skill_subset itself, and uninstall hook
reconcile plus the explicit-target preflight read dep_ref.target_subset
directly, so the owner covered less than its registry entry claimed.
All three now take the selection from effective_dependency_selection.

The install-deployment-effective-selection guard now also checks every
resolve_effective_package_targets call, keeps effective_deploy_skill_subset
internal to the owner module, and resolves aliased imports of the deploy
functions; four new bypass mutations prove each case.

The #3760 lifecycle test is now lifecycle_smoke (runs in the PR-time
lifecycle job) and gains a survivor targets: narrowing case.

apm-spec-waiver: install deploy-selection routing with no OpenAPM requirement change

Co-authored-by: Copilot App <[email protected]>

* test(install): lockfile records the owner's deployed selection (#3784)

Traps the lockfile builder's route through effective_dependency_selection:
it records the persisted plus CLI --skill union for skill bundles only.

Co-authored-by: Copilot App <[email protected]>

* fix(deps): merge replaced, aliased and marketplace diamonds; audit fails closed (#3786)

Addresses the four Copilot inline findings:
- replace: diamonds now lock and reload the merged selection (the binding
  original carries the union; lock evidence re-merges every request);
- audit treats an incomplete declaration walk as unverified unless an
  unrestricted edge absorbs the unread declarations;
- the reachability walk reads an aliased node where the lock materialized it;
- marketplace declarations map to their locked entry at every depth.
Each fold is proven by a mutation that breaks its new test.

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* fix(deps): expand same-repo path children of fetched packages in the walk (#3786)

The declared-selection walk loaded package manifests without their origin,
so a fetched package's same-repository path: child stayed a consumer-local
path, never reached its locked node, and audit reported it unverified
(test_mcp_dev_dependency_lifecycle). Mark the origin as install and
DeclaredTransportIndex do.

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* test(skills): make the U1 x legacy layout assert unconditional (#3784)

#3793 guarded the post-uninstall legacy-root assertion with an xfail
until #3760 landed. With the effective-selection owner in place the
survivor keeps only its selected skill, so the conditional would only
mask a future U1 regression.

Co-authored-by: Copilot App <[email protected]>

* test(uninstall): PR-time U1 trap for the legacy skill layout (#3784)

The U1 x --legacy-skill-paths assertion in the #3793 lifecycle module
only runs in the merge queue. Add a cheap local-path case to the
lifecycle_smoke module so a survivor-selection regression on the legacy
layout fails on every PR. Fails on pre-fix src (all 4 skills
re-integrated), passes at head.

Co-authored-by: Copilot App <[email protected]>

* test(deps): replaced diamond locks and audits its union end to end (#3786)

Addresses delta panel follow-ups: an integration trap installs a replace:
diamond whose parents select different skills and audits the locked union;
the unit trap now round-trips the lock; the resolver keeps an explicitly
empty merged selection as the replacement path does.

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* Merge main (dfb6a83) into #3784; slot CHANGELOG bullet

Co-authored-by: Copilot App <[email protected]>

* test: follow #3790 rename in the preflight target mutation anchor (#3784)

Co-authored-by: Copilot App <[email protected]>

* docs(changelog): drop duplicate #3784 bullet after main merge (#3786)

Co-authored-by: azevedo-luis <[email protected]>
Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: azevedo-luis <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
…real lock entries (#3763)

Align the pairing owner with #3786's explicit-empty rule: an edge whose
skills: or targets: is explicitly empty contributes no skill-target
pairs, and a node whose every edge is empty keeps the empty flat
selection (NodeSelection.lock_selection reconciles audit and uninstall).
effective_dependency_selection only treats a decoded SkillTargetSelection
as a pairing, and the #3784 lockfile overlay test uses LockedDependency.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
…real lock entries (#3763)

Align the pairing owner with #3786's explicit-empty rule: an edge whose
skills: or targets: is explicitly empty contributes no skill-target
pairs, and a node whose every edge is empty keeps the empty flat
selection (NodeSelection.lock_selection reconciles audit and uninstall).
effective_dependency_selection only treats a decoded SkillTargetSelection
as a pairing, and the #3784 lockfile overlay test uses LockedDependency.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
…-rs-018) (#3769)

* feat(spec): req-rs-018 exact per-edge subset pairing owner (#3763)

Add the OpenAPM req-rs-018 subset-merge requirement (new Section 7.4.1):
multi-edge skills x targets selections merge by exact per-edge pairing,
all absorbs per edge and axis, order independence, lock recording via
the canonical optional subset_pairings field, consistency and frozen
replay. Appendix C/D, enumerations, counts (139: 134 MUST) and the
requirements manifest are updated; CONFORMANCE regenerated.

Add the pure pairing algebra to the selection owner
(models/dependency/subsets.py): SkillTargetSelection,
merge_edge_pairings, and the lock record codec, with hypothesis
property tests and req-rs-018 conformance tests.

Partial: #3763

Co-authored-by: Copilot App <[email protected]>

* docs(changelog): note proposed req-rs-018 (#3769)

Co-authored-by: Copilot App <[email protected]>

* docs(spec): fold spec-guardian round-1 findings into req-rs-018 (#3769)

Pin the canonical subset_pairings ordering comparison, scope the
determinism claim to data structures, exclude req-ext-001 vendor keys
from pairing elements, clarify the wildcard element and the 'any edge'
quantifier, add the Section 11.2 disclosure pointer and the Section
10.11 lockfile-tampering mapping, and type target_subset and
subset_pairings in the distinct proposed lockfile-v0.1.60.schema.json
(earlier schema bytes unchanged).

Co-authored-by: Copilot App <[email protected]>

* fix(subsets): reject non-canonical axes; scope order identity to selection fields (#3769)

Address Copilot review: direct SkillTargetSelection construction now
rejects empty, blank or padded axes that would change meaning after a
lock round trip, and req-rs-018 clause 3 scopes the identity
requirement to skill_subset, target_subset and subset_pairings rather
than the whole entry (depth may legitimately change).

Co-authored-by: Copilot App <[email protected]>

* feat(deps): deploy diamond skills x targets with exact per-edge pairing (#3763)

Each skill a declaration selects now reaches only that declaration's
targets (OpenAPM req-rs-018) instead of the 0.36.1 skills x targets
cross-product. The selection-merge owner (models/dependency/subsets.py)
computes NodeSelection through merge_edge_pairings; the resolver carries
the exact pairing on DependencyReference.subset_pairings; the lockfile
records it as the optional canonical subset_pairings field only when the
flat product would over-select (so product lockfiles stay byte-identical)
and decodes it only through SkillTargetSelection.from_lock_fields.

effective_dependency_selection hands skill_pairing to every
integrate_package_primitives call (install, audit replay, uninstall
survivors, local content) and the skill integrator narrows each skills
root to the skills paired with its targets. Uninstall shrink, audit
skill-subset-consistency and a new pre-deploy
InstallService.enforce_frozen_selections compare through the owner, so
a 0.36.x cross-product lock fails --frozen with a named reason before
anything deploys. The selection-merge guard now requires the pairing on
every deploy call and site; a parametrized mutation test proves it.

Fixes #3763

Co-authored-by: Copilot App <[email protected]>

* fix(lockfile): replay replaced sources with the locked pairing (#3763)

Fold python-architect review: a replacement-bound lock entry now
replays the locked skill_subset, target_subset and subset_pairings
instead of the rule's original edge, and a CLI --skill overlay that
widens a product selection clears any stale subset_pairings.

Co-authored-by: Copilot App <[email protected]>

* test(deps): port pairing lifecycle scenarios to the selection-merge suite (#3763)

PR-3 replaced its diamond lifecycle file with
test_skill_selection_merge_lifecycle.py; carry the exact-pairing
scenarios there (both declaration orders with byte-identical locks,
absorb on one harness only, cross-product lock refused by --frozen and
audit before deploy, uninstall shrink) and drop the resurrected file.

Co-authored-by: Copilot App <[email protected]>

* docs(changelog): place the pairing entry under Changed (#3769)

Co-authored-by: Copilot App <[email protected]>

* chore(conformance): regenerate CONFORMANCE for req-rs-018 codec and frozen tests (#3769)

Co-authored-by: Copilot App <[email protected]>

* test(deps): pin shared skills-root union and --skill overlay on pairings (#3763)

Fold test-coverage panel findings: copilot and cursor share
.agents/skills, so the per-root filter must take the union of their
paired skills; and a --skill overlay on a non-product pairing must widen
every selected target identically in deploy and in the lockfile.

Co-authored-by: Copilot App <[email protected]>

* docs(changelog): merge pairing entry into the Changed section (#3769)

Co-authored-by: Copilot App <[email protected]>

* test(install): expect the skill_pairing field on EffectiveDependencySelection (#3763)

Co-authored-by: Copilot App <[email protected]>

* fix(subsets): explicitly empty edges pair nothing; lock overlay uses real lock entries (#3763)

Align the pairing owner with #3786's explicit-empty rule: an edge whose
skills: or targets: is explicitly empty contributes no skill-target
pairs, and a node whose every edge is empty keeps the empty flat
selection (NodeSelection.lock_selection reconciles audit and uninstall).
effective_dependency_selection only treats a decoded SkillTargetSelection
as a pairing, and the #3784 lockfile overlay test uses LockedDependency.

Co-authored-by: Copilot App <[email protected]>

* docs(changelog): re-place the pairing entry after rebasing on #3786 (#3769)

Co-authored-by: Copilot App <[email protected]>

* fix(lockfile): fold CI findings on the pairing replay (#3769)

Replacement replay keeps the binding's merged flat selection (#3786
re-merges request evidence) and only carries the exact pairing; the
replay pairing helper reads subset_pairings directly so the lock
consumer contract covers the new field; services.py stays within its
LOC budget.

Co-authored-by: Copilot App <[email protected]>

* docs(changelog): keep the pairing entry under Unreleased after v0.36.1 (#3769)

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: danielmeppiel <[email protected]>
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] apm uninstall re-deploys every skill of surviving skill bundles, ignoring skills: selection

2 participants