Skip to content

fix(skills): rebuild recorded skills in the layout the install used (#3773) - #3793

Merged
Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-t3-p6-legacy-skill-layout
Nov 17, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-t3-p6-legacy-skill-layout

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Description

apm install --legacy-skill-paths deploys skills to per-client roots (.github/skills/ at project scope, ~/.copilot/skills/ or $COPILOT_HOME/skills/ at user scope) instead of the shared .agents/skills/. Nothing persisted that choice, and the paths that rebuild recorded deployments later run without the flag:

  • apm audit --ci replayed into .agents/skills/, so a clean legacy install failed drift (unintegrated: .agents/skills/..., orphaned: .github/skills/...).
  • apm uninstall <unrelated pkg> re-integrated survivors into .agents/skills/ (unrecorded), and uninstalling the skill package itself left its .github/skills/ files on disk (cleanup looked only under .agents/skills/).

Fix: one owner, src/apm_cli/integration/skill_layout.py, decides the effective skill layout.

  • resolve_skill_layout(targets, legacy_skill_paths=..., recorded_paths=...): install passes its flag (unchanged semantics); flagless rebuilds pass the lockfile's recorded deployed paths, and a target whose recorded skills live under its per-client root keeps that layout. No lockfile schema change.
  • resolve_reintegration_targets(...) = resolve_targets + recorded layout. Routed through it: resolve_audit_targets (so the drift replay, audit_replay, ci_checks and the content scanner all follow), uninstall cleanup (commands/uninstall/cli.py step 3), the uninstall survivor rebuild (engine._sync_integrations_after_uninstall: survivors rebuild in the layout the survivors recorded; Phase 1 cleanup of the removed packages' paths recognises both layouts via with_every_skill_layout, including at project scope, so a mixed lockfile never migrates a survivor), and the apm export-patch diff targets (same layout as the replay).
  • Install-time flag sites (install/phases/targets.py, install/local_bundle_handler.py, adopt/discovery.py) call resolve_skill_layout(..., legacy_skill_paths=True) instead of apply_legacy_skill_paths directly.

Static guard install-deployment-skill-layout (registered on the new skill-layout owner record in .apm/architecture/owners/install-deployment.json): no module outside the owner touches apply_legacy_skill_paths; the rebuild modules (uninstall cli/engine, drift, audit_replay, export_patch) never call the layout-blind resolve_targets (one allowlisted native-registration read); resolve_audit_targets must recover the recorded layout. The existing registry_delegation.audit_target_selection check now requires resolve_audit_targets to delegate to resolve_reintegration_targets.

Issue and approved scope

Issue: Fixes #3773

Human scope-approval comment: #3773 (comment) (current record; supersedes the earlier record on the same issue)

Does this PR complete the issue, or what remains? Completes it. Two oracle scenarios depend on sibling PRs and are wired to activate on their own:

Type of change

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

Testing

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

Oracle scenarios (real binary, local git/HTTPS fixtures, temp HOME, no network), tests/integration/test_legacy_skill_layout_lifecycle.py with helper tests/utils/skill_selection_world.py (copied verbatim from the RT4 red-team worktree):

  • project and user scope, legacy and default layouts: install -> audit --ci green -> uninstall unrelated package (skills unchanged, nothing in .agents/skills/ for legacy, bundle deployed_files unchanged) -> audit --ci green -> uninstall the bundle (skills root empty).
  • real drift in the legacy layout is still reported (.github/skills/alpha/SKILL.md, never .agents/skills).
  • RT4 audit repro proto_legacy.py: audit rc 0 {}, skills only under .github/skills/.

Panel folds (advisory comment #3793 (comment)): survivor-only rebuild layout + both-layout cleanup, owner prefix from skills_rel_root, export-patch routing + guard coverage, env-rooted lifecycle, catalog-wide unit round-trip, mixed-layout uninstall unit cases, xfail split.

Fail-before evidence (src reverted to main 1759e1e, tests from this head): 8 failed, 4 passed across the legacy lifecycle cases (project, user, real drift, RT4, codex env root) and all three uninstall layout cases (legacy, removed-legacy/survivor-converged, removed-converged/survivor-legacy). First-commit run:

  • lifecycle: 4 failed, 2 passed (default-layout cases pass; legacy project/user audit fails with unintegrated: .agents/skills/alpha/SKILL.md ... orphaned: .github/skills/...; drift test reports .agents/skills; RT4 uninstall leaves 4 skills in .agents/skills).
  • unit (src reverted via git apply -R): 6 failed (resolve_audit_targets legacy case -> .agents/skills; uninstall leaves .github/skills/gone; owner tests).

Validation commands on this head:

  • APM_E2E_TESTS=1 APM_BINARY_PATH=.venv/bin/apm .venv/bin/python -m pytest -p no:xdist tests/integration/test_legacy_skill_layout_lifecycle.py tests/integration/test_local_shared_root_skill_cleanup.py tests/integration/test_agent_skills_target.py tests/integration/test_hook_wipe_target_scope_e2e.py tests/integration/test_audit_primitive_contract.py tests/integration/test_copilot_app_targets_coverage.py -> 294 passed, 1 skipped, 1 xfailed (first commit); after folds tests/integration/test_legacy_skill_layout_lifecycle.py tests/integration/test_local_shared_root_skill_cleanup.py tests/integration/test_hook_wipe_target_scope_e2e.py tests/integration/test_audit_primitive_contract.py -> 139 passed, 1 skipped, 1 xfailed
  • .venv/bin/python -m pytest -p no:xdist tests/unit/test_audit_*.py (ci_command, command, deployment_owners, fail_on_drift) tests/unit/test_drift_detection.py tests/unit/test_uninstall_*.py (engine helpers/phase3w5/validation, reintegration, shared diamond/ownership, transitive cleanup) tests/unit/install/test_drift*.py tests/unit/install/test_install_local_bundle*.py tests/unit/install/phases/test_targets_phase.py tests/unit/adopt tests/unit/install/test_skill_path_migration.py tests/unit/policy/test_audit_claim_paths.py tests/unit/integration/test_copilot_cowork_target.py tests/unit/test_surviving_deps_reintegration.py tests/unit/integration/test_targets.py tests/unit/test_deployment_materialization_receipts.py -> 818 passed, 1 skipped (first commit); after folds tests/unit/commands/test_export_patch.py, uninstall/reintegration/receipts unit files, test_targets.py, guard + runner inventory + skill-layout mutation + audit-target tests -> 357 passed, 1 skipped
  • .venv/bin/python -m pytest -p no:xdist tests/unit/scripts/test_architecture_skill_layout_guard.py tests/unit/scripts/test_architecture_skills_root_guard.py tests/unit/scripts/test_architecture_runner.py::test_registered_rule_inventory_matches_frozen_semantic_contract tests/integration/test_architecture_owner_rule_mutations.py -k "skill or registered or matrix" -> 23 passed; tests/integration/test_architecture_audit_targets.py + audit-target mutation case -> 7 passed
  • Lint: uvx [email protected] check / format --check on src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py -> clean; pylint R0801 -> 10.00/10; bash scripts/lint-auth-signals.sh -> clean; bash scripts/lint-architecture-boundaries.sh -> exit 0; file-length, YAML and relative_to guards -> 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.

…3773)

`apm install --legacy-skill-paths` deploys skills to per-client roots
(.github/skills, ~/.copilot/skills), but nothing downstream knew that:
the `apm audit --ci` drift replay and the uninstall cleanup and survivor
rebuild resolved targets without the flag, so a clean legacy install was
reported as drift and uninstalling an unrelated package re-deployed
survivors into .agents/skills unrecorded.

integration/skill_layout.py now owns the effective skill layout:
install passes its flag through resolve_skill_layout, and every flagless
rebuild recovers the layout from the lockfile's recorded deployed paths
(resolve_reintegration_targets; resolve_audit_targets routes through it).
No lockfile schema change. Guarded by install-deployment-skill-layout.

apm-spec-waiver: skill layout recovery for audit and uninstall rebuilds; no spec requirement changes

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 17:37
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

PR #3793 makes audit drift replay and uninstall rebuild skills in the layout recorded in the lockfile. This removes the false drift and the stray .agents/skills writes after install --legacy-skill-paths, and a static guard keeps it that way.

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

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

Both panelists agree the design and the fix are sound. There is now one owner for skill layout (skill_layout.resolve_skill_layout / resolve_reintegration_targets), and every rebuild path routes through it: resolve_audit_targets, the uninstall engine and the uninstall CLI. Install-time flag sites call the same owner, and an architecture-linter check stops other modules from bypassing it. The tests are real evidence: the real-binary lifecycle test fails 4 of 6 on main and passes on head, and 6 unit tests fail with src reverted. No finding is blocking. Weighed against the #3773 scope record (every rebuild path at project and user scope; no migration between layouts; no selection logic), the most important point is the architect's: the uninstall rebuild combines the removed package's paths with the survivors' paths, so a mixed lockfile could move a survivor into the legacy layout. That is a layout migration the scope rules out, so fixing it here is in scope. Three test gaps are also in-scope folds: env-var user roots (codex via CODEX_HOME) have no running test, only copilot is proven end to end, and the strict xfail hides the #3773 invariant behind the #3760 subset checks. Reusing skills_rel_root in the owner is a cheap fold. Routing export_patch through the owner can wait.

Aligned with: portable by manifest (rebuilds follow the layout recorded in the lockfile); governed by policy (owner record plus static guard); multi-harness (per-client roots honoured per target); pragmatic as npm (audit --ci stops reporting false drift and uninstall cleans up after itself).

Panel summary

Persona B R N Takeaway
Python Architect 0 3 0 Sound single-owner design that fixes the bug. Gaps: owner re-derives the skills root, closed-list guard misses export-patch, removed-package paths can set survivor layout.
Test Coverage Expert 0 3 0 Real-binary lifecycle proves copilot legacy layout at project and user scope. Gaps: env-var user roots (codex today) and catalog-wide per-target recovery; xfail hides one invariant.

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

Top 5 follow-ups

  1. [Python Architect] [IN-SCOPE FOLD] In the uninstall engine, derive the survivors' rebuild layout from the survivors' recorded paths only; keep the removed package's paths only for cleanup, which needs both layouts. -- The combined set can move a survivor into a different layout in a mixed lockfile, which audit --ci reports drift after install --legacy-skill-paths #3773's scope excludes.
  2. [Test Coverage Expert] [IN-SCOPE FOLD] Run the env-var user-root lifecycle test for every USER_ROOT_ENV_VARS target with converged skills, so codex (CODEX_HOME) runs today and copilot (COPILOT_HOME) joins when fix(targets): one owner for harness user roots; honor COPILOT_HOME (#3745) #3782 lands. -- The absolute root_dir prefix match is the most fragile branch and has no test that runs today.
  3. [Test Coverage Expert] [IN-SCOPE FOLD] Split the strict-xfail skill-subset test: assert nothing is written to .agents/skills first, then xfail only the [BUG] apm uninstall re-deploys every skill of surviving skill bundles, ignoring skills: selection #3760/fix(uninstall): keep surviving bundles' skills: selection (#3760) #3784 subset checks. -- Keeps the audit --ci reports drift after install --legacy-skill-paths #3773 invariant checked whichever PR merges first.
  4. [Test Coverage Expert] [IN-SCOPE FOLD] Add a parametrized unit round-trip over every KNOWN_TARGETS skills mapping with deploy_root, at project and user scope. -- If a target's per-client path differs from root_dir/subdir, rebuilds silently fall back to .agents/skills.
  5. [Python Architect] [FOLD: skills_rel_root / DEFERRABLE: export_patch] Build the legacy prefix from apply_legacy_skill_paths([profile])[0].skills_rel_root; separately route export_patch._resolve_diff_targets through resolve_audit_targets and add it to the guard. -- Ties the layout check to where install writes; export_patch is harmless today.

Recommendation

Ship for 0.36.1 once the in-scope folds are in. The first priority is the survivor-only layout in uninstall, because without it the fix can cause the layout migration the scope rules out. Next come the codex env-root test and the xfail split, both small and both protecting the promise this PR makes. Reusing skills_rel_root and adding the catalog-wide unit round-trip are cheap and fit here too. Track export_patch routing as a separate follow-up. Coordinate the merge order with #3784 so the second PR to land rebases cleanly.


Full per-persona findings

Python Architect

  • [recommended] The new owner rebuilds the skills-root path itself instead of using the existing skills_rel_root owner. at src/apm_cli/integration/skill_layout.py:28
    _records_legacy_skill_layout joins root_dir and subdir by hand, duplicating TargetProfile.skills_rel_root; if the skills-root rule changes, the layout predicate drifts from where install writes.
    Suggested: prefix = apply_legacy_skill_paths([profile])[0].skills_rel_root + "/"
  • [recommended] The static guard only checks 4 named modules and only flags resolve_targets; commands/export_patch.py _resolve_diff_targets mirrors drift but still calls the layout-blind resolver. at scripts/architecture_linter/checks/install_skill_layout.py:33
    Harmless today because governed_root_dirs keeps only the first path segment, but the invariant is not enforced.
    Suggested: Route _resolve_diff_targets through resolve_audit_targets and add export_patch.py to REBUILD_MODULES.
  • [recommended] Uninstall combines the removed package's paths with the survivors' paths, so a removed package's layout can move survivors to a different layout. at src/apm_cli/commands/uninstall/engine.py:1161
    Cleanup needs both layouts; the rebuild should follow survivors only.
    Suggested: Resolve rebuild targets from survivors' recorded paths; the cleanup partition uses the union of both layouts.

Test Coverage Expert

  • [recommended] Legacy-layout recovery under an env-var user root has no running test; only COPILOT_HOME covers it and is skipped until fix(targets): one owner for harness user roots; honor COPILOT_HOME (#3745) #3782. at tests/integration/test_legacy_skill_layout_lifecycle.py
    The absolute root_dir prefix match is the most fragile branch; codex (CODEX_HOME, skills deploy_root .agents) is affected today.
    Suggested: Parametrize the env-root test over USER_ROOT_ENV_VARS targets with converged skills.
    Proof (missing at): tests/integration/test_legacy_skill_layout_lifecycle.py -- proves: a -g --legacy-skill-paths install with an env root outside HOME keeps audit clean and leaks nothing into ~/.agents/skills.
  • [recommended] Per-target layout recovery is proven end to end for copilot only. at tests/unit/integration/test_targets.py
    A target whose per-client path differs from root_dir/subdir would silently fall back to .agents/skills.
    Suggested: Catalog-parametrized unit round-trip over every KNOWN_TARGETS skills mapping with deploy_root, both scopes.
    Proof (missing at): tests/unit/integration/test_targets.py -- proves: whatever client a user installed for with --legacy-skill-paths, audit and uninstall rebuild there.
  • [recommended] The strict xfail on the skill-subset uninstall test also hides the .agents/skills invariant for that scenario until fix(uninstall): keep surviving bundles' skills: selection (#3760) #3784 lands. at tests/integration/test_legacy_skill_layout_lifecycle.py:117
    xfail cannot tell which assertion failed; the audit --ci reports drift after install --legacy-skill-paths #3773 assertion runs after the [BUG] apm uninstall re-deploys every skill of surviving skill bundles, ignoring skills: selection #3760 one.
    Suggested: Assert the .agents/skills invariant first, then pytest.xfail only for the subset checks.
    Proof (missing at): tests/integration/test_legacy_skill_layout_lifecycle.py -- proves: with a skills: subset dependency, uninstalling an unrelated package under the legacy layout never writes into .agents/skills.

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.

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

When CODEX_HOME equals HOME, the unnormalized ./skills/ prefix prevents legacy layout detection, causing audit replay and survivor rebuilding to incorrectly select .agents/skills.

1 open issue
What changed in this PR

This PR addresses #3773 by recovering the installed skill layout from lockfile deployment paths, so audit and uninstall can preserve legacy per-client locations without a schema change.

Changes:

  • Centralizes skill-layout resolution and routes install, adoption, audit, and uninstall through it.
  • Adds lifecycle tests, regression coverage, and an architecture guard against bypassing the layout owner.
  • Documents layout preservation; selection and COPILOT_HOME scenarios remain coordinated with sibling fixes.
File Description
tests/​utils/​skill_selection_world.py Adds isolated package fixtures and lifecycle helpers.
tests/​unit/​test_surviving_deps_reintegration.py Covers legacy cleanup and survivor rebuilding.
tests/​unit/​scripts/​test_architecture_skill_layout_guard.py Tests layout-owner enforcement.
tests/​unit/​scripts/​test_architecture_runner.py Registers the guard in the expected inventory.
tests/​unit/​integration/​test_targets.py Tests recorded layout recovery and audit targets.
tests/​integration/​test_legacy_skill_layout_lifecycle.py Covers project and user install/audit/uninstall lifecycles.
tests/​integration/​test_architecture_owner_rule_mutations.py Adds a layout-bypass mutation case.
src/​apm_cli/​integration/​targets.py Makes audit recover recorded skill layouts.
src/​apm_cli/​integration/​skill_layout.py Introduces the shared layout resolver.
src/​apm_cli/​install/​phases/​targets.py Routes the install flag through the resolver.
src/​apm_cli/​install/​local_bundle_handler.py Routes local-bundle layout selection through the resolver.
src/​apm_cli/​commands/​uninstall/​engine.py Preserves recorded layouts during cleanup and rebuilding.
src/​apm_cli/​commands/​uninstall/​cli.py Resolves cleanup targets using recorded paths.
src/​apm_cli/​adopt/​discovery.py Uses the resolver to inventory legacy roots.
scripts/​architecture_linter/​checks/​registry_owner_guards.py Updates required audit-target delegation.
scripts/​architecture_linter/​checks/​install_skill_layout.py Detects layout-owner bypasses.
scripts/​architecture_linter/​checks/​install_deployment_analyzers.py Registers the new analyzer.
packages/​apm-guide/​.apm/​skills/​apm-usage/​commands.md Explains audit and uninstall layout preservation.
docs/​src/​content/​docs/​reference/​targets-matrix.md Clarifies flagless reuse of recorded layouts.
docs/​src/​content/​docs/​reference/​cli/​install.md Updates legacy-path flag documentation.
CHANGELOG.md Records the lifecycle fix.
.apm/​architecture/​owners/​install-deployment.json Declares the layout owner and guard.

Review effort: Balanced

Comment thread src/apm_cli/integration/skill_layout.py Resolved
Panel folds for #3793:
- uninstall rebuilds survivors in the layout the survivors recorded; the
  removed packages' paths only feed cleanup, which now recognises both
  layouts (with_every_skill_layout), so a mixed lockfile never migrates
  a survivor between layouts
- the owner derives the per-client prefix from skills_rel_root
- export-patch diff targets follow the recorded layout like the replay;
  export_patch.py joins the guard's rebuild modules
- tests: env-rooted user scope lifecycle over every USER_ROOT_ENV_VARS
  target with converged skills (codex runs today, copilot with #3782),
  catalog-wide unit round-trip, mixed-layout uninstall cases, and the
  RT4 subset test checks .agents/skills before xfailing on #3760 only

apm-spec-waiver: skill layout recovery for audit and uninstall rebuilds; no spec requirement changes

Co-authored-by: Copilot App <[email protected]>
A harness user root equal to HOME (for example CODEX_HOME=$HOME) scopes
to root_dir ".", so the per-client prefix was "./skills/" while the
lockfile records "skills/...". Normalize the prefix before matching.

apm-spec-waiver: skill layout recovery for audit and uninstall rebuilds; no spec requirement changes

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

Copy link
Copy Markdown
Collaborator Author

Folded in this run

  • (panel) Uninstall rebuilds survivors in the layout the survivors recorded; cleanup of removed packages' paths recognises both layouts (with_every_skill_layout), so a mixed lockfile never migrates a survivor -- resolved in 1b3a15b.
  • (panel) The owner derives the per-client prefix from skills_rel_root -- resolved in 1b3a15b.
  • (panel) apm export-patch diff targets follow the recorded layout like the replay; export_patch.py joins the guard's rebuild modules -- resolved in 1b3a15b.
  • (panel) Env-rooted user-scope lifecycle over every USER_ROOT_ENV_VARS target with converged skills (codex runs today; copilot activates with fix(targets): one owner for harness user roots; honor COPILOT_HOME (#3745) #3782) -- resolved in 1b3a15b.
  • (panel) Catalog-wide unit round-trip of recorded layout recovery, plus mixed-layout uninstall cases -- resolved in 1b3a15b.
  • (panel) The RT4 subset test checks .agents/skills first and xfails only on the [BUG] apm uninstall re-deploys every skill of surviving skill bundles, ignoring skills: selection #3760 subset checks -- resolved in 1b3a15b.
  • (copilot) Normalize the per-client prefix so a user root equal to HOME (root_dir == ".") matches recorded skills/... paths -- resolved in d2cdf56.

Copilot signals reviewed

  • src/apm_cli/integration/skill_layout.py -- LEGIT: CODEX_HOME=$HOME scopes to root_dir ".", so ./skills/ never matched recorded skills/...; normalized, fail-before unit test added (resolved in d2cdf56).

Regression-trap evidence (mutation-break gate)

  • tests/integration/test_legacy_skill_layout_lifecycle.py + tests/unit/test_surviving_deps_reintegration.py -- reverted all src to main; 8 tests FAILED as expected; restored.
  • tests/unit/scripts/test_architecture_skill_layout_guard.py + test_owner_rule_catches_its_guard_mutation[install-deployment-skill-layout] -- disabled the install-deployment-skill-layout check; 5 tests FAILED as expected; restored.
  • tests/unit/integration/test_targets.py::TestRecordedSkillLayout::test_user_root_equal_to_home_recovers_legacy_layout -- deleted the prefix normalization; test FAILED as expected; restored.

Lint contract

uvx [email protected] check and format --check (the uv.lock pin) silent on src/, tests/ and the architecture linter scripts; pylint R0801 10.00; lint-auth-signals.sh clean; lint-architecture-boundaries.sh exit 0.

CI

Observed green at exact head d2cdf56: 23 pass, 3 skipping, 0 pending/failed (Lint, Build & Test shards, Lifecycle Smoke shards, Architecture Ratchet/Scaling, Windows gates, Spec conformance gate, CodeQL, gate) (after 1 CI fix iteration(s)).


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

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 0dddb80 into main Nov 17, 2026
26 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-t3-p6-legacy-skill-layout branch November 17, 2026 19:33
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 17, 2026
#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]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 17, 2026
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]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
)

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

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

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

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

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
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]>
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.

audit --ci reports drift after install --legacy-skill-paths

2 participants