Files
rclone/docs/ARCHITECTURE.md
T
Lucas WintherandClaude Opus 5.5 5afbe9e4fa protondrive: run the wider suites against the fake server in fork CI
Add the TestProtonDriveFake init.d script, which builds and starts
protonfake on port 28642 and passes on the session it prints, and a
test_all entry for it, so fs/operations, fs/sync, vfs and cmd/bisync
run against the fake server. Five tests that need a second Fs of the
same account to see what the first wrote are ignored, as each Fs
caches separately, and cmd/gitannex is skipped as for every init.d
remote; both are in docs/TODO.md.

Add a Gitea Actions workflow that builds, vets, lints, race-tests,
fuzzes and vulnerability-checks the backend, and re-verify the agent
permission table on the host toolchain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 09:23:26 +01:00

3.5 KiB

Architecture

Fork-only orientation for agents. The summary in AGENTS.md ("Architecture") is upstream's and is not repeated here; this page adds what that summary leaves out. Update in the same commit as any structural change.

Map

Path Responsibility
rclone.go Entry point; blank-imports backend/all and cmd/all
backend/<name>/ One storage backend per package, registered in init()
cmd/<name>/ One cobra command per package
fs/ Core interfaces, config, operations, sync, accounting
vfs/ Virtual filesystem used by mount and serve
lib/ Shared helpers: rest, pacer, dircache, oauthutil, encoder
fstest/ Test framework: fstests (backend contract), test_all (runner)
docs/content/ Hugo website source; partly autogenerated
docs/specs/, docs/plans/ Fork-only agent workflow artefacts
bin/ Build and docs scripts

Test layers

  • Unit tests: RCLONE_CONFIG=/notfound go test ./... - no credentials.
  • Backend contract: each backend/<name>/<name>_test.go calls fstests.Run() against a remote named Test<Name>: in the user's rclone config. Without that remote the test skips, so a green go test on a backend package says nothing about the backend against the real service.
  • Integration: fstest/test_all runs the backend contract plus the fs/operations, fs/sync, vfs etc. suites against the backends listed in fstest/test_all/config.yaml.

Invariants

  • Backwards compatibility of commands, flags, config keys and the rc API.
  • fs and vfs contain no backend-specific code.
  • cgo use differs per release target (the cgo and build_flags columns of the matrix in .github/workflows/build.yml), so a backend cannot assume cgo.

backend/protondrive

A native client of the Proton Drive API, following Proton's Drive SDK (spec: docs/specs/001-protondrive-tier1.md).

File Responsibility
protondrive.go Fs, Object, options, Config sign-in, dircache glue, translateError
session.go SRP and browser (session fork) sign-in, token refresh, app version
account.go User and address keys, public-key lookups
crypto.go Every OpenPGP operation
nodes.go The client: volume bootstrap, pacing, listing, folder/rename/move/copy/trash
cache.go In-memory node and listing cache
upload.go, download.go Block pipelines
api/ Wire types
protontest/ Fake Proton server, imported by tests only; never imports the backend
  • The seam: protondrive.go holds no cryptography and no API routes; the other files never take or return fs.Fs/fs.Object.
  • No package-level mutable state except unlockMu (key unlocking is serialised across Fs instances). Each Fs has its own client, session and cache; credentials go through a per-Fs configStore over the remote's config.
  • fake_test.go runs the full fstests contract suite against protontest through the hidden endpoint option, on every go test; protondrive_test.go is the live suite (TestProtonDrive:).
  • fstest/testserver/init.d/TestProtonDriveFake builds and starts protontest/cmd/protonfake for test_all, which runs the wider suites against the TestProtonDriveFake: remote. Fork CI is .gitea/workflows/ci.yml.

Known rough edges

  • backend/protondrive tests still import github.com/rclone/go-proton-api for differential crypto tests, and go.mod still lists github.com/rclone/Proton-API-Bridge; both go in plan Task 19.
  • See docs/TODO.md for host tooling gaps.