Skip to content

A receipt and its output can still land half when one half fails on disk #242

Open

Description

@SitgesRun

A receipt and its output (<path> and <path>.receipt.json, doc/protocol.md 2.3) should land together or not at all. Since #240 (349e7ba), a pair is left out whole when its receipt is left out, and, while a turn runs, when either half was edited by hand. Two cases remain. Both happen only when one half of a pair fails on disk. Codex found them in its second review of #240.

1. The receipt is written, then its output fails
landTurnFiles (extensions/pine-drama/src/core/applyChange.ts) writes receipts first. When the output's write then fails (pathError: a non-empty folder where the file goes, EACCES, a name too long), the output is left out but the new receipt stays written, staged and committed. The project then holds a receipt that describes an output it does not have, beside the older output.

Repro: a turn changes a.png and a.png.receipt.json. Before it lands, a non-empty folder a.png/ stands in the project. After the landing, the receipt is the new one and a.png is left out with "in the way of a folder or a file".

2. The receipt's deletion is blocked, its output's is not
The deletion loop has no pair guard. When a turn deletes both halves and only the receipt's rm fails (for example, no write permission on it), the output is deleted and the receipt stays.

Proposed rule
Judge both destinations before writing either: a pair lands whole, or both halves are left out with the reason. For a write, both destinations have to accept a file, through the same throughNoLink / in-the-way checks the loop already makes. Deletions use the same grouping. No restore-after-failure path.

Severity: wrong result (a receipt that doesn't match its file). Not blocking, because it needs a disk failure (merge standard). Flexibility cuts, item 17.

Activity

  1. added
    P2Experience: wording, feedback, layout, extra steps
    on Nov 15, 2026
  2. SitgesRun commented on Nov 15, 2026

    @SitgesRun
    ContributorAuthor

    Still on staging a01a620: by code read, landTurnFiles (core/applyChange.ts) writes receipts first and has no pair guard on a failed output write or in the deletion loop. P2: needs a disk failure.

  3. SitgesRun commented on Nov 15, 2026

    @SitgesRun
    ContributorAuthor

    Re-checked on staging b744a69 after #249: still real. landTurnFiles (core/applyChange.ts) still writes receipts first with no pair guard when the output's write fails, and the deletion loop still has none; since #249 each collection commits, so a half pair is committed at that collection. P2.

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

    P2Experience: wording, feedback, layout, extra steps

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions