Skip to content

Nothing claims idempotent, and the claim needs a different kind of evidence #691

Open

Description

@David-Noble-at-work

Follows: #677, which declared the claim and left it unused

+devlore:claim=idempotent exists in op.MethodClaims and is parsed, validated, and emitted like the other two.
Nothing claims it. #677 annotated deterministic and sandboxed from measurable evidence — import sets, call
graphs, which API a body reaches — and idempotency has none of that, so it was left empty rather than guessed at.

Why it is a different kind of claim

Claim Evidence Where the truth lives
deterministic call graph our code — pkg/op/claimcheck decides it
sandboxed which API a body calls our code — same
idempotent behaviour under re-application sometimes our code, sometimes an external tool's contract

pkg.Install is the sharp case. It does not check-then-install: provider.go calls
plat.PackageManager().Install(...) and delegates. What it tracks is InstalledBefore on the receipt
(receipt.go:57), used only for compensation — if !receipt.InstalledBefore decides whether unwind removes the
package. So the design reasons about prior state for undo and not at all for re-application, and whether
pkg.install converges is a property of apt / brew / winget, not of this repository.

The criterion to apply

A method may claim idempotent when re-application converges to the same state. Three distinguishable cases:

  1. Our code converges explicitly — file.mkdir uses MkdirAll; file.write_text writes the same bytes.
    Readable from the implementation, provable by a double-application test.
  2. We delegate to a converging tool — pkg.install → apt-get install on an installed package is a no-op.
    Claimable, but the evidence is the tool's contract and only an integration test touches it.
  3. Re-application diverges or errors — not claimable.

archive.extract is case 1 or 3 depending on whether a second extraction overwrites or fails; the write path
decides it and has not been read.

The test IS the claim

Nothing static can check this, so +devlore:claim=idempotent without a double-application test is a comment. The
obligation: a method claiming it must have a test that applies it twice and asserts the same end state. That
rides #635's per-method coverage directive rather than needing new machinery.

Candidates named so far

pkg.install, pkg.remove (uninstall is not the announced name), archive.extract, and the file mutators
that use converging primitives. Each needs its implementation read before anything is claimed — the point of this
issue is that the reading has not happened, not that the answers are known.

Activity

  1. David-Noble-at-work commented on Nov 7, 2026

    @David-Noble-at-work
    ContributorAuthor

    Split on 2026-11-06, on the owner's word, as #91 was. This issue keeps the design: what evidence an idempotent claim needs, which is engineering. The product half, the provider methods that meet that evidence carrying +devlore:claim=idempotent in the shipped code, is #1199, which waits on this one.

  2. David-Noble-at-work commented on Nov 9, 2026

    @David-Noble-at-work
    ContributorAuthor

    star github triage sweep added this issue to Triage: devlore, for the rule it breaks:

    • no-evidence: no Evidence of completion section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions