From 0eae0e1678fb2cb844ae08ef8a026ce811d49501 Mon Sep 17 00:00:00 2001 From: phernandez Date: Thu, 12 Feb 2026 13:34:30 -0600 Subject: [PATCH] fix: use global --header flag for Tigris consistency on all rclone transactions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --header-download and --header-upload only apply to GET and PUT requests. bisync starts by listing files via S3 ListObjectsV2 — neither a download nor upload — so the consistency header was never sent on list requests. Non-US users saw stale edge-cached metadata and bisync reported "0 changes." --header is rclone's global flag that applies to ALL HTTP transactions (list, download, upload), which is a superset of the previous two flags. Co-Authored-By: Claude Opus 4.6 Signed-off-by: phernandez --- .../cli/commands/cloud/rclone_commands.py | 8 +++++--- tests/test_rclone_commands.py | 17 ++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/basic_memory/cli/commands/cloud/rclone_commands.py b/src/basic_memory/cli/commands/cloud/rclone_commands.py index 432d2043..c5671662 100644 --- a/src/basic_memory/cli/commands/cloud/rclone_commands.py +++ b/src/basic_memory/cli/commands/cloud/rclone_commands.py @@ -28,11 +28,13 @@ console = Console() MIN_RCLONE_VERSION_EMPTY_DIRS = (1, 64, 0) # Tigris edge caching returns stale data for users outside the origin region (iad). -# These headers bypass edge cache and force reads/writes against the origin. +# --header is rclone's global flag that applies to ALL HTTP transactions (list, download, +# upload). This is critical because bisync starts with S3 ListObjectsV2, which is neither +# a download nor upload — so --header-download/--header-upload would miss list requests. # See: https://www.tigrisdata.com/docs/objects/consistency/ TIGRIS_CONSISTENCY_HEADERS = [ - "--header-download", "X-Tigris-Consistent: true", - "--header-upload", "X-Tigris-Consistent: true", + "--header", + "X-Tigris-Consistent: true", ] diff --git a/tests/test_rclone_commands.py b/tests/test_rclone_commands.py index f07bbe25..401471b4 100644 --- a/tests/test_rclone_commands.py +++ b/tests/test_rclone_commands.py @@ -41,15 +41,14 @@ class _Runner: def _assert_has_consistency_headers(cmd: list[str]) -> None: - """Assert the rclone command includes Tigris consistency headers.""" - assert "--header-download" in cmd - assert "X-Tigris-Consistent: true" in cmd - assert "--header-upload" in cmd - # Verify upload header value follows --header-upload - upload_idx = cmd.index("--header-upload") - assert cmd[upload_idx + 1] == "X-Tigris-Consistent: true" - download_idx = cmd.index("--header-download") - assert cmd[download_idx + 1] == "X-Tigris-Consistent: true" + """Assert the rclone command includes Tigris consistency headers. + + Uses --header (global flag) so the header applies to ALL HTTP transactions, + including S3 list requests that bisync issues before any download/upload. + """ + assert "--header" in cmd + header_idx = cmd.index("--header") + assert cmd[header_idx + 1] == "X-Tigris-Consistent: true" def _write_filter_file(tmp_path: Path) -> Path: