# 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 maps only the app-version codes to "upgrade rclone" **Status:** accepted (handoff ruling 30). Supersedes spec 6.6's "2000/2028 ... to a fatal error telling the user to upgrade rclone". **Context:** 2000 is Proton's generic "requirements not met" code, which the server returns for a stale `OriginalHash` or `CurrentRevisionID`, as after a rename whose response was lost and which was resent. Mapping it to a fatal "upgrade rclone" error aborted whole runs over a rename that had succeeded. 2028 means a feature is disabled, rate-limited or blocked for abuse (`driveTypes.ts`). The code Proton returns for a rejected app version is 5003 ("You need to update this app", `coreTypes.ts`), and 5001 for a missing one (go-proton-api), neither of which was mapped. **Decision:** 5001 and 5003 are a fatal error telling the user to upgrade rclone. 2000 is a no-retry error keeping Proton's message. 2028 is retried through the pacer (honouring `Retry-After` when sent), then returned as it is. 2064 (malformed header) is left unmapped. **Alternatives:** Keeping the spec's mapping (false fatal errors); treating 2028 as a no-retry error (fails at once on rate limiting). **Consequences:** A feature Proton disables outright costs the low-level retries before its error is returned. ## 2026-11-12 - Proton Drive caps the Argon2 cost of node and share keys **Status:** accepted **Context:** go-crypto unlocks an Argon2-locked key with whatever parameters it carries, up to 2 TiB of memory and 255 passes, and runs the KDF before it can tell the passphrase is wrong. Node and share keys come from the server, or from other users' clients in shared folders, so one crafted key could crash every listing that includes it. **Decision:** Before unlocking a node or share key, every secret key packet's S2K is checked: Argon2 may use at most 4 passes, parallelism 8 and 2^17 KiB (128 MiB). gopenpgp and OpenPGP.js write 3, 4 and 64 MiB by default, and Proton's node keys use an iterated and salted S2K, whose one-byte count encoding already bounds it to 4 times the default. A key beyond the limits is an integrity error, making the node unreadable, and `ignore_signature_errors` doesn't change that. **Alternatives:** Refusing Argon2 on node keys outright (no genuine node key is known to use it, but a future client might); capping the iterated count below the encoding's maximum (could refuse genuine old keys for a bounded cost). **Consequences:** At most 128 MiB per unlock while a listing decrypts nodes. The account's own user keys aren't checked yet (`docs/TODO.md`). ## 2026-11-12 - Proton Drive refuses a file whose content key is unsigned **Status:** accepted (handoff ruling 29) **Context:** Anyone holding a file's public node key, which the server stores, can make a content key packet for it. Proton's SDK checks the content key packet's signature only when one is present. A server could then send its own content key without a signature: rclone would encrypt every update of the file with a key the server knows, and a ranged read (which can't check the manifest) would return whatever the server encrypted under it. **Decision:** A content key whose signature is missing or invalid makes the file unverified, as an unverified node key does (rulings 18 and 22): reads, full and ranged, and updates are refused unless `ignore_signature_errors` is set, when rclone logs an `ERROR` once per file and operation and goes ahead. The pre-2023 fallback to the account's other address keys still applies to a signature which is present but fails, as in the SDK. Integrity checks are never turned off. This is stricter than the SDK. **Alternatives:** Following the SDK (leaves the hole); a creation-date exemption for unsigned keys (the date is server-supplied, so it would exempt anything the server back-dates). **Consequences:** A genuine file whose content key was never signed, if any client ever wrote one, needs `ignore_signature_errors`. Every file in the golden fixtures, written by Proton's web app, CLI and the old library, has a signed content key. ## 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/