Files
rclone/docs/plans/001-protondrive-tier1-workspace/task-19-report.md
T
2026-11-12 15:12:51 +01:00

7.7 KiB

Task 19 report: remove the old libraries

Status: DONE_WITH_CONCERNS (the one concern is a bisync test failure that was already there before this work; details below) Commit: cf7577dc1 protondrive: drop Proton-API-Bridge and go-proton-api (base b667a1ab0)

What was done

  • Moved these from crypto_diff_internal_test.go into the end of crypto_internal_test.go: oldLibDir, oldLibFixture, loadOldLibFixture, unlockedKeyRing, checkOldLibFixture and TestFrozenFixtures. TestFrozenFixtures no longer has its -update branch, and the updateOldLib flag is gone. Added the os and path/filepath imports. The oldLibDir comment now names the library versions.
  • TestFrozenFileFixture was already in download_internal_test.go and is unchanged.
  • Deleted crypto_diff_internal_test.go with git rm.
  • Ran go mod tidy. The result is within the ruling (details below).
  • Docs, all in the same commit:
    • docs/TODO.md:
      • Closed (removed) the entry "when go-proton-api and Proton-API-Bridge leave go.mod" and the entry "go mod tidy would drop Proton-API-Bridge".
      • Changed the crypto-refresh entry to say TestNewWriterOldReader was removed.
      • Added an entry for the lost coverage.
      • Updated the "Now" entry to Tasks 1-19 done.
      • Added a Known issues entry for the cmd/bisync failure.
    • docs/ARCHITECTURE.md: removed the "Known rough edges" bullet about the old libraries.
    • docs/DECISIONS.md: new entry "Proton Drive keeps frozen old-library fixtures, not the old library".
    • docs/plans/001-protondrive-tier1.md: ticked Task 19's steps.
    • The handoff's current-state bullets no longer list the differential file and no longer say the libraries are still in go.mod.
  • Left alone: .claude/settings.json has an uncommitted change (adds Bash(golangci-lint run:*) to allow) that I did not make. It is not in the commit, and I did not edit docs/PERMISSIONS.md for it.

go.mod / go.sum

The tidy only removed lines. Nothing was added, upgraded or downgraded, and there are no replace lines.

  • Direct requirements removed:
    • github.com/rclone/Proton-API-Bridge v1.0.5
    • github.com/rclone/go-proton-api v1.0.4
    • github.com/relvacode/iso8601 v1.7.0 (left go.mod entirely)
  • Indirect requirements removed:
    • ProtonMail/gluon
    • PuerkitoBio/goquery
    • andybalholm/cascadia
    • bradenaw/juniper
    • emersion/go-message
    • emersion/go-vcard
    • go-resty/resty/v2
    • sirupsen/logrus
  • go.mod: 11 deletions.
  • go.sum: 20 deletions, covering the modules above. logrus stays in go.sum because other modules' go.mod files refer to it.
  • grep -c 'Proton-API-Bridge\|rclone/go-proton-api\|replace' go.mod prints 0.

Binary size

Both binaries were built with plain go build -o <path> . and the same Go 1.27.4.

Build Bytes
Old: 06700aaf2 (old backend), built in a scratch worktree 152,460,576
New: cf7577dc1 content 148,995,400

The new binary is 3,465,176 bytes smaller (about 3.3 MiB). The saving comes from the backend rewrite as a whole. The libraries were already test-only before this task, so removing them does not change the binary.

Test coverage lost

These tests were deleted with the differential file:

  • TestNewWriterOldReader: the old library reads what the new writer writes.
  • TestOldWriterNewReader
  • TestKeyUnlockMatchesOldLibrary
  • TestUploadReadableByOldLibraryCrypto
  • TestOldLibraryFileReadable: legacy and v6 formats at 0 B, 2500 B and 5 MiB + 3 B.

What remains is TestFrozenFixtures (one folder and one file node) and TestFrozenFileFixture (legacy and v6 stored files). Both are single block.

Lost as a result:

  • Old-library files with several blocks.
  • Empty old-library files.
  • Any check that released rclone (v1.76 and older) can read what the new backend writes. This matters for users who downgrade.

All of this is logged in docs/TODO.md. The fixtures can no longer be regenerated.

Verification (all run in this session)

  • go build ./...: ok
  • go vet ./backend/protondrive/...: ok
  • golangci-lint run ./backend/protondrive/...: 0 issues. (re-run after the last doc edit too)
  • gofmt -l backend/protondrive: empty
  • RCLONE_CONFIG=/notfound go test -count=1 -run TestFrozen -v ./backend/protondrive/: TestFrozenFixtures and TestFrozenFileFixture pass.
  • RCLONE_CONFIG=/notfound go test -race -count=1 ./backend/protondrive/... (5m19s):
    • backend/protondrive: ok, 316s
    • protontest: ok, 39.5s
    • protontest/cmd/protonfake: ok, 1.4s
  • Cross-compile:
    • Command: mkdir build && go run bin/cross-compile.go -no-clean -compile-only v1.77.0-beta.task19. This is the Makefile compile_all command. BUILD_FLAGS, BUILDTAGS and BUILD_ARGS are empty here. I used -no-clean so the script would not run rm -rf build itself.
    • Result: "Compiled 29 arches in 10m33s", exit 0, no failures. These are all the OS/arch pairs in osarches: windows 386/amd64/arm64, darwin amd64/arm64, linux 386/amd64/arm/arm-v6/arm-v7/arm64/mips/mipsle, freebsd 386/amd64/arm/arm-v6/arm-v7, netbsd 386/amd64/arm/arm-v6/arm-v7, openbsd 386/amd64, plan9 386/amd64, solaris amd64, aix ppc64. js/wasm is commented out upstream.
    • Clean-up: removed build/ file by file with rm and then rmdir.
  • Whole repo: RCLONE_CONFIG=/notfound go test ./... (1m51s): 186 packages ok, 1 FAIL, cmd/bisync (TestRcBackupDir/backupDir1 and /backupDir2: "unable to find file .../backup/file0.txt").
    • It fails every time: 3 more package runs and -count=5 all failed.
    • It fails the same way on unchanged HEAD b667a1ab0 and on the pre-rewrite base 06700aaf2, both run in a scratch worktree that I removed afterwards. So it was already failing on this host before my change, or the host changed, and it is not a regression from this work. It only touches the local backend.
    • The baseline failure cmd/serve/s3 passed in this run.
    • Both facts are recorded under "Known issues" in docs/TODO.md.

Commands run (in order, abridged)

git worktree add <scratch>/rclone-old 06700aaf2 && (cd <scratch>/rclone-old && go build -o <scratch>/rclone-old-bin .)
stat -c %s <scratch>/rclone-old-bin                     # 152460576
python3 (move fixture code into crypto_internal_test.go); git rm backend/protondrive/crypto_diff_internal_test.go
go mod tidy
grep -c 'Proton-API-Bridge\|rclone/go-proton-api\|replace' go.mod   # 0
go build ./... && go vet ./backend/protondrive/... && go build -o <scratch>/rclone-new-bin . && stat -c %s ...   # 148995400
RCLONE_CONFIG=/notfound go test -count=1 -run TestFrozen -v ./backend/protondrive/
RCLONE_CONFIG=/notfound go test -race -count=1 ./backend/protondrive/...
golangci-lint run ./backend/protondrive/...
git worktree remove <scratch>/rclone-old
mkdir build && go run bin/cross-compile.go -no-clean -compile-only v1.77.0-beta.task19 ; rm build files ; rmdir build/*/ build
RCLONE_CONFIG=/notfound go test ./...
RCLONE_CONFIG=/notfound go test -count=1 ./cmd/bisync/   (x3, plus -count=5 -run TestRcBackupDir)
git worktree add --detach <scratch>/rclone-head HEAD ; bisync tests ; git checkout --detach 06700aaf2 (in worktree) ; bisync tests ; git worktree remove <scratch>/rclone-head

<scratch> = /tmp/claude-1000/-home-user-rclone/8cc17642-4f33-4045-ad2c-177bf869b82a/scratchpad

Self-review

  • The moved code is copied as it was. The only behaviour change is that TestFrozenFixtures has no -update branch.
  • Comment fields in the fixture JSON may still mention the old library. That is intended: they describe where the data came from.
  • No remaining references to the deleted tests outside the historical plan and workspace files.