Skip to content

Uninstall: consent path for offline or deleted sources #4295

Closed

Description

Summary

Since 0.37, apm uninstall removes a tracked file only when it has deployment evidence: a local deployment receipt, or a render of the locked package version that matches the file. When the source is unreachable (offline, private or deleted) and no receipt exists yet (for example right after upgrading), uninstall refuses with exit 1 and changes nothing. The 0.37 remedies are to run apm install once with the source reachable, or to remove the files manually.

Desired behaviour

An explicit, user-consented path for uninstalling when the source cannot be reached:

  • delete only files whose bytes equal the locked hash, printing each deleted path;
  • keep any file whose bytes differ, and name it;
  • the lockfile alone never authorizes deletion; the explicit consent replaces the missing evidence.

Notes

Activity

  1. danielmeppiel commented on Nov 20, 2026

    @danielmeppiel
    CollaboratorAuthor

    0.38 by Daniel's 2026-11-20 scope call: enhancement/design; 0.37 fails closed with a required proof cell.

  2. danielmeppiel commented on Nov 21, 2026

    @danielmeppiel
    CollaboratorAuthor

    Decision: approve
    Area: project
    Scope: An explicit consent path for uninstalling when deployment evidence is missing (for example the source is offline, private or deleted and no receipt exists yet). With --trust-lockfile, for each file _refuse_uninstall_without_evidence in src/apm_cli/commands/uninstall/cli.py would refuse, uninstall deletes the file only when its bytes equal the hash apm.lock.yaml records for it and prints each deleted path; a file whose bytes differ, or is unreadable or symlinked, is kept and named with the existing kept-file warning, and the command exits 0. The verdict stays with DeploymentEvidence in src/apm_cli/integration/cleanup.py (owner file-level-deploy-sync-cleanup), which gains the consented hash-equality verdict; no second deletion rule. Without the flag, behaviour is exactly 0.37: refuse with exit 1 and change nothing. The uninstall evidence remedies (UNINSTALL_EVIDENCE_REMOVE, UNINSTALL_EVIDENCE_REINSTALL in src/apm_cli/core/remediation.py) name the flag as the third remedy.
    Done when: an installed-CLI lifecycle test (new module tests/integration/test_uninstall_trust_lockfile_lifecycle.py) that fails on main d365b87: after install, the deployment receipts are removed and the package source made unreachable; apm uninstall <pkg> still refuses and changes nothing; apm uninstall <pkg> --trust-lockfile deletes and prints every file equal to its locked hash, keeps and names one edited file, removes the package from apm.yml and apm.lock.yaml, and apm audit --ci then passes or reports only the kept file as unmanaged; the same with -g. Controls stay green unchanged: the Uninstall refused cells in tests/lifecycle/security/test_integrity.py and tests/integration/test_uninstall_refusal_lockfile_truth_lifecycle.py. Docs: reference/cli/uninstall.md (Options and the deployment-evidence paragraph in Behavior) and the uninstall row of packages/apm-guide/.apm/skills/apm-usage/commands.md. One Added line in CHANGELOG.md under [Unreleased] ending with the PR number.
    Out of scope: changing the default refusal; letting a lockfile hash authorize deletion without the flag; apm prune and install cleanup; an interactive prompt; deleting files the lockfile does not record.
    Review contact: Daniel Meppiel (@danielmeppiel)

  3. added
    status/accepted
    on Nov 21, 2026
  4. danielmeppiel commented on Nov 21, 2026

    @danielmeppiel
    CollaboratorAuthor

    Decision: approve
    Area: project
    Scope: An explicit consent path for uninstalling when deployment evidence is missing because no locked render can be produced (source offline, private or deleted, checkout gone) and no receipt exists. With --trust-lockfile, uninstall deletes a file that _refuse_uninstall_without_evidence in src/apm_cli/commands/uninstall/cli.py would refuse only when: receipt state was read without error and holds no receipt for it; no render of its owning locked package could be produced; and its content hash (req-lk-012 domain) equals the hash apm.lock.yaml records for that path under that owner. Every other refused file is kept and named: a receipt or render that differs, a successful render lacking the path, no or conflicting recorded hash, unreadable, or symlinked. One uninstall-scoped decision in DeploymentEvidence (src/apm_cli/integration/cleanup.py, owner file-level-deploy-sync-cleanup) drives both the refusal check and the deletion, rechecking content before removal; install and prune are unchanged. Each deleted path is printed. Kept files do not fail the command; existing failure exits still apply. Without the flag, exit code and filesystem effects are exactly 0.37's; the refusal marks each file as deletable or kept under the flag and offers the flag (src/apm_cli/core/remediation.py) only when at least one file is deletable. req-lk-024 is amended through normal spec review to permit only this per-invocation consent exception, and the code cites it.
    Done when: an installed-CLI lifecycle test (new module tests/integration/test_uninstall_trust_lockfile_lifecycle.py) that fails on main f8c31a5: after install, receipts are removed, the checkout and cache removed and the source made unreachable; apm uninstall <pkg> refuses, changes nothing and previews each file; with --trust-lockfile it deletes and prints every eligible file, keeps and names one edited file, removes the package from apm.yml and apm.lock.yaml, and apm audit --ci passes or reports only the kept file as unmanaged; the same with -g. Negative controls: with the source reachable, a lockfile row claiming a user-authored file with its matching hash keeps it under the flag; a file with a mismatched receipt and no matching render is kept; unreadable receipt state deletes nothing. Existing Uninstall refused cells in tests/lifecycle/security/test_integrity.py and tests/integration/test_uninstall_refusal_lockfile_truth_lifecycle.py stay green unchanged. Spec: req-lk-024 amendment with conformance updates. Docs: reference/cli/uninstall.md and the uninstall row of packages/apm-guide/.apm/skills/apm-usage/commands.md. One Added line in CHANGELOG.md under [Unreleased] ending with the PR number.
    Out of scope: changing the default refusal; a lockfile hash authorizing deletion without the flag or over contrary evidence; apm prune and install cleanup; an interactive prompt; a --dry-run preview; a config or environment equivalent of the flag; deleting files the lockfile does not record.
    Review contact: Daniel Meppiel (@danielmeppiel)

  5. danielmeppiel commented on Nov 21, 2026

    @danielmeppiel
    CollaboratorAuthor

    The record above supersedes the earlier apm-scope:v1 record on this issue from today (2026-11-21). It was amended after a precedent review: --trust-lockfile only fills missing evidence, never overrides evidence that a file differs, previews in the refusal, and lands with a req-lk-024 spec amendment.

  6. 33 remaining items

  7. added a commit that references this issue on Nov 23, 2026
  8. moved this from In Progress to Done in APM Roadmapon Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/accepted

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions