Skip to content

[0.38] fix(uninstall): --trust-lockfile consent path for offline or deleted sources (#4295) - #4650

Merged
Daniel Meppiel (danielmeppiel) merged 46 commits into
mainfrom
danielmeppiel-4295-uninstall-consent
Nov 23, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 46 commits into
mainfrom
danielmeppiel-4295-uninstall-consent

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

apm uninstall refuses to delete a tracked file it has no deployment evidence for (req-lk-024, #3701). When a package's source is gone (offline, private or deleted) and its receipts are missing, that refusal had no way out. This PR adds --trust-lockfile, an explicit per-invocation consent that fills only missing evidence:

  • Deletable under the flag: a file is deleted 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 bytes hash to the single hash apm.lock.yaml records for it.
  • Always kept and named: a file with a differing receipt or render, a render that lacks the path, no or conflicting recorded hashes, or that is unreadable or a symlink. The flag never overrides present evidence.
  • Each deleted path is printed. Kept files do not fail the command.
  • Without the flag, exit codes and filesystem effects match 0.37. The refusal now marks each file "--trust-lockfile would delete it" or "kept even with --trust-lockfile", and offers the flag only when at least one file is deletable.

Where the decision lives: DeploymentEvidence (src/apm_cli/integration/cleanup.py) owns it in one place, lockfile_consentable. It drives the refusal preview and is rechecked at each deletion. Install and prune are unchanged.

Spec: proposed amendment 0.1.76 revises req-lk-024 in place with this one consent exception. 0.1.75 is claimed by #4001 (req-pl-022) and 0.1.74 by #4559, so this takes the next free number. The requirements manifest, a req-lk-024 conformance test and CONFORMANCE are updated. No statement is added.

Spec review: apm-spec-guardian ran the four-panel review in round 1 (#4650 (comment)): average 7.5, no blockers, fold_and_ship. Folds F1-F11 are applied:

  • req-lk-024 scopes its base prohibitions to the exception, states the multi-owner hash rule, the absent-versus-unreadable record store, the attempted render, the recheck and the lockfile-hash basis of each named deletion, and uses MUST NOT for every excluded case.
  • Section 10.7 names the residual trusted-lockfile risk and the online/offline edge.
  • The 0.1.76 row carries a Section 9.2 classification and the 151 count, and a note reserves 0.1.74 and 0.1.75.
  • Consent reads a bare-hex recorded hash as sha256 (req-lk-016).
  • New req-lk-024 oracles cover every excluded case; req-lk-024 coverage is now 15 / 17.

Deferred: F12 (an ancestor-symlink and deploy-root guard, which needs code first), F13 (a SHOULD preview and conformance-statement disclosure) and F14 (CLI lifecycle oracles for the surviving-dependency, preview and online/offline cases).

Provenance: this supersedes the P2 draft #4603. Its commits were cherry-picked from wip/4295-trust-lockfile (faf9fec), then reviewed against the amended record. The spec number was moved to 0.1.76, and the CHANGELOG line became a changelog.d fragment.

Issue and approved scope

Issue: Fixes #4295

Human scope-approval comment: #4295 (comment) (amended record; see #4295 (comment)).

Does this PR complete the issue, or what remains? It completes the record: the flag, the single consent decision, the preview in the refusal, the req-lk-024 amendment, docs and the lifecycle test.

Supersedes #4603.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass: CI pending.
  • Added tests for new functionality (if applicable)

Local results, run through the host guard:

  • APM_E2E_TESTS=1 pytest tests/integration/test_uninstall_trust_lockfile_lifecycle.py against the installed CLI: 5 passed. It runs the project and -g scopes, previews then deletes, keeps the edited file, and covers the three negative controls. It fails on main, which has no --trust-lockfile flag.
  • pytest tests/integration/test_uninstall_refusal_lockfile_truth_lifecycle.py: passed, unchanged.
  • pytest tests/unit/integration/test_cleanup_helper.py tests/spec_conformance/test_deletion_evidence_reqs.py tests/unit/core/test_remediation_w2_integration_catalog.py: 42 passed.
  • After the spec-review fold: pytest tests/spec_conformance/test_deletion_evidence_reqs.py tests/unit/integration/test_cleanup_helper.py: 49 passed. The spec linter checklist is clean apart from advisory checks 10 and 11.
  • pytest -n 2 tests/integration/test_architecture_owner_rule_mutations.py tests/quality/test_quality_baselines.py: 1262 passed.
  • The lint contract is clean: ruff check and ruff format --check (0.15.12), pylint R0801, auth signals, the complexity ratchet and tests.quality.taxonomy --changed.
  • CONFORMANCE regenerated: the collect-only run, then gen_statement.

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (req-lk-024 revised in place, Section 10.7 and Appendix C; proposed 0.1.76).
  • Manifest edit: docs/public/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: tests/spec_conformance/test_deletion_evidence_reqs.py extends
    @pytest.mark.req("req-lk-024").
  • 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.

…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]>
…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]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Supersedes: #4603
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Supersedes: #4603
Co-authored-by: Copilot App <[email protected]>
…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]>
…lk-024 (#4295)

Fold F1-F11 of the four-panel review:
- req-lk-024 scopes its base prohibitions to the consent exception,
  states the multi-owner hash rule (one distinct hash across owners,
  compared per req-lk-016), the absent-versus-unreadable record store,
  the attempted render, the recheck, the lockfile-hash basis of each
  named deletion, and MUST NOT keywords for every excluded case.
- Section 10.7 names the residual trusted-lockfile risk and the
  online/offline edge; Appendix C, the 0.1.76 row (Section 9.2
  classification, count 151) and a 0.1.74/0.1.75 reservation note.
- Consent reads a bare-hex recorded hash as sha256 (req-lk-016).
- req-lk-024 oracles for every excluded case; CONFORMANCE regenerated.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) force-pushed the danielmeppiel-4295-uninstall-consent branch from b4d4654 to cf56955 Compare November 21, 2026 17:18
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Spec Guardian: fold_and_ship

Scope: editorial-patch (forced over the mechanical editorial-only rule: the PR amends the normative req-lk-024 MUST); diff = +21/-3 lines across 1 file(s) at review head b4d4654. Shocked-meter avg: 7.5/10.

No panel raised a blocking finding, and the panels average 7.5 on the shocked meter, so the rules allow fold_and_ship. All four panels independently returned ship_with_followups on the same shape of finding: the exception is sound, but the req-lk-024 body needs to say exactly what the reference implementation already does. That means forward-scoping the base MUST NOT, using RFC 2119 keywords in the tail, stating the multi-owner hash rule and the surviving-dependency exclusion, and covering each fail-closed guard with a conformance oracle. Folds F1-F11 stay inside the req-lk-024 anchor, Section 10.7, Appendix C, the 0.1.76 row, the requirements manifest and the conformance test module. Each matches existing code paths (receipts_readable, lazy render attempt, len(recorded) == 1, exact sha256-envelope equality, is_symlink/is_file and OSError guards, recheck in verdict(), the 'matched its apm.lock.yaml hash' diagnostic, and the flag as the only consent source). None adds a statement, so the count stays at 151 (146 MUST, 5 SHOULD).

Keep the version at 0.1.76: 0.1.74 and 0.1.75 are claimed by open PRs #4559 and #4001, so F7 records a one-line reservation instead of renumbering. The follow-up that matters most is F12, the ancestor-symlink and outside-deploy-root guard. It needs a code change before the spec can require it, and until then Section 10.7 deliberately does not claim confinement to a deploy root. Track lockfile-provenance verification (F15) in the reserved Section 10.12 slot as the long-term answer to the residual risk that F5 discloses. The scope record stands: the default refusal, prune/install cleanup, an interactive prompt and any config or environment equivalent remain out of scope, and F4 now states the last of these normatively.

Fold status: F1-F11 are applied in cf56955. F3 departs from its instruction: rather than writing 'a recorded value in any other form does not match' (which would contradict req-lk-016 reader tolerance), consent now reads a bare-hex recorded hash as sha256 per req-lk-016, and a value naming another algorithm still does not match. That takes a 3-line normalization in DeploymentEvidence.lockfile_consentable plus a bare-hex oracle; oci-rec-r1-3 is therefore folded rather than partially rejected. After the fold, req-lk-024 coverage in CONFORMANCE is 15 / 17.

Convergence

Panel Stance Shocked New B New R New N
Swagger / OpenAPI Editor ship_with_followups 7/10 0 5 6
OCI Distribution Editor ship_with_followups 8/10 0 6 3
Package-Manager Registry-Contract Editor ship_with_followups 8/10 0 6 3
W3C TAG Architect ship_with_followups 7/10 0 5 3

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

Convergent themes (flagged by 2+ panels)

  • T1 -- Forward-scope the base req-lk-024 'MUST NOT authorize' and 'MUST keep' clauses to the consent exception, so the body has no internal contradiction (supporting: sw-rec-r1-1, oci-nit-r1-forward-scope, tag-rec-r1-1)
  • T2 -- Use RFC 2119 keywords in the exception tail (MUST re-evaluate, MUST NOT apply, MUST NOT infer consent) and list the consent sources that are excluded (option, environment variable, configuration, manifest or lockfile content) (supporting: sw-rec-r1-2, pkg-rec-r1-5, oci-nit-r1-env-var)
  • T3 -- Multi-owner precision: exactly one distinct recorded hash across every owner, two or more distinct values count as conflicting, and paths a surviving dependency still lists are excluded (supporting: sw-rec-r1-3, oci-rec-r1-4, pkg-rec-r1-1, tag-rec-r1-4)
  • T4 -- Fail-closed guard precision: an absent record store reads as empty while an unreadable store does not qualify, the render must have been attempted and failed, hash envelope form, and non-regular files (supporting: pkg-rec-r1-2, pkg-rec-r1-3, oci-rec-r1-3, oci-rec-r1-5, pkg-nit-r1-algorithm)
  • T5 -- Residual-risk and classification disclosure: the Section 10.7 provenance-delegation risk, the online/offline determinism edge, the Section 9.2 classification and count sentence in the row, and the 0.1.74/0.1.75 gap note (supporting: sw-rec-r1-4, oci-rec-r1-1, pkg-rec-r1-4, tag-rec-r1-2, sw-nit-r1-count, sw-nit-r1-gap, pkg-nit-r1-gap, tag-nit-r1-reservation)
  • T6 -- Conformance oracles for each fail-closed guard and the recheck at removal time, plus test hygiene (needle with a hard line break, stale module summary line) (supporting: sw-rec-r1-5, oci-rec-r1-6, pkg-rec-r1-6, tag-rec-r1-5, sw-nit-r1-needle, pkg-nit-r1-needle, tag-nit-r1-needle, oci-nit-r1-summary)

Fold now (11 item(s))

  1. [F1 / T1] req-lk-024 (Section 5.2), base body -- In the req-lk-024 base body, replace 'A
    lockfile content hash alone MUST NOT authorize the deletion:' with 'Except under the consent exception below, a lockfile content hash alone MUST NOT authorize the deletion:'. Then replace 'the consumer MUST keep the file and emit a
    diagnostic naming its path and the manual resolution.' with 'the consumer MUST keep the file and emit a diagnostic naming its path and the manual resolution, except as the consent exception below permits.' Leave every other base sentence unchanged.
    Success criterion: grep -c 'Except under the consent exception below, a lockfile content hash alone MUST NOT authorize' openapm-v0.1.md == 1 and grep -c 'except as the consent exception below permits' == 1 (after whitespace normalization); count of '<a id="req-' anchors unchanged.
  2. [F2 / T4] req-lk-024 (Section 5.2), consent exception precondition -- Rewrite the exception's precondition sentence to: 'One consent exception applies, only to an uninstall the user explicitly consents to on that invocation. It covers a file that lacks evidence because the consumer read its local deployment records without error and holds none for the file (an absent record store holds none; a store that exists but cannot be read or parsed does not qualify), and because the consumer attempted, and failed, to produce any render of the locked dependencies that own the path.' This matches the reference implementation: receipts_readable gate, an absent store read as empty, a lazy render attempted for the whole lock and then each owner.
    Success criterion: grep finds 'an absent record store holds none' and 'attempted, and failed, to produce any render' exactly once each, inside the req-lk-024 anchor block; the sentence 'One consent exception applies, only to an uninstall the user explicitly' is still present, so the existing conformance needle still matches.
  3. [F3 / T3] req-lk-024 (Section 5.2), consent exception hash comparison -- Replace the MAY clause with: 'For such a file the consumer MAY delete it when its content hash, computed as the sha256: envelope of req-lk-012, equals the one distinct content hash the lockfile records for that path across all its owning dependencies; a recorded value in any other form does not match.' Do NOT require every co-owning entry to carry a hash, and do NOT say bare hex is read as sha256: the implementation counts distinct non-empty recorded values (len == 1) and compares the 'sha256:' string by exact equality, so bare-hex or other-algorithm records keep the file. That is fail-closed and conforms to this wording.
    Success criterion: grep finds 'the one distinct content hash the lockfile records for that path across all its owning dependencies' and 'a recorded value in any other form does not match' once each in req-lk-024; the phrase 'under its owning dependency' no longer appears in req-lk-024.
  4. [F4 / T2] req-lk-024 (Section 5.2), consent exception tail -- Replace from 'rechecked immediately before removal, and MUST name each file so deleted.' through 'another option or by configuration.' with: 'The consumer MUST re-evaluate every condition of this exception immediately before removing the file, and MUST name each file so deleted and state that its lockfile hash was the basis. The consumer MUST NOT apply the exception to a path that a dependency remaining after the uninstall also lists, when a deployment record or a render shows different bytes, when a render lacks the path, when the lockfile records no hash or two or more distinct hashes for the path, or when the file is unreadable or is not a regular file (a symbolic link included), and MUST NOT infer consent from another option, an environment variable, configuration, or manifest or lockfile content.' The implementation already satisfies each clause: surviving-dependency paths are removed from candidates before evidence is checked, verdict() rechecks lockfile_consentable at each deletion, the is_symlink/is_file and OSError guards apply, the diagnostic reads 'Deleted (matched its apm.lock.yaml hash; --trust-lockfile)', and only the --trust-lockfile flag sets consent.
    Success criterion: Within req-lk-024: grep finds 'MUST re-evaluate every condition of this exception', 'MUST NOT apply the exception to a path that a dependency remaining after the uninstall also lists', and 'MUST NOT infer consent from another option, an environment variable, configuration, or manifest or lockfile content' once each; the token 'never applies' and the phrase 'consent is never implied' no longer appear in req-lk-024; anchor count and the 151 (146 MUST, 5 SHOULD) totals are unchanged.
  5. [F5 / T5] Section 10.7 Unverified content cleanup (file integrators) -- After the sentence ending 'limited to files no deployment record or render can speak for.', append: 'Under that consent the deletion rests on the provenance of the lockfile: a tampered lockfile can direct the deletion of any file whose current bytes it records, confined to paths the uninstall removes and named in its output, so a user consents only for a lockfile of trusted provenance. Because a render that can be produced takes precedence over the exception, the same uninstall can keep a file online and delete it offline.' Do not claim confinement to a deploy root (absolute claims are not yet guarded; see defer F12).
    Success criterion: grep finds 'the deletion rests on the provenance of the lockfile' and 'keep a file online and delete it offline' once each, inside Section 10.7 (between '### 10.7' and '### 10.8'); no statement anchor is added to Section 10.7.
  6. [F6 / T5] Appendix D change-log row 0.1.76 (proposed) -- Make these edits to the 0.1.76 row: (a) resync the summary to the F2-F4 body wording (absent versus unreadable record store, render attempted and failed, one distinct hash across owners, envelope form, surviving-dependency exclusion, not a regular file, the consent sources excluded, the diagnostic stating the lockfile-hash basis); (b) change 'Sections 10.7 and Appendix C' to 'Section 10.7 and Appendix C'; (c) insert 'Under Section 9.2 this relaxes a fail-closed obligation only under explicit per-invocation consent, so it is an amendment, not errata; a consumer that does not offer the exception still conforms, and the only verdict that changes is for a consented deletion on a lockfile hash alone, which now conforms.'; (d) replace 'Adds no statement.' with 'No statement added; the count remains 151 (146 MUST, 5 SHOULD).' Keep the version 0.1.76: 0.1.74 (PR feat(native): project-scope native plugins for Claude and Copilot (#3921, #3896) #4559) and 0.1.75 (PR [0.38] feat(policy): add --policy to apm install and apm update (#1925) #4001, req-pl-022) are claimed by concurrent open proposals.
    Success criterion: The 0.1.76 row contains 'Section 10.7 and Appendix C', 'Under Section 9.2 this relaxes a fail-closed obligation', and 'No statement added; the count remains 151 (146 MUST, 5 SHOULD).'; 'Sections 10.7' and 'Adds no statement.' do not appear in the row; the row label is still '0.1.76 (proposed)'.
  7. [F7 / T5] Appendix D note below the change-log table -- Directly after the line 'In the Date column, a row marked (proposed) ...', add one line: 'Versions 0.1.74 and 0.1.75 are reserved for concurrently proposed amendments (open pull requests feat(native): project-scope native plugins for Claude and Copilot (#3921, #3896) #4559 and [0.38] feat(policy): add --policy to apm install and apm update (#1925) #4001) and have no row in this working draft.' Do not renumber 0.1.76.
    Success criterion: grep -c 'Versions 0.1.74 and 0.1.75 are reserved for concurrently proposed amendments' == 1; grep -c '| 0.1.74' == 0 and grep -c '| 0.1.75' == 0 in this branch.
  8. [F8 / standalone] Appendix C preamble (Conditional requirements paragraph) -- Revert the req-lk-023 sentence to its original end ('...not every consumer implementation.') and add a separate sentence: 'The consent exception of req-lk-024 applies only to an uninstall the user explicitly consents to on that invocation.' Drop the words 'proposed 0.1.76' from the preamble.
    Success criterion: grep finds 'staged-replacement capability, not every consumer implementation.' ending with a period, and 'The consent exception of [req-lk-024](#req-lk-024) applies only to an uninstall' once; 'proposed 0.1.76 consent exception' does not appear in Appendix C.
  9. [F9 / T6] tests/spec_conformance/test_deletion_evidence_reqs.py (req-lk-024 oracles) -- Add a @pytest.mark.req('req-lk-024') parametrized oracle that drives the cleanup owner under consent_to_lockfile_hashes() and asserts the file is kept, result.deleted == [] and consented_deletions() == [] for: no recorded hash (recorded_hashes={}); two distinct recorded hashes; a bare-hex recorded value equal to the digest; receipts_readable=False; a differing receipt (receipts keyed by the resolved posix path with another hash); the path as a symbolic link to a matching file; the path as a directory (not a regular file); and bytes edited after consent_preview() returned the claim but before cleanup (proves the recheck). Skip on Windows where symlink creation is unavailable. No product code change is needed: each case exercises an existing guard in lockfile_consentable/verdict.
    Success criterion: pytest tests/spec_conformance/test_deletion_evidence_reqs.py -q passes, the new parametrized test yields at least 8 cases, and the regenerated CONFORMANCE.md req-lk-024 coverage cell grows above 7 / 9 with the row otherwise unchanged.
  10. [F10 / T6] tests/spec_conformance/test_deletion_evidence_reqs.py (needle and module docstring) -- Replace the needle 'consent is never implied by\nanother option or by configuration.' with a single-line needle taken from the F4 text (for example 'MUST NOT infer consent from another option, an environment variable, configuration'), or normalize whitespace in assert_spec_contains before matching. Change the module summary line from 'Deletion requires deployment evidence, never a lockfile hash alone (req-lk-024).' to 'Deletion requires deployment evidence; a lockfile hash alone authorizes it only under explicit uninstall consent (req-lk-024).'
    Success criterion: grep -c 'never a lockfile hash alone' tests/spec_conformance/test_deletion_evidence_reqs.py == 0; no assert_spec_contains argument in the file contains a newline; test_spec_states_the_per_invocation_consent_exception passes after F1-F4 land.
  11. [F11 / T5] docs/public/specs/manifests/openapm-v0.1.requirements.yml (req-lk-024 notes) -- Resync the req-lk-024 notes suffix to: 'Proposed amendment 0.1.76 (issue Uninstall: consent path for offline or deleted sources #4295): one per-invocation consented-uninstall exception for files whose readable record store holds no record and for which no render could be produced, whose bytes equal the one distinct sha256 envelope the lockfile records for the path across owners; rechecked before removal; surviving-dependency paths excluded'. Leave keyword and section unchanged.
    Success criterion: The req-lk-024 entry keeps keyword: MUST and section: "5.2"; its notes contain 'one distinct sha256 envelope' and 'surviving-dependency paths excluded'; the manifest schema/lint check passes.

Defer to v0.1.1

  • [F12 / T4] req-lk-024 (Section 5.2) consent exception; src/apm_cli/integration/cleanup.py -- Add a fail-closed guard to the exception: the consumer MUST NOT apply it when any ancestor of the path below its deploy root is a symbolic link, or when the path resolves outside a registered deploy root (req-tg-002). This needs a code change first: DeploymentEvidence._physical accepts absolute claims and lockfile_consentable checks only the final component. Land the guard and an oracle, then fold the clause.
  • [F13 / T5] req-lk-024 (Section 5.2) consent exception; CONFORMANCE.md -- Add an informative or SHOULD-level statement that a consumer offering the exception previews, before consent, which refused files consent would delete or keep (the implementation already prints 'would delete it' / 'kept even with --trust-lockfile'). Also require the conformance statement to disclose whether the exception is offered and its consent mechanism, and add the matching CONFORMANCE.md note. Deferred because a SHOULD inside a MUST anchor needs a linter keyword-classification decision, and the disclosure is a new obligation that warrants its own row.
  • [F14 / T6] tests/integration (uninstall --trust-lockfile lifecycle) -- Add CLI-level lifecycle oracles: a path co-listed by a surviving dependency is never deleted under --trust-lockfile; the refusal without the flag prints the per-file preview; an online run (render producible) keeps a file that an offline run deletes under consent.

Defer to v0.2

  • [F15 / T5] Section 10.12 / req-lk-024 consent exception -- Replace bare user consent to an unauthenticated lockfile with lockfile provenance that a consumer can verify (a signed or attested lockfile), so that a consented hash-only deletion can require verified lockfile provenance instead of relying on the user's judgement about where the lockfile came from.
    Reserved slot: sec.10.12 publisher provenance and attestations (reserved for v0.2)

Rejected findings

  • oci-rec-r1-3 -- Partially rejected. The proposal to read bare hex as sha256 per req-lk-016 and to compute with the algorithm the recorded envelope names would make the spec require behaviour the reference implementation does not have: it compares the 'sha256:' string exactly, so bare-hex and other-algorithm records keep the file. For a MAY exception, fail-closed is the safer contract. F3 folds the conforming form ('a recorded value in any other form does not match'), and literal string distinctness (F4, 'two or more distinct hashes') covers the conflicting-after-normalization case.
  • pkg-rec-r1-1 -- Partially rejected. The clause 'every lock entry listing the path records a hash' does not match the implementation, which ignores hashless co-listing records and requires exactly one distinct non-empty value. A hashless co-listing offers no contrary evidence, and the bytes must still equal the one recorded hash, so the narrowing would need a code change with no safety gain. The surviving-dependency half of the finding is folded in F4, and the single-distinct-hash half in F3.
  • pkg-nit-r1-algorithm -- Folded in substance by F3 ('a recorded value in any other form does not match'), which has the same effect as 'unsupported counts as no hash' (the file is kept). The separate wording is not adopted, to avoid two overlapping fail-closed clauses.

Linter notes (2 check(s) failed)

  • [10] changelog.d/4650.added.md does not name the spec file (openapm-). This is advisory: the repo now uses changelog.d fragments, and the fragment describes the user-visible flag.
  • [11] .py files are modified: this PR carries the reference implementation together with the spec amendment. The code review runs through normal CI and Copilot review.

Checks 1, 2, 5, 7 and 9 pass after the fold; check 8 is skipped (no mermaid); checks 3 and 4 do not apply (no schema or fixture change). Check 6 matches main: 151 statements with 153 req anchors, the same as on main; the PR adds no statement.

Note: the synthesizer recommends ship, but the linter found issues worth folding first. Address these in the same PR if cheap.

Linter handoff: After F1-F11 land: (1) Re-count '<a id="req-' anchors and confirm 151 statements (146 MUST, 5 SHOULD) in Section 1.3, Appendix C and the Appendix D totals paragraph. The new MAY / MUST NOT tokens inside req-lk-024 must not be counted as new statements or change its keyword column (MUST). (2) Confirm 'never applies' and 'consent is never implied' are gone from req-lk-024 and that the tail uses MUST NOT. (3) Confirm the 0.1.76 row still carries '(proposed)', reads 'Section 10.7', ends with 'No statement added; the count remains 151 (146 MUST, 5 SHOULD).', and that no 0.1.74 or 0.1.75 row exists; the F7 reservation line appears once. (4) Run pytest tests/spec_conformance/test_deletion_evidence_reqs.py, check that no needle contains a newline, regenerate CONFORMANCE.md and CONFORMANCE.json, and check that only the req-lk-024 coverage cell changed. (5) Validate the requirements manifest after F11. (6) Grep the full diff for the forbidden tokens CNCF, Linux Foundation, Sandbox, Incubation, W3C Process and IETF RFC stream, and confirm every byte is ASCII (U+0020-U+007E plus newline). (7) Confirm Section 10.7 makes no deploy-root confinement claim, since that waits on F12.


Full per-panel findings

Swagger / OpenAPI Editor -- shocked_meter 7/10, confidence high

Summary: The 0.1.76 consent exception is tightly bounded, keeps the count consistent at 151 and introduces no anchor or class drift. Base-text prohibitions need forward scoping so the unconditional MUST NOT does not read as contradicting the later MAY; the 'never applies' and 'rechecked' clauses need RFC 2119 keywords; and multi-owner wording plus req-lk-024-tagged coverage of the fail-closed cases should follow.

New recommended findings (5)

  • [sw-rec-r1-1] req-lk-024 (Section 5.2) -- The revised req-lk-024 still contains two unconditional statements in its base text: 'A lockfile content hash alone MUST NOT authorize the deletion' and 'Without such evidence ... the consumer MUST keep the file'. The consent exception appended afterwards does exactly what those statements prohibit: it deletes on the strength of a lockfile hash plus consent. The derogation is only introduced after the fact ('One consent exception applies'). Someone testing the MUST NOT in isolation, or quoting it (as the existing conformance oracle test_spec_states_hash_alone_never_authorizes_deletion does), reads a conformant consenting consumer as non-conformant. This is a lex-specialis ordering defect, not a true contradiction, because the exception names itself. That is why it is recommended rather than blocking.
    Recommended fix: Scope the two base prohibitions forward. Change 'A lockfile content hash alone MUST NOT authorize the deletion:' to 'Except under the consent exception below, a lockfile content hash alone MUST NOT authorize the deletion:'. Change 'Without such evidence, or when the file differs from it, the consumer MUST keep the file' to 'Without such evidence, or when the file differs from it, the consumer MUST keep the file, except as the consent exception below permits,'. Update the substring asserted in test_spec_states_hash_alone_never_authorizes_deletion if the line wrap moves.
  • [sw-rec-r1-2] req-lk-024 consent exception -- Three normative claims in the exception do not use an RFC 2119 keyword. (1) 'The exception never applies when a deployment record or a render shows different bytes, ...' is a prohibition written in lowercase prose. (2) 'consent is never implied by another option or by configuration' is also a prohibition with no keyword. (3) 'rechecked immediately before removal' is a dangling participle. It leaves open whether only the hash equality is rechecked or every precondition (no record, no render, not a symlink, readable). The reference implementation rechecks all of them in lockfile_consentable at each verdict. As written, the recheck has no testable obligation.
    Recommended fix: Rewrite the tail of the exception. After '... equals the single content hash the lockfile records for that path under its owning dependency,' put: 'the consumer MAY delete the file, MUST re-evaluate every condition of this exception immediately before removing it, and MUST name each file so deleted. The consumer MUST NOT apply the exception when a deployment record or a render shows different bytes, when a render lacks the path, when the lockfile records no hash or conflicting hashes for the path, or when the file is unreadable or a symbolic link, and MUST NOT infer consent from another option or from configuration.' No statement is added: the text stays inside the req-lk-024 anchor.
  • [sw-rec-r1-3] req-lk-024 consent exception -- The exception assumes a single owner: 'no render of its owning locked dependency could be produced' and 'the single content hash the lockfile records for that path under its owning dependency'. Lockfile ledger records can carry several owners for one path. With multiple owners, the text does not say whether any producible owner render blocks the exception, or only all of them, and it does not say whether 'single hash' means one per owner or one across all owners. The reference implementation takes the strict reading. Any owner render blocks consent (_rendered_roots). Hashes are unioned across owner ledger records and every dependency's deployed_file_hashes, and consent requires exactly one distinct value (_recorded_owner_hashes). A looser reading by another implementation would be conformant under the current text but would delete in more cases.
    Recommended fix: Replace 'and no render of its owning locked dependency could be produced' with 'and no render of any locked dependency that owns the path could be produced'. Replace 'equals the single content hash the lockfile records for that path under its owning dependency' with 'equals the one distinct content hash that every lockfile record for that path carries'. In the conflicting-hash clause, say that two or more distinct recorded values for the path, under any owner, count as conflicting.
  • [sw-rec-r1-4] Section 10.7 -- Amendment 0.1.69 added req-lk-024 to close one threat: a forged or crafted lockfile row whose hash matches a user file. That threat comes back exactly when a user consents on a project whose lockfile came from an untrusted source and whose dependency render cannot be produced, for example offline or with a deleted source. The new 10.7 sentence says the exception is 'limited to files no deployment record or render can speak for'. It does not state the residual risk that consent hands authority to the lockfile's provenance. Without it, the threat-model section understates the trade-off the MAY introduces.
    Recommended fix: Append to the 10.7 mitigation paragraph: 'Consent under that exception delegates authority to the lockfile itself: a crafted lockfile row whose hash matches a user file can direct its deletion when no render is producible, so consent is appropriate only for a lockfile whose provenance the user trusts.' This is informative prose only; do not add a keyword.
  • [sw-rec-r1-5] tests/spec_conformance/test_deletion_evidence_reqs.py; CONFORMANCE.md req-lk-024 row -- The req-lk-024-tagged conformance oracles cover three things: consent on/off with a single matching hash, a render that lacks the path, and the spec text. The exception's fail-closed clauses (no recorded hash, conflicting hashes, unreadable deployment records, a differing receipt under consent, bytes edited between decision and removal, a symlinked file) are exercised only in tests/unit and tests/integration, which carry no req-lk-024 tag. I found no consent-specific symlink oracle anywhere. The CONFORMANCE.md 7 / 9 figure therefore overstates how much of the new clause set the conformance suite checks.
    Recommended fix: Add a parametrized req-lk-024 oracle in test_deletion_evidence_reqs.py over recorded in {none, conflict} plus receipts_readable=False, a symlinked target and a post-decision edit. Each case should assert under consent that the file is kept and named and that consented_deletions() == []. Regenerate the CONFORMANCE.md row.

New nit findings (6)

  • [sw-nit-r1-1] Other no-statement amendment rows (0.1.71, 0.1.72) restate the total, for example 'No statement added; the count remains 149 (144 MUST, 5 SHOULD).' The 0.1.76 row says only 'Adds no statement.' The Section 1.3 total (151), the Appendix C total (151) and the trailer total (151) agree, so this is consistency polish only. -- fix: Replace 'Adds no statement.' with 'No statement added; the count remains 151 (146 MUST, 5 SHOULD).'
  • [sw-nit-r1-2] Rows 0.1.69, 0.1.71 and 0.1.72 each classify the change under Section 9.2 (breaking or not, amendment or errata). The 0.1.76 row has no such classification. Adding a MAY exception to a MUST is non-breaking for existing consumers but widens permitted deletion, and the row should say so. -- fix: Before 'Without consent, behavior is unchanged.', insert: 'Under Section 9.2 this is an amendment, not errata: it adds a permission to a normative statement; every consumer that conformed before still conforms.'
  • [sw-nit-r1-3] 'Sections 10.7 and Appendix C' uses a plural label for a single section. -- fix: Change to 'Section 10.7 and Appendix C'.
  • [sw-nit-r1-4] The added clause sits under 'Conditional requirements retain the applicability limits in their bodies', but req-lk-024 is not a conditional requirement. The 0.1.76 text is a permissive exception inside an unconditional MUST, so the sentence puts it in the wrong category. -- fix: Split it out as its own sentence: 'Likewise, the proposed 0.1.76 consent exception of req-lk-024 is a permission that applies only to an explicitly consented uninstall; the requirement itself remains unconditional.'
  • [sw-nit-r1-5] The table jumps from 0.1.73 (proposed) to 0.1.76 (proposed), so 0.1.74 and 0.1.75 have no rows on this branch. If parallel open proposals reserve those numbers this is fine, but the gap is unexplained in the artifact. -- fix: Confirm that 0.1.74 and 0.1.75 are reserved by in-flight PRs. Otherwise renumber this proposal to 0.1.74 everywhere: the row, the Appendix C clause, the manifest notes and the test docstrings.
  • [sw-nit-r1-6] test_spec_states_the_per_invocation_consent_exception asserts a substring with a hard-coded line break ('consent is never implied by\nanother option or by configuration.'). Any editorial reflow of req-lk-024, including the fixes proposed above, breaks the oracle without any semantic change. -- fix: Assert on whitespace-normalized spec text, or pick a substring that sits within a single line.

Preserved strengths confirmed

  • The req-lk-024 anchor, keyword (MUST), section (5.2) and consumer class are unchanged in the Section 5.2 body, the 5.7 consumer enumeration, the 11.3.2 list, the Appendix C table, the requirements manifest and CONFORMANCE.md. No renumbering.
  • The normative-statement count agrees at 151 (146 MUST, 5 SHOULD) across the Section 1.3 summary, the Appendix C total and the Appendix D trailer. The trailer prose correctly lists 0.1.76 among the in-place revisions that add no statement.
  • The exception hashes over the req-lk-012 canonical domain, so consent comparisons use the same domain as recorded lockfile hashes and as render byte equality.
  • The fail-closed enumeration (differing record or render, render lacking the path, no or conflicting hashes, unreadable, symlink) matches the reference implementation's single decision point, DeploymentEvidence.lockfile_consentable.
  • All new cross-references (#req-lk-012, #req-lk-024) resolve. No schema bytes changed, and lockfile_version is unchanged.

OCI Distribution Editor -- shocked_meter 8/10, confidence high

Summary: A tightly bounded, fail-closed consent exception that reuses the req-lk-012 domain and rechecks the hash before deletion. It ships safely as MAY. Follow-ups: 10.7 should state the residual forged-lockfile-row risk the exception reopens under consent, and the spec should pin envelope comparison, the multi-owner definition, non-regular and ancestor-symlink guards, and a pre-consent preview.

New recommended findings (6)

  • [oci-rec-r1-1] sec.10.7 / req-lk-024 -- The consent exception reopens, under consent, exactly the attack that amendment 0.1.69 closed. The 0.1.69 oracle is that a forged lockfile row whose hash matches a user file keeps the file. A row that names an unreachable repo_url never renders, so the user's file then has neither a record nor a render. Under consent, the hash match alone deletes it. The new 10.7 text calls the exception 'limited to files no deployment record or render can speak for'. That reads as a narrowing, but those are exactly the forged-row cases. 10.7 never states the remaining risk: a tampered lockfile plus a consented uninstall can delete a project or user file whose bytes the attacker knows, for example any committed file. The threat-to-requirement mapping for lockfile tampering is therefore incomplete.
    Recommended fix: In 10.7, after '...files no deployment record or render can speak for.', add: 'Under that consent the lockfile hash is the only evidence, so a tampered lockfile row can name any file whose bytes it records; the exception is therefore confined to the dependencies the uninstall removes, names each file it deletes, and is intended for lockfiles whose provenance the user trusts.'
  • [oci-rec-r1-2] req-lk-024 -- The exception names deletions only after they happen ('MUST name each file so deleted'). The user consents to 'trust the lockfile' without being promised the list of files that trust will delete. The reference implementation already refuses without the flag and lists each file as '--trust-lockfile would delete it' or 'kept even with --trust-lockfile' (cli.py consent_preview). A conformant implementation could skip that preview and delete silently-then-name. That makes the consent less informed, which is a defense-in-depth gap on a load-bearing deletion boundary.
    Recommended fix: In req-lk-024, change 'and MUST name each file so deleted' to 'and MUST name each file so deleted; before consent is given, an attempt that refuses for lack of evidence SHOULD name which refused files the consent would delete and which it would keep'. This adds no statement: it sits inside the existing MAY branch.
  • [oci-rec-r1-3] req-lk-024 / req-lk-016 -- 'its content hash ... equals the single content hash the lockfile records' does not pin how the two envelopes are compared. req-lk-016 lets a reader accept bare 64-hex as sha256 and lets the algo token be sha256, sha384 or sha512. The reference implementation compares the computed 'sha256:' string to the recorded value, so a bare-hex or sha512 record never matches and the file is kept (fail closed). An implementation that applies the req-lk-016 bare-hex normalization would delete. Both behaviors are permitted today. The equality test for a deletion authority should be specified, not left to the implementation. The same gap leaves open whether the same bytes recorded once as sha256 and once as sha512 count as 'conflicting'.
    Recommended fix: After 'over the canonical domain of req-lk-012,' insert 'computed with the algorithm the recorded envelope names (a bare hexadecimal value read as sha256 per req-lk-016; an algorithm the consumer cannot compute keeps the file),'. Also state that two recorded values for the path that differ after this normalization are conflicting hashes.
  • [oci-rec-r1-4] req-lk-024 -- The text says 'the single content hash the lockfile records for that path under its owning dependency' (singular owner). It does not define the multi-owner case, where more than one lock entry lists the path in deployed_files or deployed_file_hashes. The reference implementation (_recorded_owner_hashes) unions hashes across every lock entry and the ledger. It refuses when that set has more than one member, and its preflight excludes paths a surviving dependency still claims. An implementation reading 'its owning dependency' literally could check only the uninstalled entry's hash. It would then miss a conflict with a surviving owner's record, which is the conflict-detection signal the exception relies on.
    Recommended fix: Replace 'equals the single content hash the lockfile records for that path under its owning dependency' with 'equals the single content hash the lockfile records for that path across every entry that lists it, where the path is not also deployed by a dependency the uninstall keeps'.
  • [oci-rec-r1-5] req-lk-024 -- The fail-closed list covers 'unreadable or a symbolic link' only for the final path component. Two cases are left open. (a) A non-regular file such as a FIFO or device: it is 'readable', but hashing it can block or read unbounded data. The reference implementation guards this with is_file(), but the spec does not require it. (b) A symbolic link in an intermediate directory between the deploy root and the file: deletion then resolves outside the deploy root. The base rule has the same gap, but there a render or receipt binds the bytes. Under consent the only binding is a lockfile-supplied hash, so the containment check carries more weight in this branch.
    Recommended fix: Replace 'or when the file is unreadable or a symbolic link' with 'or when the file is unreadable, is not a regular file, is a symbolic link, or is reached through a symbolic link or resolves outside its deploy root'.
  • [oci-rec-r1-6] tests/spec_conformance/test_deletion_evidence_reqs.py -- The conformance oracles for the exception cover consent on/off and 'render lacks the path'. They do not cover the other fail-closed guards the text enumerates: conflicting recorded hashes, no recorded hash, a symlinked file, unreadable receipt state, and a differing record. Those branches are tested only in tests/unit/integration/test_cleanup_helper.py and tests/integration/test_uninstall_trust_lockfile_lifecycle.py, so conformance coverage of the security-relevant negatives cannot be traced back to req-lk-024.
    Recommended fix: Add req-lk-024-marked conformance oracles that reuse _consent_evidence: recorded_hashes with two values (kept), recorded_hashes empty (kept), path replaced by a symlink (kept), and receipts_readable=False (kept). Each asserts result.deleted == [] and the file survives.

New nit findings (3)

  • [oci-nit-r1-1] The sentence 'A lockfile content hash alone MUST NOT authorize the deletion' still reads as absolute. The exception that qualifies it only appears two sentences later, so anyone quoting the MUST NOT sentence alone misstates the published rule. -- fix: Prefix that sentence with 'Except under the consent exception below, a lockfile content hash alone MUST NOT authorize the deletion'.
  • [oci-nit-r1-2] 'consent is never implied by another option or by configuration' leaves it unclear whether an environment variable or a non-interactive CI default counts as configuration. -- fix: Change to 'consent is never implied by another option, an environment variable, or configuration'.
  • [oci-nit-r1-3] The module summary line still says 'never a lockfile hash alone (req-lk-024)'. The docstring body now cites the 0.1.76 exception, so the summary contradicts it. -- fix: Change to 'Deletion requires deployment evidence; a lockfile hash alone authorizes it only under the consented-uninstall exception (req-lk-024)'.

Preserved strengths confirmed

  • req-lk-012 canonical content domain (CRLF-normalized text, raw binary, lone CR hash-visible) is reused, not redefined, by the exception
  • req-lk-016 hash envelope and bare-hex deprecation horizon (v0.2 removal) unchanged
  • Base req-lk-024 rule (receipt or render equality; forged lockfile row kept and named) unchanged when consent is absent
  • Exception is fail-closed on unreadable receipt state, differing record or render, render lacking the path, and missing or conflicting hashes
  • Hash is rechecked immediately before removal, so the bytes deleted are the bytes consented
  • Consent is per-invocation and scoped to uninstall only; schema bytes and lockfile_version unchanged; statement count unchanged

Package-Manager Registry-Contract Editor -- shocked_meter 8/10, confidence high

Summary: I found no blockers; the consent exception is narrow and keeps the file in every doubtful case. Four points could still lead conformant consumers to delete different files: the singular-owner hash wording, whether a missing record store counts as empty, whether a consumer must actually attempt the render, and the unstated difference between online and offline outcomes under consent. The refusal cases should also use normative MUST NOT wording and get conformance tests.

New recommended findings (6)

  • [pkg-rec-r1-1] req-lk-024 (Section 5.2), consent exception -- The exception keys on 'the single content hash the lockfile records for that path under its owning dependency' (singular owner). The base rule already allows several owners for one path, and the reference implementation (_recorded_owner_hashes) collects every hash from every lock entry that lists the path, then requires that set to hold exactly one value. A reader of the spec text alone could reach a different result. One reading checks only one chosen owner. Another refuses every path with more than one owner. A third collects hashes across owners, as the reference implementation does. So two conformant consumers can delete different files from the same lockfile and disk state. The spec also does not say whether a still-declared dependency that also lists the path blocks the exception.
    Recommended fix: Replace 'equals the single content hash the lockfile records for that path under its owning dependency' with 'equals the content hash the lockfile records for that path, where every lock entry that lists the path records a hash and all of those hashes are the same single value'. Then append to the never-applies list: 'or when a dependency that remains declared after the uninstall also lists the path'.
  • [pkg-rec-r1-2] req-lk-024 (Section 5.2), consent exception precondition 'read its local deployment records without error and holds none' -- The main use case in Uninstall: consent path for offline or deleted sources #4295 is a project cloned, or a lockfile carried, to a machine where the consumer never wrote deployment records. The record store may not exist there at all. The text does not say whether an absent store counts as 'read without error and holds none' or as a read failure. If one implementation treats a missing store as an error and another treats it as empty, they reach opposite outcomes in exactly the scenario the amendment targets.
    Recommended fix: After 'holds none for the file' insert: '(an absent record store counts as holding none; a store that exists but cannot be read or parsed does not)'.
  • [pkg-rec-r1-3] req-lk-024 (Section 5.2), 'no render of its owning locked dependency could be produced' -- 'Could be produced' does not require the consumer to try. A minimal consumer could skip rendering entirely and fall straight through to the lockfile-hash test. That brings back the forged-row attack the 0.1.69 rule exists to stop: a user file that matches a forged lock hash would be deleted on the user's consent even when the render, if attempted, would have shown different bytes. The reference implementation does attempt a lazy render (_rendered_roots), but the spec does not bind other implementations to do so.
    Recommended fix: Replace 'and no render of its owning locked dependency could be produced' with 'and the consumer attempted, and failed, to produce the render of its owning locked dependency at its locked version'.
  • [pkg-rec-r1-4] req-lk-024 (Section 5.2); Section 10.7 -- Determinism edge: with consent given, the same lockfile and disk bytes can yield different deletions depending on whether the source is reachable. Online, a file that matches the lock hash but differs from the render is kept. Offline, the same file is deleted. This is a deliberate trade (consent moves trust to the user), but the spec does not name it. Readers may assume the 0.1.69 outcome does not depend on the environment, and auditors cannot tell from the diagnostic which basis was used.
    Recommended fix: Append to the req-lk-024 exception text: 'Because the exception applies only when no render is produced, its outcome can depend on whether the source is reachable; the diagnostic naming each file so deleted MUST state that the lockfile hash, not a deployment record or render, was the basis.' Mirror one sentence in Section 10.7.
  • [pkg-rec-r1-5] req-lk-024 (Section 5.2), never-applies list and consent clause -- The defensive limits are written in non-normative prose ('The exception never applies when...', 'consent is never implied by...'). The base text uses 'MUST NOT' for the matching guard ('A lockfile content hash alone MUST NOT authorize the deletion'). With the lowercase wording, the refusal cases and the no-implied-consent rule read as description rather than testable prohibitions. That matters most for the consent clause, which should stop an implementation from treating --yes, a non-interactive mode, an environment variable or a manifest key as consent.
    Recommended fix: Reword as: 'A consumer MUST NOT apply the exception when a deployment record or a render shows different bytes, when a render lacks the path, when the lockfile records no hash or conflicting hashes for the path, or when the file is unreadable or a symbolic link, and MUST NOT infer consent from any other option, environment variable, configuration, manifest or lockfile content.' The statement count is unchanged; the change stays inside req-lk-024.
  • [pkg-rec-r1-6] tests/spec_conformance/test_deletion_evidence_reqs.py (req-lk-024) -- The new conformance oracles cover only consent on versus off and a render that lacks the path. They do not cover the other refusal cases: conflicting recorded hashes, no recorded hash, a symbolic link, an unreadable record store (receipts_readable=False), a receipt with different bytes, and bytes that change between preview and removal. Without these, a regression that drops any one of those guards would pass the conformance suite.
    Recommended fix: Add parametrized req-lk-024 cases that turn consent on and assert the file is kept for each of: recorded_hashes holding two values, recorded_hashes empty, the path being a symlink, receipts_readable=False, a receipt whose hash differs, and file bytes changed after consent_preview but before cleanup.

New nit findings (3)

  • [pkg-nit-r1-1] Lockfile hashes use the form ':'. The exception does not say that the comparison uses the algorithm the recorded value names, or what happens when the consumer does not support that algorithm. -- fix: After 'equals the ... content hash' add '(computed with the algorithm the recorded value names; a value whose algorithm the consumer does not support counts as no hash)'.
  • [pkg-nit-r1-2] The assertion 'consent is never implied by\nanother option or by configuration.' includes a hard-wrapped newline, so a reflow of the spec paragraph breaks it. -- fix: Normalize whitespace before matching, or assert on a fragment that does not cross a line break.
  • [pkg-nit-r1-3] The table goes from 0.1.73 (proposed) to 0.1.76 (proposed) with no 0.1.74 or 0.1.75 row and no note explaining the gap. That reads as count drift unless those numbers are held by concurrent proposals. -- fix: If 0.1.74 and 0.1.75 are held by open proposals, say so in one line under the table; otherwise renumber this row to 0.1.74.

Preserved strengths confirmed

  • The 0.1.69 core is unchanged: a lockfile hash alone still never authorizes deletion unless the user consents on that invocation.
  • The exception is narrow and fail-closed: one recorded hash, recheck immediately before removal, symlinks and unreadable files kept, and a named diagnostic for every consented deletion.
  • No lockfile schema bytes, lockfile_version or new fields, so lockfile determinism is untouched.
  • Scope is limited to uninstall; prune, install and update cleanup keep the strict 0.1.69 rule.
  • Revised in place and the statement count is unchanged (151); Appendix C, the requirements manifest and the aggregate amendment paragraph are updated consistently.

W3C TAG Architect -- shocked_meter 7/10, confidence high

Summary: Narrow, well-fenced amendment: the per-invocation consent exception has sound safety exclusions, and consent cannot be implied by configuration or other options. Main follow-ups: (1) qualify the still-absolute 'MUST NOT' sentence so req-lk-024 does not contradict itself, (2) give the row a Section 9.2 classification, since this relaxes a fail-closed obligation, (3) require conformance-statement disclosure of the optional capability, (4) make multi-owner paths unambiguous, and (5) test the never-applies clauses that are still uncovered.

New recommended findings (5)

  • [tag-rec-r1-1] req-lk-024 (Section 5.2) -- The revised req-lk-024 still says, without qualification, that a lockfile content hash alone MUST NOT authorize the deletion. Two sentences later, the new consent exception lets a lockfile hash authorize a deletion, provided the user consents and no contrary evidence exists. A reader, or a tool that extracts the first prohibitive clause (for example the manifest notes or a requirement summarizer), sees an absolute MUST NOT that the same statement then contradicts. Normative text should not rely on reading order to resolve an override.
    Recommended fix: In req-lk-024, replace 'A lockfile content hash alone MUST NOT authorize the deletion: it proves content, not that the consumer deployed it.' with 'Except under the consent exception below, a lockfile content hash MUST NOT authorize the deletion: it proves content, not that the consumer deployed it.'
  • [tag-rec-r1-2] Appendix D row 0.1.76; Section 9.2 -- Section 9.2 lists 'Loosening a MUST to a SHOULD' as breaking, and its non-breaking clause requires that 'no existing fail-closed obligation is relaxed'. Amendment 0.1.76 relaxes a fail-closed keep-the-file obligation into a conditional MAY. Unlike the 0.1.69 to 0.1.72 rows, the 0.1.76 row gives no Section 9.2 classification. It also does not say which verdicts can change. Without consent, a consumer that never offers the exception still conforms. With consent, a third-party auditor that flagged any hash-only deletion as non-conformant would now reach a different verdict. Implementers cannot tell from the row whether this is a breaking change or what happens to their existing checks.
    Recommended fix: Append to the 0.1.76 row: 'Under Section 9.2 this relaxes, only under explicit per-invocation uninstall consent, an obligation 0.1.69 defined, so it is an amendment, not errata. A consumer that does not offer the exception still conforms unchanged. The only verdict that can change is an audit of a consented uninstall that deleted a file on a single matching recorded hash, which no longer fails.'
  • [tag-rec-r1-3] req-lk-024 consent exception; conformance statement -- The exception is an optional MAY capability, but nothing requires an implementation to disclose whether it offers it or how consent is given. Integrators and auditors need that information to interpret a deletion. The spec already uses this disclosure pattern for optional capabilities: 0.1.72 basis (c) and req-na-001 both require a conformance-statement disclosure. CONFORMANCE.md lists req-lk-024 as plain 'active' with no note that the exception is implemented.
    Recommended fix: Add to the req-lk-024 exception: 'An implementation that offers this exception documents, in its conformance statement, that it does so and the per-invocation mechanism by which consent is given.' Add the matching note (for example '--trust-lockfile') to the req-lk-024 row in CONFORMANCE.md.
  • [tag-rec-r1-4] req-lk-024 consent exception (multi-owner paths) -- The exception speaks of 'its owning locked dependency' and 'the single content hash the lockfile records for that path under its owning dependency', which assumes one owner. A path can be recorded under several dependencies. The reference implementation (DeploymentEvidence.lockfile_consentable) takes the union of recorded hashes across all owners, requires exactly one distinct hash, and blocks consent when any owner's render exists. A second implementer reading the singular text could check only one owner. Two conformant implementations could then disagree on whether a shared path is deletable.
    Recommended fix: Reword to: 'no render of any locked dependency that owns it could be produced, ... equals the single content hash the lockfile records for that path across the dependencies that own it'. Then make 'conflicting hashes' read 'differing hashes across or within its owning dependencies'.
  • [tag-rec-r1-5] tests/spec_conformance/test_deletion_evidence_reqs.py; CONFORMANCE.md req-lk-024 7 / 9 -- The exception lists several never-applies clauses, but conformance tests cover only two: missing consent, and a render that lacks the path. Untested clauses: a differing deployment record, a differing render, no recorded hash, conflicting recorded hashes, a symbolic link, an unreadable file, records read with error, and the recheck immediately before removal. These clauses are what make the exception safe, and no test would catch a regression in them.
    Recommended fix: Add parametrized req-lk-024 oracles in test_deletion_evidence_reqs.py with consent given. Cover: recorded_hashes with two values, an empty recorded_hashes, a symlinked path, receipts marked unreadable, a differing receipt, and a render whose bytes differ. In each case assert that the file is kept and named.

New nit findings (3)

  • [tag-nit-r1-1] The paragraph headed 'Conditional requirements retain the applicability limits' now also describes the 0.1.76 exception. req-lk-024 is an unconditional MUST that contains a conditional permission, so placing it under 'conditional requirements' muddles the categories. The text also pins the word 'proposed', which will need editing when the amendment is adopted. -- fix: Move the clause into its own sentence: 'The consent exception in req-lk-024 permits, but never requires, deletion and applies only to an explicitly consented uninstall.' Drop 'proposed 0.1.76'.
  • [tag-nit-r1-2] The row follows 0.1.73, so versions 0.1.74 and 0.1.75 are missing without explanation. The 0.1.65 row sets a precedent by recording which versions are reserved for concurrent proposals. -- fix: Add to the 0.1.76 row: 'Versions 0.1.74 and 0.1.75 are reserved for concurrent proposals; this amendment does not adopt them.'
  • [tag-nit-r1-3] assert_spec_contains does a verbatim substring match. The needle 'consent is never implied by\nanother option or by configuration.' includes a hard line break, so it pins the current line wrapping. Reflowing the paragraph without changing a word would break the test. -- fix: Use a needle without a line break, such as 'another option or by configuration.', or change spec_contains to collapse whitespace before matching.

Preserved strengths confirmed

  • No statement added; Appendix C row, requirements manifest keyword, section and class unchanged; statement count stays at 151.
  • Consent cannot be implied: 'never implied by another option or by configuration' rules out ambient authority, such as a config default or an implied flag, from enabling destructive behavior.
  • Safety hardening: recheck immediately before removal (time-of-check to time-of-use), symbolic link and unreadable exclusions, and refusal when records are read with error, when a render or record shows contrary bytes, or when recorded hashes conflict.
  • The exception is implementation-neutral: the spec names no CLI flag. The reference implementation's --trust-lockfile appears only in code and diagnostics.
  • Without consent, the 0.1.69 behavior is unchanged. The forged-lockfile-row oracle still holds.
  • Section 10.7 threat prose stays in sync with the normative change.

This panel is advisory. It does not block merge. Re-apply the spec-review label after addressing feedback to re-run.

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

A critical receipt-validation gap allows --trust-lockfile to delete files when the installation marker is missing and the receipt store is corrupt, violating the unreadable-store safety exclusion.

5 open issues
What changed in this PR

Adds an explicit apm uninstall --trust-lockfile recovery path for missing deployment evidence when locked sources cannot be rendered, addressing #4295 while preserving the default refusal behavior.

Changes:

  • Centralizes consent eligibility in DeploymentEvidence, with refusal previews and deletion reporting.
  • Adds unit, lifecycle, and conformance coverage for eligible deletions and excluded cases.
  • Updates CLI documentation and proposes OpenAPM amendment 0.1.76 for the consent exception.
File Description
tests/​unit/​integration/​test_cleanup_helper.py Tests hash eligibility and rechecks after edits.
tests/​unit/​core/​test_remediation_w2_integration_catalog.py Links the new remedy to lifecycle coverage.
tests/​spec_conformance/​test_deletion_evidence_reqs.py Adds consent and exclusion oracles for req-lk-024.
tests/​lifecycle/​generator/​rules.py Updates uninstall source anchors.
tests/​integration/​test_uninstall_trust_lockfile_lifecycle.py Exercises project/user recovery and negative controls.
src/​apm_cli/​integration/​cleanup.py Implements the shared consent decision and preview.
src/​apm_cli/​core/​remediation.py Adds the trust-lockfile recovery remedy.
src/​apm_cli/​commands/​uninstall/​cli.py Wires the flag, retained-file handling, and reporting.
packages/​apm-guide/​.apm/​skills/​apm-usage/​commands.md Documents the new uninstall option.
docs/​src/​content/​docs/​specs/​openapm-v0.1.md Defines the proposed consent exception and risks.
docs/​src/​content/​docs/​reference/​cli/​uninstall.md Explains eligibility, previews, and recovery behavior.
docs/​public/​specs/​manifests/​openapm-v0.1.requirements.yml Updates req-lk-024 amendment notes.
CONFORMANCE.md Updates displayed requirement coverage.
CONFORMANCE.json Records the added conformance tests.
changelog.d/​4650.added.md Adds the user-facing release entry.

Review effort: Balanced

Comment thread src/apm_cli/integration/cleanup.py Resolved
Comment thread src/apm_cli/commands/uninstall/cli.py Resolved
Comment thread src/apm_cli/commands/uninstall/cli.py Resolved
Comment thread src/apm_cli/commands/uninstall/cli.py Resolved
Comment thread src/apm_cli/core/remediation.py Resolved
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.38.0 milestone Nov 21, 2026
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

CEO sign-off: OpenAPM spec amendment 0.1.76 (D8a)

This records a CEO-signed spec amendment, not an org-level scope approval.

# Conflicts:
#	src/apm_cli/integration/cleanup.py
…anup

The consent path's consented_deletions uses os.path.lexists; the merge of
main removed the import as unused on that side.

Co-authored-by: Copilot App <[email protected]>
…decides per file

Addresses the #4650 review:
- a receipt store no installation marker binds went unread, so it never
  counts as empty for --trust-lockfile consent (req-lk-024)
- consented deletions are named at the target-cleanup boundary, before any
  early exit, and each exactly once
- the exemption follows the deletion recheck's verdicts, so a file edited
  after the preview is kept without failing; failed deletions still fail
- under consent a kept skill directory still loses each eligible member
- the printed remedy names the packages, and the lifecycle test runs it

Co-authored-by: Copilot App <[email protected]>
Keeps deployment_ledger.py within the 2100-line source cap.

Co-authored-by: Copilot App <[email protected]>
# Conflicts:
#	docs/src/content/docs/specs/openapm-v0.1.md

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

Consent-based deletion reporting can double-count the same file, and the uninstall documentation contains conflicting command descriptions and an overstated file-preservation guarantee.

3 open issues

Review effort: Balanced

Comment thread src/apm_cli/integration/cleanup.py Resolved
…the lockfile-only path

Copilot review on #4650: merge duplicate apm uninstall rows left by main
refolds into the current row (keeps #4749/#4882/#4636 behavior) and state
that receipt- or render-backed deletion still applies with the flag.

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

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

Two critical path-alias handling gaps can authorize deletion despite a differing receipt or conflicting lockfile hash for the same file.

2 open issues
3 resolved since last review

Review effort: Balanced

Comment thread src/apm_cli/integration/cleanup.py Resolved
Comment thread src/apm_cli/integration/cleanup.py Resolved

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

Critical cleanup flaws allow deletion despite conflicting hashes for the same external file and can recursively delete user files created after the final scan.

3 open issues

Review effort: Balanced

Comment thread src/apm_cli/integration/cleanup.py Resolved
…age row (refold artifacts)

Co-authored-by: Copilot App <[email protected]>
…ceipt alias, late user file)

Co-authored-by: Copilot App <[email protected]>
…ed directory removal (#4650 review)

Unvalidated locally (strike 3): ruff check passed before the stop; the
architecture linter run was stopped. Cloud takeover validates on CI.

Co-authored-by: Copilot App <[email protected]>
Main's 0.1.76 (req-sc-016) keeps its number; the req-lk-024 consent
amendment (#4295) becomes 0.1.77 in the spec, manifest and tests.

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>

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

A critical Cowork symlink-handling flaw lets --trust-lockfile delete an untracked target file instead of the original link, leaving the link dangling.

1 open issue
3 resolved since last review

Review effort: Balanced

Comment thread src/apm_cli/integration/cleanup.py Resolved
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
from_lockfile_path() resolves the final component, so a cowork:// claim
whose file is a link was judged, and could be deleted, as the untracked
file it points at. cowork_locator() contains only the parent and keeps
the final component, so deletion evidence and the stale-file unlink see
the link: consent keeps and names it, and the target is never touched.
Red-first cell test_consent_keeps_a_cowork_final_symlink_and_its_target
(req-lk-024 43/45).

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>

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.

🔵 Needs a closer look

Human assessment is needed because case-variant paths under an external Cowork root can bypass alias checks, allowing deletion despite conflicting hashes or an available owner's render.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 0ecdc1a into main Nov 23, 2026
74 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-4295-uninstall-consent branch November 23, 2026 12:48
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
One `apm uninstall` row keeps both the #4650 --trust-lockfile text and the
#4703 shared-file sentence; the outcome reporter keeps both docstring and
the consented-deletions report. Known-cell snapshot refreshed.

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Copilot AI mentioned this pull request Nov 23, 2026
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.

Uninstall: consent path for offline or deleted sources

2 participants