Shutdown cancelled a poll in flight without waiting for it, so a poll whose response had already arrived could still log after Shutdown returned; the race detector caught one racing with a test's change to the log level. Shutdown and Disconnect now wait for the poll, though not for any notification it makes. Also make TestPollerShutdownAndReuse wait for its polls rather than count them after a fixed sleep, which failed under load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
602 lines
34 KiB
Markdown
602 lines
34 KiB
Markdown
# 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's test server reports events as the real one does
|
|
|
|
**Status:** accepted (supersedes ruling 8 of "Proton Drive follows volume
|
|
events for change notification", below; plan 002 Task 6)
|
|
**Context:** Ruling 8 described the fake server's events, to be checked
|
|
live. The check (free account, `rclone test changenotify` at the 30 s
|
|
floor, changes made with rclone and the official CLI 0.9.0) found:
|
|
|
|
| Action | Events |
|
|
|---|---|
|
|
| upload (at commit), mkdir, server-side copy | Create (1); a copied folder: one per link |
|
|
| new revision | Update (2) |
|
|
| rename, move, trash (file or folder) | UpdateMetadata (3) |
|
|
| permanent delete, empty trash | Delete (0), one per link removed |
|
|
|
|
Link fields (`ParentLinkID`, `IsTrashed`) are the link's state when the
|
|
events are read: a folder made and removed between polls comes back as
|
|
a Create with `IsTrashed` set; a link deleted for good has no parent and
|
|
isn't trashed. Pages hold 299 events; a 2783-event poll read 10 pages.
|
|
**Decision:** The fake emits these types and reports Link fields at read
|
|
time; events added with `InjectEvent` keep their own fields. The backend
|
|
needed no change: only Delete is treated specially, so UpdateMetadata is
|
|
handled like Update. `pollEvents` logs one DEBUG line per page (IDs and
|
|
counts only). Live `FsChangeNotify` is ignored for `TestProtonDrive:`:
|
|
fstests waits 27 s, below the 30 s floor.
|
|
**Alternatives:** Keeping the fake's per-change snapshots (tests would
|
|
pass on states the real server never reports).
|
|
**Consequences:** A file trashed and emptied between polls is named at
|
|
its cached path only; its Delete names no parent.
|
|
|
|
## 2026-11-12 - Proton Drive follows volume events for change notification
|
|
|
|
**Status:** accepted (plan 002 rulings 1-9, as built in M5 Tasks 2-4; ruling 2
|
|
amended in the Task 4 review; ruling 9 and the idle cache added in Task 7)
|
|
**Context:** The node cache never saw changes made by other clients, so a
|
|
long `rclone mount` or `rclone serve` showed stale listings. Proton's
|
|
volume events (`GET /drive/volumes/{volumeID}/events/latest` for the
|
|
start cursor, `GET /drive/v2/volumes/{volumeID}/events/{eventID}` for
|
|
pages) report changed nodes by ID only: no names, no paths, no client.
|
|
**Decision:**
|
|
1. Own writes come back as events and are applied like any other
|
|
(invalidate, re-fetch on next use); there is no attempt to recognise
|
|
them.
|
|
2. `ChangeNotify` names a cached node at its old path (from the
|
|
dircache), and at its new folder if it moved to a known one. A node
|
|
that wasn't cached is reported at once as its parent folder, if that
|
|
is in the dircache, else not at all, and at its old path if it is a
|
|
folder the dircache holds. Its ID is then kept (at most 1000, oldest
|
|
dropped) for the next two polls, which look it up in the node cache
|
|
even when they bring no events; if it has been cached by then (an own
|
|
upload or `Mkdir` caches its node a round trip after the server
|
|
commits it, so its event can be applied first) it is reported at its
|
|
exact path. No extra requests are made to name nodes; pending IDs are
|
|
dropped on refresh, volume gone, `Shutdown` and when the last
|
|
subscriber leaves. A folder renamed in place is reported as its old
|
|
path plus its parent, since events carry no names. Nothing outside
|
|
the `Fs` root is reported.
|
|
3. `Refresh` (cursor unknown or expired) clears the node cache, takes the
|
|
returned `EventID` as the cursor and notifies `""` as a directory. The
|
|
dircache is flushed but keeps the root folder's ID, not `ResetRoot`:
|
|
after `ResetRoot` an `Fs` below the volume root would name later
|
|
events relative to the volume root until something found its root
|
|
again. `DirCacheFlush` keeps the root's ID for the same reason.
|
|
4. A Delete, or an Update that moves or trashes a folder, drops the node
|
|
and everything cached below it (`invalidateTree`). Every applied batch
|
|
flushes each changed folder's old path, and everything below it, from
|
|
the dircache, with or without `ChangeNotify`.
|
|
5. Proton code 2501 on an events route (volume gone) stops polling for
|
|
the life of the `Fs`, clears the cache, logs one ERROR and notifies
|
|
subscribers as for a refresh.
|
|
6. The hidden option `events_min_interval` (default 30s) sets the floor;
|
|
below 30s it is raised to 30s, with a NOTICE, when the endpoint host is
|
|
`proton.me` or ends in `.proton.me` (trailing dot ignored) or can't be
|
|
parsed. The interval rclone passes to `ChangeNotify` is used when
|
|
longer. Each wait adds up to 1s of jitter; failures back off by
|
|
Fibonacci multiples of the interval, capped at 10 minutes.
|
|
7. Each `Fs` polls on its own and keeps its own cache; the five cross-`Fs`
|
|
cache tests stay ignored.
|
|
8. The fake server emits Create at upload commit, Update at a revision
|
|
commit, rename, move and trash, Create on copy, and nothing for a
|
|
draft's deletion; to be checked against the real server (plan 002
|
|
Task 6).
|
|
9. `Shutdown` stops the poller; using the `Fs` again restarts it from
|
|
the cursor it had, an interval later, so a `Shutdown` and reuse never
|
|
make two events requests within an interval. `Shutdown` returns once
|
|
a poll in flight has ended (not its notifications), so nothing of it
|
|
runs, or logs, afterwards. `Disconnect` stops it for good.
|
|
10. With nothing subscribed, a node cache unused (neither read nor
|
|
filled; applying events doesn't count) for 10 minutes is cleared,
|
|
which stops polling as an empty cache does; the next use refills it
|
|
and polls from the kept cursor.
|
|
|
|
The poller is a `time.AfterFunc` timer, polling only while the node cache
|
|
holds anything or a `ChangeNotify` subscribes. Subscribers (and the
|
|
dircache observer) are called only from the poller's goroutine, never
|
|
from inside a user operation, which may hold dircache or VFS locks the
|
|
subscriber takes. The first fill of an empty cache fetches the start
|
|
cursor in the caller's path, so no change after the fill is missed;
|
|
once that fetch has failed, later ones wait for the backoff instead.
|
|
Events requests are paced but not retried by the pacer, so the poller's
|
|
own backoff governs failures; a Retry-After isn't waited out in the
|
|
request (nor given to the pacer, which would hold every call of the
|
|
client) but delays the next poll.
|
|
The data race fixed in `fstests` `FsChangeNotify` (commit `27e1a9c54`:
|
|
its maps were written from the backend's goroutine and read from the
|
|
test's without a lock) is a generic test fix, not Proton-specific.
|
|
**Alternatives:** Recognising own writes (v2 events name no client);
|
|
a fetch per unknown node to name it (extra requests per poll; under
|
|
review); a cache shared across the `Fs` of one account (package state,
|
|
which the spec rules out); `ResetRoot` on refresh (wrong paths below the
|
|
volume root).
|
|
**Consequences:** A mount sees other clients' changes within about one
|
|
poll interval. A moved node is reported under its old name in its new
|
|
folder, and an own upload's event applied before the node is cached is
|
|
reported only as its folder. An `Fs` that is never shut down and holds
|
|
anything in its cache polls until the cache has gone unused for 10
|
|
minutes. If the root folder
|
|
is deleted and recreated by another client while the cursor is expired,
|
|
the `Fs` keeps the old root ID.
|
|
|
|
## 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 <golden@example.invalid>`; 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/<label>/`,
|
|
read by `TestGoldenFixtures` from the fake server with every signature
|
|
checked. Preserved: every block byte for byte; every SEIPD packet which
|
|
holds no signature (re-wrapped session key only); the session key, cipher,
|
|
SEIPD version, AEAD mode and chunk size, compression algorithm and literal
|
|
data packet (format, file name, date, content) of names, hash keys and
|
|
extended attributes; signature version, type, hash, creation time,
|
|
lifetime and notations; key algorithm, version, creation time and AEAD
|
|
support; timestamps, sizes, flags, media types, block sizes and whether
|
|
they are recorded. Replaced: all keys (address, node, the captured
|
|
folder's parent) by new ones; every PKESK, re-wrapped in the same version;
|
|
every signature, re-made by the key replacing its signer (an embedded one
|
|
forces its SEIPD packet to be encrypted again with the same session key
|
|
and parameters, as a signature can't change in place); node passphrases,
|
|
new ones in a message of the same format; the captured folder's name hash;
|
|
intended recipients and signer user IDs; emails by
|
|
`golden@example.invalid`; IDs by placeholders. Dropped: block signatures
|
|
(the backend doesn't read them), block URLs and tokens. Each node lists
|
|
what was done to it in `Rekeyed`. Files with thumbnails are refused (the
|
|
fake can't serve them); the address key passphrase is sealed to a user key
|
|
the fake generates, so no user key is written.
|
|
**Alternatives:** Raw captures (account secrets in the repository);
|
|
fixtures re-made with gopenpgp from the decrypted content (loses the
|
|
other clients' packet formats, the point of the exercise).
|
|
**Consequences:** The fixtures test the formats of names, hash keys and
|
|
extended attributes as other clients lay them out, but their signature
|
|
bytes are ours. Packet headers are re-serialised with fixed lengths.
|
|
|
|
## 2026-11-12 - Proton Drive is a native port of Proton's Drive SDK
|
|
|
|
**Status:** accepted
|
|
**Context:** With the bridge libraries gone (plan Task 19), the backend
|
|
is a Go client written for rclone. Its behaviour has to be checked against
|
|
something as Proton changes the service, and the user docs still
|
|
described the old libraries.
|
|
**Decision:** The backend is maintained as a port of Proton's Drive SDK,
|
|
module by module, tracked in `docs/specs/001-conformance-checklist.md`
|
|
against SDK commit `05c9115955589d9f6ab7392a36f8f0cb39327133` (whose
|
|
`client/js/CHANGELOG.md` ends at `js/v0.23.0`; that tag is not on the
|
|
commit), with its deliberate differences (stricter trust
|
|
rules, no small-file path, no events, no thumbnails) listed per module.
|
|
The user docs describe only what the code does and the protocol limits
|
|
the SDK shares, with no fork-only content, so they could go upstream.
|
|
**Alternatives:** Binding to the SDK itself (it is TypeScript and C#;
|
|
rclone refuses cgo and helper binaries); writing from observed traffic
|
|
alone, as the old libraries did (no reference to re-check against).
|
|
**Consequences:** Each SDK update needs a walk of the checklist: a diff
|
|
of the listed files between the checked commit and the new one. The
|
|
docs page must change with any behaviour change, and its generated
|
|
options section is left to `make backenddocs` at release.
|
|
|
|
## 2026-11-12 - Proton Drive keeps frozen old-library fixtures, not the old library
|
|
|
|
**Status:** accepted
|
|
**Context:** `go-proton-api` v1.0.4 and `Proton-API-Bridge` v1.0.5 stayed
|
|
in `go.mod` only for differential tests checking that the new client and
|
|
the old library read each other's output (plan Task 19).
|
|
**Decision:** The differential tests and both libraries were removed. What
|
|
the old library wrote stays checked through the frozen fixtures in
|
|
`backend/protondrive/testdata/oldlib/` (`TestFrozenFixtures`,
|
|
`TestFrozenFileFixture`), which can no longer be regenerated.
|
|
**Alternatives:** Keeping the libraries as test-only requirements (they
|
|
would stay in `go.mod` and its vulnerability surface, and upstream would
|
|
carry them).
|
|
**Consequences:** Multi-block and empty old-library files, and old-reader
|
|
compatibility of new writes, are no longer tested (`docs/TODO.md`).
|
|
|
|
## 2026-11-12 - Test-account usernames removed from git history by force-push
|
|
|
|
**Status:** accepted
|
|
**Context:** The first Proton Drive handoff commit contained the two
|
|
test-account usernames (no passwords or tokens); a later commit removed
|
|
them from the file but they stayed in history on the Gitea remote.
|
|
**Decision:** On the owner's explicit instruction, that commit was
|
|
rebuilt without the usernames, the following commits were replayed with
|
|
identical trees and metadata, and `master` was force-pushed once with
|
|
`--force-with-lease`. The rule against force-pushing still stands.
|
|
**Consequences:** Commit hashes from `901d7fd5b` onward changed (mapping
|
|
in the handoff's "Open questions" section). The old objects may stay
|
|
reachable on the server until Gitea garbage-collects the repository.
|
|
|
|
## 2026-11-12 - test_all shares one protonfake session across test processes
|
|
|
|
**Status:** accepted
|
|
**Context:** `fstest/testserver/init.d/TestProtonDriveFake` starts one
|
|
`protonfake` per `test_all` run (reference counted by `run.bash`), and
|
|
every test process gets the same session through
|
|
`RCLONE_CONFIG_TESTPROTONDRIVEFAKE_*` variables. Refresh tokens are
|
|
single use and a process can't see another's refresh, so one process
|
|
refreshing would leave the rest with dead tokens.
|
|
**Decision:** Share the session; change nothing in `protontest`,
|
|
`protonfake` or the client. The client refreshes only after an HTTP 401
|
|
(`session.call`); the fake answers 401 only for a session expired by
|
|
`Server.ExpireAccessToken` or ended by logout or `RevokeSession`, and
|
|
`protonfake` calls none of them. The only logouts are `Fs.Disconnect`
|
|
and re-running `rclone config`, which no test in `fs/operations`,
|
|
`fs/sync`, `vfs`, `cmd/bisync`, `cmd/gitannex` or `fstests` calls.
|
|
**Alternatives:** A session per test process (`protonfake` would need a
|
|
sign-in route for `test_all` to call, and the init.d protocol has one
|
|
output per server); non-expiring or logout-tolerant tokens in
|
|
standalone mode (behaviour no test needs, and a fake that differs from
|
|
Proton).
|
|
**Consequences:** A future test that calls `Disconnect`, or a fake that
|
|
expires tokens on a timer, breaks every process sharing the run: the
|
|
symptom is "not signed in" or refresh failures across all suites at
|
|
once. Revisit then.
|
|
|
|
## 2026-11-11 - Proton Drive rewrite paused mid-plan and merged to master
|
|
|
|
- **Decision:** at the owner's request, work on plan 001 stopped after Task
|
|
17 of 21 and the branch was fast-forwarded into `master` and pushed, with
|
|
the plan, a handoff document and the execution workspace committed under
|
|
`docs/plans/`.
|
|
- **Why:** the owner wanted development wound down with nothing left only
|
|
in an agent's conversation.
|
|
- **Consequences:** `master` carries an unfinished plan, against the usual
|
|
rule that plans are removed before merging; the user docs still describe
|
|
the old backend; the old libraries are still in `go.mod`. The push to
|
|
`master` was a one-off instruction - the rule against pushing to
|
|
`master` stands. Resume from `docs/plans/001-protondrive-tier1-HANDOFF.md`.
|
|
|
|
## 2026-11-11 - Proton Drive logs what ignore_signature_errors lets through
|
|
|
|
**Status:** accepted
|
|
**Context:** With `ignore_signature_errors` set, reads, writes, moves,
|
|
copies and renames of nodes whose keys are unverified went ahead
|
|
silently, although spec 6.4 promises a logged ERROR (Task 16 re-review
|
|
2).
|
|
**Decision:** Each such operation logs one ERROR per node and kind of
|
|
operation for the life of the `Fs`, naming the node, its ID, the
|
|
operation and why its key is unverified. Completes "Proton Drive won't
|
|
vouch for a node it couldn't verify".
|
|
**Alternatives:** Logging every call (floods a sync); a NOTICE (too
|
|
easily missed for something permanent).
|
|
**Consequences:** With the option set, moving or copying a node out of
|
|
an unverified folder re-signs or re-homes it as the user's, so it is
|
|
trusted from then on; the ERROR says so.
|
|
|
|
## 2026-11-11 - Proton Drive matches email addresses by ASCII case only
|
|
|
|
**Status:** accepted
|
|
**Context:** The own-address check of "Proton Drive roots trust in the
|
|
user's own addresses" ignored case, but the key lookup didn't, so a
|
|
server could name the user's address in capitals and serve its own keys
|
|
for it, at the root and below (Task 16 re-review 2).
|
|
**Decision:** One rule everywhere: emails are compared after lowercasing
|
|
ASCII letters only. An email matching one of the account's addresses
|
|
under it is verified with the account's own keys and never looked up on
|
|
the server, and other users' keys are cached under the same key. Unicode
|
|
case folding is not used, as it maps the Kelvin sign to k and the long s
|
|
to s, letting a non-ASCII address pass for an ASCII one.
|
|
**Alternatives:** Exact matching (an address the server stores in other
|
|
case would be looked up remotely); `strings.EqualFold` (Unicode folding).
|
|
**Consequences:** Two addresses differing only in non-ASCII case are
|
|
different addresses to rclone.
|
|
|
|
## 2026-11-11 - Proton Drive roots trust in the user's own addresses
|
|
|
|
**Status:** accepted
|
|
**Context:** "Proton Drive distrusts what a forged folder key vouches
|
|
for" and "Proton Drive refuses a file whose node key signature fails"
|
|
read as if every key were checked against keys rclone can trust. But
|
|
the keys of another user's email come from the server, so a server can
|
|
forge a share, root or node "signed" by a foreign address it vouches
|
|
for (Task 16 re-review).
|
|
**Decision:** Corrects those entries. The My Files share's creator and
|
|
the root folder's signer must be addresses whose keys the account
|
|
holds (compared ignoring case); otherwise the share or root key is
|
|
unverified, which makes the whole drive unreadable and unwritable
|
|
without `ignore_signature_errors`, and the error says why. Below the
|
|
root, nodes signed under another user's email are still verified
|
|
against server-supplied keys: a protocol limit Proton's SDK shares,
|
|
documented in spec section 7 and TODO.
|
|
**Alternatives:** Pinning other users' keys on first use (state rclone
|
|
doesn't keep); trusting server keys at the root too.
|
|
**Consequences:** A folder genuinely signed by an address since deleted
|
|
from the account, or whose keys no longer unlock, is unverified: writes
|
|
into it, and reads beneath it, need `ignore_signature_errors`.
|
|
|
|
## 2026-11-11 - Proton Drive won't vouch for a node it couldn't verify
|
|
|
|
**Status:** accepted
|
|
**Context:** Refusing writes into a folder with an unverified key left
|
|
the other direction open: moving or copying an anonymous node out of it
|
|
has rclone sign its server-made passphrase as the user's, after which it
|
|
and everything beneath it verified (Task 16 re-review). And a node made
|
|
under such a folder with `ignore_signature_errors` set was signed by the
|
|
user, so verified later, although whoever made the folder's key can
|
|
decrypt its passphrase.
|
|
**Decision:** Supersedes the inheritance rule of "Proton Drive distrusts
|
|
what a forged folder key vouches for": every node beneath a folder with
|
|
an unverified key is unverified, however it is signed, and so is a
|
|
folder rclone makes there. Moving, copying, directory-moving or
|
|
renaming a node whose key is unverified fails unless
|
|
`ignore_signature_errors` is set.
|
|
**Alternatives:** Inheriting only into anonymous nodes (leaves the
|
|
user-signed children of a forged folder trusted).
|
|
**Consequences:** A genuine folder whose key fails to verify, as one
|
|
signed by a since-deleted address, makes its whole subtree unreadable
|
|
and unwritable without `ignore_signature_errors`.
|
|
|
|
## 2026-11-11 - Proton Drive verifies the manifest before releasing a full read
|
|
|
|
**Status:** accepted
|
|
**Context:** A full read checked the manifest signature at EOF, as the
|
|
SDK does, so blocks swapped, truncated or from an older revision, each
|
|
matching its listed hash and recorded size, reached the reader before
|
|
the error: `rclone cat` and streaming mounts showed wrong bytes (spec
|
|
9.6 asks for "an integrity error, not data").
|
|
**Decision:** A full read lists every block page first, verifies the
|
|
manifest over the listed hashes, then fetches; each block is checked
|
|
against its listed hash, and a block listed again with another hash
|
|
is an integrity error. Pages are fetched one after another. Ranged
|
|
reads keep checking blocks against their listed hashes only.
|
|
**Alternatives:** Keeping the SDK's EOF check; verifying ranged reads
|
|
too by listing the whole file on each ranged open (costly for mounts
|
|
and multi-thread copies without a hash cache).
|
|
**Consequences:** No extra requests, but a file of more than 20 blocks
|
|
waits for its whole list before the first byte. Block metadata, not
|
|
data, is held meanwhile. A whole earlier revision served under the
|
|
current ID stays undetectable (protocol limit).
|
|
|
|
## 2026-11-11 - Proton Drive distrusts what a forged folder key vouches for
|
|
|
|
**Status:** accepted
|
|
**Context:** An anonymous node's passphrase, name and content signatures
|
|
are checked against its parent folder's key. A server can make a folder
|
|
key of its own, seal it to the real parent and sign everything beneath
|
|
it, so a refusal based only on each node's own signature check is
|
|
bypassed (Task 16 review).
|
|
**Decision:** A node key is unverified if its own passphrase signature
|
|
fails, or if it was checked against an unverified parent key; this
|
|
passes down the tree. Reading a file with an unverified key, and
|
|
creating, uploading, renaming, moving or copying into a folder with
|
|
one, fail unless `ignore_signature_errors` is set. Listing such a folder
|
|
still works, with one ERROR for the folder itself.
|
|
**Alternatives:** Leaving the folder's children to their own checks
|
|
(bypassable); refusing to list the folder (a sync would delete its
|
|
destination copy).
|
|
**Consequences:** Builds on the 2026-11-11 entry "Proton Drive refuses a
|
|
file whose node key signature fails". Files in a public-link upload
|
|
folder whose key fails to verify need `ignore_signature_errors`.
|
|
|
|
## 2026-11-11 - Proton Drive refuses a file whose node key signature fails
|
|
|
|
**Status:** accepted
|
|
**Context:** The node passphrase signature was only logged when it
|
|
failed, as the SDK does, so a server could seal a key of its own to
|
|
the parent folder's public key and serve any content under it (spec 7
|
|
puts the server in the threat model; 9.6 asks for an error).
|
|
**Decision:** Opening such a file fails with an integrity error naming
|
|
`ignore_signature_errors`, like a content key or manifest signature
|
|
failure; with the option set it is read, the failure logged once. The
|
|
node is still listed. Sign-in errors that need a reconnect name the
|
|
remote through a hint the seam gives the session, so read errors, which
|
|
don't pass through `translateError`, name it too.
|
|
**Alternatives:** Skipping the node from listings (a sync would then
|
|
delete its copy at the destination); leaving it to the SDK's behaviour.
|
|
**Consequences:** Legacy files whose keys were signed by a since-removed
|
|
address need `ignore_signature_errors`, which the error says.
|
|
|
|
## 2026-11-11 - Proton Drive backend runs on its own client
|
|
|
|
**Status:** accepted
|
|
**Context:** The backend sat on `rclone/Proton-API-Bridge` and
|
|
`rclone/go-proton-api`, which share credentials through package globals,
|
|
write files the official clients can't always read, and can't be tested
|
|
without a live account (spec 001).
|
|
**Decision:** `protondrive.go` was rewritten on the native client built in
|
|
plan Tasks 2-12, keeping every option name and meaning and reading v1.76
|
|
saved sessions without signing in again. `Config` offers browser sign-in
|
|
(default unless a username and password are already set, so existing
|
|
scripted setups keep using them) and password sign-in. An upload whose
|
|
commit outcome can't be known is a no-low-level-retry error: an immediate
|
|
retry could add a revision that already landed, while a later sync pass
|
|
reads the destination first.
|
|
**Alternatives:** Patching the bridge (globals and crypto stay outside the
|
|
tree); keeping browser sign-in the default even with a password set
|
|
(non-interactive `config create` would wait on a browser).
|
|
**Consequences:** The full contract suite runs hermetically against
|
|
`protontest`. Several `Fs` of one account in one process each cache
|
|
separately until events land (spec 6.2).
|
|
|
|
## 2026-11-11 - Fork agent tooling is appended, not merged, into upstream files
|
|
|
|
**Status:** accepted
|
|
**Context:** Upstream rclone already ships a maintainer-written `AGENTS.md`
|
|
and a `CLAUDE.md` that imports it. This fork tracks upstream and intends to
|
|
send work back, so every edit to an upstream file is a future merge conflict
|
|
and a risk of leaking fork-only material into an upstream PR.
|
|
**Decision:** Upstream's `AGENTS.md` text is kept verbatim. Fork rules are one
|
|
"Fork Workflow" section appended at the end. `CLAUDE.md` and `README.md` are
|
|
untouched. Fork-only docs live at the top of `docs/` (Hugo only builds
|
|
`docs/content/`, so they do not reach the website).
|
|
**Alternatives:** Restructuring `AGENTS.md` with the fork rules first (better
|
|
agent attention, permanent conflicts with upstream); a separate fork rules
|
|
file (two sources of truth).
|
|
**Consequences:** `AGENTS.md` sits at 148 of a 150 line budget - a new fork
|
|
rule must replace an old one. Upstream PR branches must be cut so they exclude
|
|
the paths listed in the Fork Workflow section.
|
|
|
|
## 2026-11-11 - Adopt AGENTS.md as single source of truth
|
|
|
|
**Status:** accepted
|
|
**Context:** Agents had no fork-specific workflow or permission config between
|
|
sessions.
|
|
**Decision:** `AGENTS.md` is canonical; `CLAUDE.md`/`GEMINI.md` are pointers.
|
|
Specs are permanent in `docs/specs/`. Plans live in `docs/plans/` only while
|
|
work is in progress and are removed before merge. Both override the
|
|
superpowers default paths.
|
|
**Alternatives:** Per-tool rule files (drift); no rules file (agents
|
|
re-explore the repo every session).
|
|
**Consequences:** Rule changes happen in one file; pointer files stay thin.
|
|
The spec, not the plan, is the record.
|