Repository navigation
[0.38] feat(uninstall): --trust-lockfile consent path for offline or deleted sources (#4295) - #4603
Closed
Daniel Meppiel (danielmeppiel) wants to merge 4 commits into
Conversation
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-fuzzy-fishstick
branch
from
November 21, 2026 11:49
2d9d6ed to
8d091fc
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-fuzzy-fishstick-4295
branch
from
November 21, 2026 11:51
40d9b4c to
e9bbf14
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-fuzzy-fishstick
branch
from
November 21, 2026 12:32
8d091fc to
a6fe996
Compare
…evidence (#4295) When no receipt exists and no locked render can be produced (source offline, private or deleted; checkout and cache gone), `apm uninstall --trust-lockfile` deletes a refused file only when its bytes equal the single hash apm.lock.yaml records for it under its owner, prints each deleted path, and keeps and names every other file without failing. It never overrides a differing receipt or render, a render lacking the path, conflicting or missing recorded hashes, unreadable receipt state, unreadable or symlinked files. One decision in DeploymentEvidence (lockfile_consentable) drives the refusal preview and the deletion, rechecked at removal. Without the flag the exit code and filesystem effects are unchanged; the refusal now marks each file as deletable or kept under the flag and offers the flag only when at least one file is deletable. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…eption (#4295) Proposed amendment 0.1.75 revises req-lk-024 in place: on an uninstall the user explicitly consents to, a file with no local deployment record (read without error) and no producible render of its owning locked dependency MAY be deleted when its req-lk-012 content hash equals the single hash the lockfile records for that path under its owner, rechecked before removal, and each deletion is named. Contrary or missing evidence always keeps the file; consent is never implied by another option or configuration. Adds no statement. Sections 10.7, Appendix C and D, the requirements manifest, conformance tests and CONFORMANCE are updated. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-fuzzy-fishstick-4295
branch
from
November 21, 2026 12:34
e9bbf14 to
f41c4d4
Compare
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…evidence (#4295) When no receipt exists and no locked render can be produced (source offline, private or deleted; checkout and cache gone), `apm uninstall --trust-lockfile` deletes a refused file only when its bytes equal the single hash apm.lock.yaml records for it under its owner, prints each deleted path, and keeps and names every other file without failing. It never overrides a differing receipt or render, a render lacking the path, conflicting or missing recorded hashes, unreadable receipt state, unreadable or symlinked files. One decision in DeploymentEvidence (lockfile_consentable) drives the refusal preview and the deletion, rechecked at removal. Without the flag the exit code and filesystem effects are unchanged; the refusal now marks each file as deletable or kept under the flag and offers the flag only when at least one file is deletable. Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…eption (#4295) Proposed amendment 0.1.75 revises req-lk-024 in place: on an uninstall the user explicitly consents to, a file with no local deployment record (read without error) and no producible render of its owning locked dependency MAY be deleted when its req-lk-012 content hash equals the single hash the lockfile records for that path under its owner, rechecked before removal, and each deletion is named. Contrary or missing evidence always keeps the file; consent is never implied by another option or configuration. Adds no statement. Sections 10.7, Appendix C and D, the requirements manifest, conformance tests and CONFORMANCE are updated. Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…gment (#4295) Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…evidence (#4295) When no receipt exists and no locked render can be produced (source offline, private or deleted; checkout and cache gone), `apm uninstall --trust-lockfile` deletes a refused file only when its bytes equal the single hash apm.lock.yaml records for it under its owner, prints each deleted path, and keeps and names every other file without failing. It never overrides a differing receipt or render, a render lacking the path, conflicting or missing recorded hashes, unreadable receipt state, unreadable or symlinked files. One decision in DeploymentEvidence (lockfile_consentable) drives the refusal preview and the deletion, rechecked at removal. Without the flag the exit code and filesystem effects are unchanged; the refusal now marks each file as deletable or kept under the flag and offers the flag only when at least one file is deletable. Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…eption (#4295) Proposed amendment 0.1.75 revises req-lk-024 in place: on an uninstall the user explicitly consents to, a file with no local deployment record (read without error) and no producible render of its owning locked dependency MAY be deleted when its req-lk-012 content hash equals the single hash the lockfile records for that path under its owner, rechecked before removal, and each deletion is named. Contrary or missing evidence always keeps the file; consent is never implied by another option or configuration. Adds no statement. Sections 10.7, Appendix C and D, the requirements manifest, conformance tests and CONFORMANCE are updated. Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…4295) 0.1.75 is claimed by #4001 (req-pl-022) and 0.1.74 by #4559. Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…gment (#4295) Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Merged
10 of 14 tasks
Collaborator
Author
|
Superseded by #4650 (same commits ported, spec amendment renumbered to 0.1.76, changelog moved to changelog.d). |
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…evidence (#4295) When no receipt exists and no locked render can be produced (source offline, private or deleted; checkout and cache gone), `apm uninstall --trust-lockfile` deletes a refused file only when its bytes equal the single hash apm.lock.yaml records for it under its owner, prints each deleted path, and keeps and names every other file without failing. It never overrides a differing receipt or render, a render lacking the path, conflicting or missing recorded hashes, unreadable receipt state, unreadable or symlinked files. One decision in DeploymentEvidence (lockfile_consentable) drives the refusal preview and the deletion, rechecked at removal. Without the flag the exit code and filesystem effects are unchanged; the refusal now marks each file as deletable or kept under the flag and offers the flag only when at least one file is deletable. Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…eption (#4295) Proposed amendment 0.1.75 revises req-lk-024 in place: on an uninstall the user explicitly consents to, a file with no local deployment record (read without error) and no producible render of its owning locked dependency MAY be deleted when its req-lk-012 content hash equals the single hash the lockfile records for that path under its owner, rechecked before removal, and each deletion is named. Contrary or missing evidence always keeps the file; consent is never implied by another option or configuration. Adds no statement. Sections 10.7, Appendix C and D, the requirements manifest, conformance tests and CONFORMANCE are updated. Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…4295) 0.1.75 is claimed by #4001 (req-pl-022) and 0.1.74 by #4559. Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…gment (#4295) Supersedes: #4603 Co-authored-by: Copilot App <[email protected]>
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.
Description
This PR adds
apm uninstall --trust-lockfile, an explicit, per-invocation consent path for when deployment evidence is missing because no locked render can be produced (the source is offline, private or deleted, and the checkout and cache are gone) and no receipt exists.One decision, in the canonical owner.
DeploymentEvidence.lockfile_consentable(src/apm_cli/integration/cleanup.py, ownerfile-level-deploy-sync-cleanup) is true only when all four hold:_rendered_rootsis empty);compute_file_hash(req-lk-012 domain) equals the single hash apm.lock.yaml records for that path under its owners (ledger rows plusdeployed_file_hashes; none or conflicting means keep);verdict()consults it only afterconsent_to_lockfile_hashes(), so the same decision drives the refusal check (refusals) and both deletion sites. It is rechecked at removal, and install and prune never call it.Without the flag, the exit code and filesystem effects are exactly 0.37's. The refusal now marks each file
--trust-lockfile would delete itorkept even with --trust-lockfile. It offersUNINSTALL_EVIDENCE_TRUST_LOCKFILE(src/apm_cli/core/remediation.py) as a third remedy only when at least one file is deletable.With the flag, every refused file that is not consentable is kept and named by the existing kept-file warnings.
_abort_if_retained_target_cleanup_pathsignores those kept files and the skill directories holding them, so kept files do not fail the command; every existing failure exit still applies. Each consented deletion printsDeleted <path> (matched its apm.lock.yaml hash; --trust-lockfile).Spec: proposed amendment OpenAPM 0.1.75 revises req-lk-024 in place with the per-invocation consent exception and adds no statement. It is in its own commit (
spec(openapm): 0.1.75 ...). It touches Section 5.2, Section 10.7, Appendix C, Appendix D, the requirements manifest,tests/spec_conformance/test_deletion_evidence_reqs.pyand CONFORMANCE. It needs normal spec review: run the apm-spec-guardian advisory panel.Issue and approved scope
Issue: Fixes #4295
Human scope-approval comment: #4295 (comment) (the amended record, which supersedes #4295 (comment)). Governance eligibility:
record-present,contact_confirmation_needed: false.Does this PR complete the issue? Yes. It does not cover the following, which are out of scope: changing the default refusal, a lockfile hash authorizing deletion without the flag or over contrary evidence,
apm pruneand install cleanup, an interactive prompt, a--dry-runpreview, a config or env equivalent, and deleting files the lockfile does not record.--yesand--forcenever imply the flag: uninstall has neither option, and only--trust-lockfilecallsconsent_to_lockfile_hashes().Decisions (taken as recommended defaults, per rule S15):
--trust-lockfilewith--dry-runis accepted and has no effect, because there is no dry-run preview (out of scope).Type of change
Testing
Done-when: new module
tests/integration/test_uninstall_trust_lockfile_lifecycle.py.-g). After install, the receipts are removed, the checkout and cache are removed, and the origin repository is moved away.apm uninstall pkgrefuses with exit 1, changes nothing (apm.yml, apm.lock.yaml and the skills tree are byte-identical) and previews each file. The flag is offered as the last remedy.--trust-lockfileexits 0, deletes and printsbetaandgamma, keeps and names the editedalpha, and removes the package from apm.yml and apm.lock.yaml.apm audit --cithen passes or reports only the kept file.Red on main: on origin/main f8c31a5 the project cell fails at the refusal preview assertion (no
--trust-lockfilemarks; all three files refused as unproven), and every--trust-lockfileinvocation fails with click's no-such-option error. Green on head:APM_E2E_TESTS=1 APM_BINARY_PATH=.venv/bin/apm uv run --frozen --extra dev pytest tests/integration/test_uninstall_trust_lockfile_lifecycle.pygives 5 passed.Local evidence:
uv run --frozen --extra dev pytest tests/unit/integration/test_cleanup_helper.py -k trust_lockfile: 4 passed (single matching hash, conflicting hashes, no hash, unreadable receipt state, and a recheck after edit).uv run --frozen --extra dev pytest tests/spec_conformance/test_deletion_evidence_reqs.py: 9 passed (req-lk-024 consent exception oracles).tests/unit/coreremediation catalog and block proofs: passed.tests/lifecycle/generator/test_generator_rules.py: 28 passed (line anchors updated).lint_architecture_boundaries.py --root .(exit 0), complexity ratchet vs origin/main, check_test_assertions,tests.quality.taxonomy --changed(6 modules carry their marker and promise), check_taxonomy_allowances, specorphan_check(151 aligned), the Mode B detector (spec-concurrent edit; orphan_check owns it), andgen_statement(CONFORMANCE committed in the spec commit).uv run --frozen --extra dev pytest -n 2 tests/quality tests/integration/test_architecture_owner_rule_mutations.py: 1725 passed. One xdist worker crashed under memory pressure ontransport-platform-credential-report-owner; that case passes when rerun alone.tests/quality/test_cli_docs_surface.py: 12 passed.Changelog
## [Unreleased]inCHANGELOG.md:user-visible effect first, 25 words or fewer, ending with
(#PR);breaking changes only under upgrade notes; no Highlights; see
.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated (req-lk-024 prose, Section 10.7, Appendix C note, Appendix D 0.1.75 row).docs/public/specs/manifests/openapm-v0.1.requirements.ymlupdated (req-lk-024 notes).@pytest.mark.req("req-lk-024")cases added intests/spec_conformance/test_deletion_evidence_reqs.py.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.