Repository navigation
test(install): assert one targeted install reconciles a dropped dependency - #3635
Conversation
…dency #3528 ran the install twice because the first run could read the previously materialized manifest (#3401). With #3571 merged, assert the record's Done-when directly: a single apm install PKG / apm install -g PKG after the drop removes the lock entry, apm_modules copy and deployed skill. Fixes #3502 Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the test-only update requiring reconciliation after a single targeted install.
No open issues 🎉
What changed in this PR
Tightens the existing regression for #3502 to require reconciliation after one targeted install, now that #3571 fixed stale local-manifest reads. This is a test-only change; production behavior is unchanged.
Changes:
- Removes the second post-drop install in both project- and user-scope scenarios.
- Updates the docstring and comment to state the single-run requirement while preserving all cleanup and dependency-retention assertions.
| File | Description |
|---|---|
tests/integration/test_targeted_install_dropped_dependency_lifecycle.py |
Requires one targeted install to remove the dropped dependency while retaining shared and unrelated packages. |
Review effort: Balanced
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Test Coverage Expert | 0 | 0 | 0 | All six Done-when clauses have lifecycle-tier assertions exercised with a single install at both scopes; mutation evidence confirms regression-trap; no guard weakened. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Recommendation
Test-only change, zero findings, clean lint, mutation-verified regression trap. No reason to defer.
Full per-persona findings
Test Coverage Expert
No findings.
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.
TL;DR
Tightens the #3502 real-CLI regression from #3528 to assert the record's Done-when literally: one
apm install PKG/apm install -g PKGafter a local package drops a dependency reconciles the lock,apm_modules/and deployed skills. #3528 had to run the install twice because the first run read the stale materialized manifest (#3401); #3571 fixed that, so the second run is now dead weight that would mask a #3401 regression. No source change — behavior already holds onmain.Fixes #3502
Description
The regression
tests/integration/test_targeted_install_dropped_dependency_lifecycle.pynow runs the targeted install once after the drop (bothuser-scopeandproject-scopeparameters) and keeps every existing assertion: dropped lock entry /apm_modulescopy / deployed skill gone, shared child kept and re-anchored tosibling,siblingandbystanderlock entries byte-identical,apm deps treeno longer lists the dropped child.Issue and approved scope
Issue: Fixes #3502
Human scope-approval comment: #3502 (comment) (
apm-scope:v1, approver and review contact Daniel Meppiel (@danielmeppiel)). Eligibility re-checked from a trustedorigin/maincopy:state: record-present,authorizes_implementation: false; fresh responsible-human confirmation relayed for exactly this scope after #3571 landed.Does this PR complete the issue? Yes. #3528 delivered the reconciliation (
Refs #3502); #3571 delivered the out-of-scope stale-read fix (#3401). This PR supplies the remaining Done-when evidence: "after a local package drops a dependency oneapm install -g PATH(andapm install PATH) removes…". Out of scope and untouched:apm prune --global, prune algorithm, lockfile schema.Problem (WHY)
# The first run may still read the previously materialized parent manifest (#3401)).Approach (WHAT)
Test-only: drop the second
scenario.install(parent)and replace the #3401 caveat comment with the single-run invariant. Additive: see Implementation.Implementation (HOW)
tests/integration/test_targeted_install_dropped_dependency_lifecycle.pyapm install"; the post-drop step callsscenario.install(parent)once. All assertions unchanged.Diagram
Legend: the post-drop lifecycle the test now asserts, in one install run.
flowchart LR A["install parent, sibling, bystander"] --> B["drop child-dropped from parent apm.yml"] B --> C["ONE apm install parent (-g or project)"] C --> D["lock, apm_modules, skills, deps tree reconciled"]Trade-offs
Benefits
apm installkeeps transitive dependencies of a local package after the package's manifest stops declaring them #3401-style stale-manifest regression on local packages now fails this test (mutation evidence below) instead of being masked by a second run.apm installsubprocess per parameter in CI.Validation
Note
Local preflight skipped by maintainer instruction (2026-11-12); CI is the gate.
apm install -g PKGremoves it from lock,apm_modulesand~/.claude/skills, keeps shared deps and leaves other packages' lock entries alonetests/integration/test_targeted_install_dropped_dependency_lifecycle.py::test_targeted_install_removes_dependency_dropped_by_selected_package[user-scope]apm install PKG...::test_targeted_install_removes_dependency_dropped_by_selected_package[project-scope]Commands and results
How to test
APM_BINARY_PATH=$PWD/.venv/bin/apm uv run --extra dev pytest tests/integration/test_targeted_install_dropped_dependency_lifecycle.py -p no:xdist -q→ 2 passed.src/apm_cli/drift.py::should_force_ref_recheck, changeif dep_ref.is_local:toif dep_ref.is_local and dep_ref.replacement is not None:and return False for locals below → both parameters fail onchild-dropped.Type of change
Testing
Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regeneratedCo-authored-by: Copilot [email protected]