# Decisions Fork-only. Append-only, newest first. Never edit or delete an entry - supersede it with a new one that links back. One entry per decision a future maintainer would otherwise have to reverse-engineer. No index: `grep -n '^## ' docs/DECISIONS.md` lists every entry. ## 2026-11-12 - Proton Drive deletes an upload's draft only on an explicit refusal **Status:** accepted. Supersedes the read-back half of handoff ruling 11 ("a draft is deleted only on positive proof it never committed", where a read showing the draft or the old revision counted as proof). **Context:** Proton's server can take a moment to show a commit (entry below). After a failed commit, one stale read showing the draft or the base revision made the client delete the draft, but the commit may have landed: `delete_multiple` against what is now an active file, or `DELETE .../revisions/{id}` against what is now the active revision. What the real server does with those is unconfirmed, so this could lose data. **Decision:** The draft is deleted only when the server explicitly refused the commit, meaning a 4xx `api.Error` (not 408) with a Proton code, on a single attempt that the pacer did not resend. A resend after 5xx/408/network/timeout makes the outcome unknown even if the final answer is a refusal, because an earlier attempt may have landed. No read-back decides deletion, and a refusal is not read back at all. Every other failure (5xx, network, timeout, cancelled ctx, resent attempts) returns `errUploadOutcomeUnknown` and deletes nothing. The read after such a failure can still turn it into a success when it shows the upload's revision. It retries through lag while the caller's ctx lives, and reads once, detached, if ctx is done. **Alternatives:** Requiring every read across the whole lag window to show the pre-commit state (a heuristic, as the lag length is unmeasured); the old single-read proof. **Consequences:** More drafts are left behind after ambiguous failures. The next upload of the name replaces them, otherwise they stay (see `docs/TODO.md`). A refused commit fails at once, with no reads. ## 2026-11-12 - Proton Drive uploads tolerate read-after-write lag, but never invent the result **Status:** accepted **Context:** Against the real service an upload whose commit succeeded failed because the node read back just after was missing or still a draft with an empty active revision (`errUploadSuperseded` with revision "", and "object not found"). The client read the node once and trusted it. **Decision:** After a commit the node is read again with backoff (100 ms doubling to 2 s, 8 reads, about 7 s) while it is missing, active with no revision, or - when the commit returned success - still as it was before the commit. `errUploadSuperseded` is kept for a non-empty revision which is neither ours nor the one we started from. If the lag outlasts the reads, the upload returns `errUploadUnconfirmed` (no low-level retry, as for `errUploadOutcomeUnknown`), deletes nothing, and a later sync pass finds the file. The same not-found retry covers a copy's read back and, with `enable_caching` off, a folder to write into (with it on, a folder the client made is cached, so a miss means it is gone). **Alternatives:** Returning success with a node built from what was committed (the caller then reads, moves or updates through it, and that needs the decrypted keys and server metadata the client would be inventing; a wrong node would be cached and acted on); retrying every read after any write (slows every genuine not-found). **Consequences:** With `enable_caching` off, a put into a folder deleted elsewhere takes about 7 s longer to fail. A lag longer than 7 s still fails the upload, now with an error saying it was committed. See `docs/TODO.md` for the read-after-write spots not yet tolerant. ## 2026-11-12 - Proton Drive golden captures fail closed **Status:** accepted; amends "Proton Drive golden fixtures are re-keyed captures" below **Context:** Review found the capture could copy account data into a fixture: an intended-recipient fingerprint of a key not being replaced (in the notes), and the user ID of a node key. It also reused `-remote`, so a mistyped `-run` would start the writing integration suite against the account. **Decision:** The capture names its folder with `-capture-remote` and refuses to run with `-remote` set. Every key written has the user ID `golden `; a node key whose user ID holds an email other than the account's or the generic ones Proton's clients use (`no-reply@proton.me`, `noreply@protonmail.com`) fails the capture. A signature by, or intended for, a key not being replaced fails the capture, and the error names no key. A salt notation is written only where the original had one (with a new salt). `TestGoldenFixtures` also walks every key, key packet and signature, inside encrypted messages too, and fails on any key ID, fingerprint or user ID not of the test keys. **Consequences:** What the committed fixtures expose, by design: with the test keys in `keys.json`, anyone can decrypt the captured names, extended attributes (as the client wrote them: check them for camera or location fields before committing), literal-packet file names and dates, folder hash keys (so whether a guessed name exists in those real folders can be tested) and file contents; and the address key's creation time is kept. Node passphrases and the account's keys are not exposed. ## 2026-11-12 - Proton Drive golden fixtures are re-keyed captures **Status:** accepted **Context:** Plan Task 21 asks for fixtures of nodes written by Proton's web app and official CLI. Captured as they are, they would carry the test account's keys, IDs and emails. The owner chose to re-encrypt them under keys made for the tests. **Decision:** `TestGoldenCapture` (`-capture DIR -capture-label NAME -remote NAME:PATH`) writes `backend/protondrive/testdata/golden/