Repository navigation
fix(prune): record dev-only survivors so pack after prune excludes them - #5780
Merged
Merged
Conversation
Pin generated-graph seed 1057546234, where a survivor left reachable only through dev keeps its production flag after prune, and add a prune-then- pack cell: with the alias chain kept fail-closed, pack right after prune must ship no dependency that is now dev-only. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Prune re-derived a survivor's dev status only for rows it re-parented or repaired, and not at all while it kept a chain fail-closed. A row left reachable only through dev declarations kept its production flag until the next install, so apm pack in that window shipped it. Every surviving row the complete walk reaches now takes the dev status a fresh install records; no other lockfile field changes. Fixes #5776 apm-spec-waiver: prune dev-flag repair on the lockfile is not normed by any OpenAPM requirement Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the prune-to-pack dependency metadata fix.
No open issues 🎉
What changed in this PR
Fixes #5776 by refreshing surviving dependencies’ dev-only status during prune, so an immediate apm pack excludes them without requiring another install.
Changes:
- Derives survivor dev status from the complete reachability walk, including when ambiguous chains are retained.
- Adds prune-to-pack regression coverage and pins the reported failing seed.
- Records the regression and user-visible fix.
| File | Description |
|---|---|
tests/integration/test_prune_survivor_metadata_lifecycle.py |
Tests survivor metadata and dev-only exclusion from packs. |
tests/integration/test_prune_generated_local_graphs.py |
Pins the failing seed and includes it in chunked coverage. |
tests/fixtures/lifecycle_bug_ledger/bugs/5776.json |
Records the bug and regression tests. |
src/apm_cli/install/orphans.py |
Refreshes dev status for reached survivors. |
changelog.d/5780.fixed.md |
Documents the prune-to-pack fix. |
Review effort: Balanced
Merged
5 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
3c6d5bcfc317677410242f1fc911c1a1d1246fc5↑ Prune modules that touch dev status: 224 passed locally; prune/orphan unit suites: 4843 passed.
↓ The full Integration run at this head is pending.
_decide_installed_pathsre-derivedis_devonly for repaired or direct rows, and only when settled; seed 1057546234 keeps an alias chain fail-closed, so p5 was never re-derived.is_devNone -> True on the next install) reproduces at main and is gone after the fix.Description
After
apm prune, a surviving dependency that is now reachable only through dev declarations kept its production flag (is_devunset) until the nextapm install.apm packin that window shipped it, because the exporters skip only rows markedis_dev.Prune re-derived dev status only for rows it re-parented or repaired, and only when it kept nothing fail-closed. Now every surviving row the complete reachability walk reaches takes the dev status a fresh install records (
orphans._walked_dev_status). The walk is used only when it is complete; rows prune removes are excluded. No other lockfile field changes, and install-timeis_devcomputation is untouched._direct_rows, now a subset of the new rule, is removed.Issue and approved scope
Issue: Fixes #5776
Human scope-approval comment: #5776 (comment) (
scripts/governance/eligibility.cjsat main ef53e98: record-present, review contact danielmeppiel).This PR completes the issue.
Type of change
Testing
All runs used the host guard
local-test.sh, sequentially:APM_E2E_TESTS=1 APM_BINARY_PATH=.venv/bin/apm pytest tests/integration/test_prune_survivor_metadata_lifecycle.py tests/integration/test_prune_generated_local_graphs.py tests/integration/test_prune_multi_parent_survivor_lifecycle.py: 23 passed, 1 xfailedtests/unit/install: 4843 passedrelative_toguards, symlinks, auth signals, architecture boundaries, complexity, taxonomy and obligation ratchets, and tm006: all clean.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.