Skip to content

fix: use global --header for Tigris consistency on all rclone transactions#564

Merged
phernandez merged 3 commits intomainfrom
fix/tigris-consistent-header-all-transactions
Feb 12, 2026
Merged

fix: use global --header for Tigris consistency on all rclone transactions#564
phernandez merged 3 commits intomainfrom
fix/tigris-consistent-header-all-transactions

Conversation

@phernandez
Copy link
Member

Summary

  • Bug: --header-download and --header-upload only apply to GET/PUT requests. rclone bisync starts with S3 ListObjectsV2 (neither download nor upload), so the Tigris consistency header was never sent on list requests. Non-US users saw stale edge-cached metadata and bisync reported "0 changes."
  • Fix: Replace with --header, rclone's global flag that applies to ALL HTTP transactions (list, download, upload). This is a superset of the previous two flags.
  • Updates test helper _assert_has_consistency_headers to match the new flag.

Test plan

  • just fast-check passes (lint, format, typecheck, impacted tests, smoke)
  • Full test suite (just test)

🤖 Generated with Claude Code

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

Claude finished @phernandez's task in 2m 50s —— View job


Code Review Complete ✅

I've completed a comprehensive review of PR #564 against the Basic Memory team checklist.

Summary

This PR fixes a critical bug where Tigris consistency headers weren't being sent on S3 list requests during rclone bisync, causing non-US users to see stale metadata. The fix replaces --header-download and --header-upload with the global --header flag that applies to ALL HTTP transactions.

Review Checklist

Code Quality & Standards ✅

  • Follows Basic Memory's coding conventions - Clean, well-documented code
  • Python 3.12+ type annotations - Not applicable (config changes only)
  • 100-character line length - All lines within limits
  • No commented-out code blocks - Clean implementation

Testing & Documentation ✅

  • Unit tests updated - _assert_has_consistency_headers properly updated in tests/test_rclone_commands.py:43-51
  • Test coverage for edge cases - All rclone commands tested (sync, bisync, check, ls)
  • 100% test coverage maintained - Changes are covered by existing test suite
  • Documentation updated - Excellent inline documentation in rclone_commands.py:30-34 explaining the rationale

Basic Memory Architecture ✅

  • Preserves local-first architecture - Only affects cloud sync behavior
  • Knowledge graph operations - Not applicable to this PR
  • Markdown file handling - Not applicable to this PR

Security & Performance ✅

  • No hardcoded secrets - Clean
  • Input validation - Existing validation preserved
  • Proper error handling - Existing error handling preserved
  • Performance considerations - Fix actually improves correctness without perf impact

Compatibility ✅

  • Windows compatibility - rclone commands are cross-platform
  • No emojis/unicode in console output - Clean

Issues Found

1. Missing CHANGELOG Entry for This PR ⚠️

Location: CHANGELOG.md

Issue: The CHANGELOG shows v0.18.2 with PR #562 and v0.18.1 with PR #558's original (incomplete) fix. This PR (#564) is the actual fix for the Tigris consistency issue, but there's no CHANGELOG entry for it.

Current CHANGELOG:

## v0.18.1 (2026-02-11)
...
### Bug Fixes
- **#558**: Add X-Tigris-Consistent headers to all rclone commands
  ([`8489a3d`](https://github.com/basicmachines-co/basic-memory/commit/8489a3d))
  - Ensures consistent reads from Tigris object storage during sync

Recommendation: Add a new entry for v0.18.3 or update v0.18.2 to include this PR:

## v0.18.3 (2026-02-12)

### Bug Fixes

- **#564**: Fix Tigris consistency headers for list operations
  ([`7fcf587`](https://github.com/basicmachines-co/basic-memory/commit/7fcf587))
  - Use global --header flag instead of --header-download/--header-upload
  - Fixes #558 which only applied headers to GET/PUT, missing S3 ListObjectsV2
  - Resolves "0 changes" bisync issue for non-US users with stale edge cache

Fix CHANGELOG →

2. Version Inconsistency

Locations:

  • src/basic_memory/__init__.py:4 - Version is "0.18.2"
  • server.json:9,14 - Version is "0.18.2"

Issue: If this is being released as v0.18.3 (or a patch to v0.18.2), the version numbers should be updated accordingly. However, this might be intentional if you're batching multiple fixes before the next release.

Recommendation: Clarify the release strategy. If this is v0.18.3, update version strings. If batching fixes, this is acceptable but should be noted.

Technical Analysis

Root Cause Correctly Identified ✅

The commit message and code comments perfectly explain the issue:

  • --header-download only applies to GET requests
  • --header-upload only applies to PUT requests
  • rclone bisync starts with S3 ListObjectsV2 (neither GET nor PUT)
  • Result: consistency header never sent → stale edge cache → "0 changes" reported

Solution is Correct ✅

Using --header is the right fix because:

  1. It's a superset of the previous flags (applies to ALL HTTP transactions)
  2. More robust - covers list, download, upload, and any future operations
  3. Simpler and more maintainable than multiple flag types

Test Coverage is Complete ✅

The test helper _assert_has_consistency_headers was properly updated and validates:

  • --header flag presence
  • Correct header value X-Tigris-Consistent: true
  • Applied to all rclone operations: sync, bisync, check, ls

Minor Observations

Excellent Documentation 🌟

The inline comments in rclone_commands.py:30-38 are exemplary:

  • Explains the "why" behind the fix
  • Documents the specific failure case (ListObjectsV2)
  • References external documentation
  • Follows the literate programming style from CLAUDE.md

Clean Test Refactor ✅

The test update simplified the assertion logic from checking two separate flags to one global flag, making tests more maintainable.

Verdict

APPROVE with minor CHANGELOG update needed

The code changes are excellent - correct fix, well-documented, properly tested. The only issue is the missing CHANGELOG entry for this PR, which should be added before merging to maintain accurate release notes.


Tasks:

  • Read all changed files
  • Verify bug fix correctness
  • Review against team checklist
  • Check test coverage
  • Provide comprehensive feedback

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

Claude finished @phernandez's task in 1m 27s —— View job


Code Review Complete ✅

I've reviewed the updated PR #564 and verified that the previous review feedback has been fully addressed.

Tasks:

  • Read all changed files
  • Verify previous review issues were addressed
  • Review against team checklist
  • Provide comprehensive feedback

Summary

This PR fixes a critical bug where Tigris consistency headers weren't being sent on S3 list operations during rclone bisync. The fix replaces --header-download and --header-upload with the global --header flag that applies to ALL HTTP transactions (list, download, upload).

Status: All previous review issues have been resolved. The CHANGELOG has been updated and versions bumped to 0.18.3.


Changes Since Last Review

The PR author has addressed both issues identified in the previous review:

  1. CHANGELOG Entry Added - New v0.18.3 section added with comprehensive description of the fix (CHANGELOG.md:3-12)
  2. Version Updated - All version strings updated to 0.18.3:
    • src/basic_memory/__init__.py:4"0.18.3"
    • server.json:9,14"0.18.3"

Basic Memory Team Checklist Review

Code Quality & Standards ✅

  • Follows Basic Memory's coding conventions - Clean, well-documented code with excellent literate programming style
  • Python 3.12+ type annotations - Not applicable (config/constants changes only)
  • SQLAlchemy 2.0 best practices - Not applicable
  • FastAPI and Typer conventions - Not applicable
  • 100-character line length limit maintained - All lines within limits
  • No commented-out code blocks - Clean implementation

Testing & Documentation ✅

  • Unit tests for new functions/methods - Not needed (constant change only)
  • Integration tests for new MCP tools - Not applicable
  • Test coverage for edge cases - Test helper _assert_has_consistency_headers properly updated (tests/test_rclone_commands.py:43-51)
  • 100% test coverage maintained - Changes are covered by existing test suite
  • Documentation updated - Excellent inline documentation explaining the fix (rclone_commands.py:30-38)
  • CLAUDE.md updated - Not needed (no convention changes)

Basic Memory Architecture ✅

  • MCP tools follow atomic, composable design - Not applicable
  • Database changes include Alembic migrations - Not applicable
  • Preserves local-first architecture - Only affects cloud sync behavior, local-first preserved
  • Knowledge graph operations maintain consistency - Not applicable
  • Markdown file handling preserves integrity - Not applicable
  • AI-human collaboration patterns followed - Yes, iterative review/fix cycle

Security & Performance ✅

  • No hardcoded secrets or credentials - Clean
  • Input validation for MCP tools - Not applicable
  • Proper error handling and logging - Existing error handling preserved
  • Performance considerations addressed - Fix improves correctness without performance impact

Compatibility ✅

  • File path comparisons must be windows compatible - Not applicable
  • Avoid using emojis and unicode characters in console and log output - Clean

Technical Analysis

Root Cause ✅

The bug analysis is correct and well-documented:

  • --header-download only applies to HTTP GET requests
  • --header-upload only applies to HTTP PUT requests
  • rclone bisync starts with S3 ListObjectsV2 (neither GET nor PUT)
  • Result: Tigris consistency header was never sent on list operations → stale edge cache → "0 changes" reported for non-US users

Solution Correctness ✅

The fix is appropriate:

  1. Global flag: --header applies to ALL HTTP transactions (list, download, upload)
  2. Superset behavior: More robust than the previous two-flag approach
  3. Simplified maintenance: Single flag is clearer than multiple operation-specific flags

Code Quality Highlights 🌟

Excellent documentation (rclone_commands.py:30-38):

# Tigris edge caching returns stale data for users outside the origin region (iad).
# --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/

This follows Basic Memory's literate programming style perfectly:

  • Explains the "why" (Tigris edge caching issue)
  • Documents the failure case (ListObjectsV2 missed by old flags)
  • Links to external documentation
  • Clear narrative flow

Test Coverage ✅

The test helper was properly refactored (tests/test_rclone_commands.py:43-51):

def _assert_has_consistency_headers(cmd: list[str]) -> None:
    """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"

All rclone operations are tested: sync, bisync, check, ls (tests pass on all 4 operations).

CHANGELOG Quality ✅

The new v0.18.3 entry (CHANGELOG.md:3-12) is comprehensive:

  • Clear description of the fix
  • Explains what the old flags did wrong
  • Documents the impact (fixes bisync for non-US users)
  • Links to the fixing commit

Verdict

✅ APPROVED - Ready to Merge

All code quality standards met, previous review issues resolved, and excellent documentation throughout. The fix is correct, well-tested, and properly documented.


phernandez and others added 3 commits February 12, 2026 15:42
…ansactions

--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 <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez phernandez force-pushed the fix/tigris-consistent-header-all-transactions branch from 9cd95e0 to a6c7188 Compare February 12, 2026 21:42
@phernandez phernandez merged commit b609c4e into main Feb 12, 2026
27 checks passed
@phernandez phernandez deleted the fix/tigris-consistent-header-all-transactions branch February 12, 2026 21:43
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

Claude finished @phernandez's task in 1m 40s —— View job


Code Review Complete ✅

I've performed a comprehensive review of PR #564 against the Basic Memory team checklist. This PR has already been reviewed twice and is MERGED.


Summary

This PR fixes a critical bug where Tigris consistency headers weren't being sent on S3 list operations during rclone bisync. The fix replaces --header-download and --header-upload with the global --header flag that applies to ALL HTTP transactions.

Bug: --header-download and --header-upload only apply to GET/PUT requests. rclone bisync starts with S3 ListObjectsV2 (neither download nor upload), so the Tigris consistency header was never sent on list requests, causing non-US users to see stale edge-cached metadata and "0 changes" bisync reports.

Fix: Use --header, rclone's global flag that applies to ALL HTTP transactions (list, download, upload).


Basic Memory Team Checklist Review

Code Quality & Standards ✅

  • Follows Basic Memory's coding conventions - Clean, well-documented code with excellent literate programming style

    • Outstanding documentation in rclone_commands.py:30-38 explaining the "why" behind the fix
    • Clear narrative flow in comments following CLAUDE.md guidelines
  • Python 3.12+ type annotations - N/A (constant/config changes only, no new functions)

  • SQLAlchemy 2.0 best practices - N/A

  • FastAPI and Typer conventions - N/A

  • 100-character line length limit - All lines within limits (checked all files)

  • No commented-out code blocks - Clean implementation

Testing & Documentation ✅

  • Unit tests for new functions/methods - N/A (constant change only, existing functions unchanged)

  • Integration tests for new MCP tools - N/A

  • Test coverage for edge cases - Test helper _assert_has_consistency_headers properly updated (tests/test_rclone_commands.py:43-51)

    • Tests verify --header flag presence and correct header value
    • Applied to all rclone operations: sync, bisync, check, ls
  • 100% test coverage maintained - Changes fully covered by existing test suite

    • All 4 rclone operations tested with the new flag structure
    • Test assertions updated to match the simpler global flag approach
  • Documentation updated - Exemplary inline documentation

    # Tigris edge caching returns stale data for users outside the origin region (iad).
    # --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/

    This follows the literate programming style perfectly by explaining:

    • The constraint (Tigris edge caching)
    • The trigger (ListObjectsV2 is neither download nor upload)
    • The outcome (global flag covers all transactions)
    • External reference for further reading
  • CHANGELOG updated - Comprehensive v0.18.3 entry added (CHANGELOG.md:3-12)

  • CLAUDE.md updated - N/A (no convention changes)

Basic Memory Architecture ✅

  • MCP tools follow atomic, composable design - N/A

  • Database changes include Alembic migrations - N/A

  • Preserves local-first architecture - Only affects cloud sync behavior, local-first principles preserved

  • Knowledge graph operations maintain consistency - N/A

  • Markdown file handling preserves integrity - N/A

  • AI-human collaboration patterns followed - Yes, iterative review/fix cycle demonstrated in PR comments

Security & Performance ✅

  • No hardcoded secrets or credentials - Clean

  • Input validation for MCP tools - N/A

  • Proper error handling and logging - Existing error handling preserved

  • Performance considerations - Fix improves correctness without performance impact

    • Global --header is more efficient than checking operation types
    • Single flag is simpler to maintain
  • No sensitive data in logs or commits - Clean

Compatibility ✅

  • File path comparisons must be windows compatible - N/A

  • Avoid emojis and unicode characters in console/log output - Clean (only in test plan markdown, not in code)


Technical Analysis

Root Cause Identification ✅

The bug analysis is spot-on and well-documented:

  1. Problem: --header-download only applies to HTTP GET requests, --header-upload only applies to HTTP PUT requests
  2. Trigger: rclone bisync starts with S3 ListObjectsV2 operation (neither GET nor PUT)
  3. Impact: Tigris consistency header X-Tigris-Consistent: true was never sent on list operations
  4. Result: Non-US users saw stale edge-cached metadata → bisync reported "0 changes"

Solution Correctness ✅

The fix is appropriate and optimal:

  1. Global flag: --header applies to ALL HTTP transactions (list, download, upload, and any future operations)
  2. Superset behavior: More robust than the previous two-flag approach
  3. Simplified maintenance: Single flag is clearer and less error-prone than multiple operation-specific flags
  4. Future-proof: Covers any HTTP operations rclone might perform, not just known ones

Code Quality Highlights 🌟

1. Exceptional Documentation (rclone_commands.py:30-38)

This is a textbook example of literate programming style from CLAUDE.md:

  • Explains the "why" (Tigris edge caching issue for non-US users)
  • Documents the specific failure case (ListObjectsV2 missed by old flags)
  • Links to external documentation for context
  • Clear narrative flow that tells the story

2. Clean Test Refactor (tests/test_rclone_commands.py:43-51)

The test helper was simplified from checking two separate flags to one global flag:

def _assert_has_consistency_headers(cmd: list[str]) -> None:
    """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"

This makes tests more maintainable and mirrors the simplification in production code.

3. Comprehensive Test Coverage

All rclone operations are verified with the consistency header:

  • test_project_sync_success (line 121)
  • test_project_bisync_success (line 201)
  • test_project_check_success (line 372)
  • test_project_ls_success (line 419)

Version Management ✅

All version strings correctly updated to 0.18.3:

  • src/basic_memory/__init__.py:4"0.18.3"
  • server.json:9,14"0.18.3"
  • CHANGELOG.md:3## v0.18.3 (2026-02-12)

CHANGELOG Quality ✅

The v0.18.3 entry is excellent:

  • Clear, technical description of the bug
  • Explains what the old flags did and why they failed
  • Documents the impact (fixes bisync for non-US users)
  • Links to the fixing commit
  • Proper formatting and structure

Previous Review Issues - All Resolved ✅

The PR author addressed both issues from the first review:

  1. CHANGELOG Entry - Added comprehensive v0.18.3 section
  2. Version Bump - Updated all version strings to 0.18.3

No Issues Found

This PR meets all Basic Memory quality standards. The code is:

  • ✅ Correct (fixes the root cause)
  • ✅ Well-tested (100% coverage maintained)
  • ✅ Well-documented (exemplary literate programming style)
  • ✅ Clean (no code smells or anti-patterns)
  • ✅ Future-proof (covers all HTTP operations, not just known ones)

Verdict

✅ APPROVED - Exemplary Quality

This PR demonstrates excellent software engineering practices:

  • Root cause analysis was thorough and correct
  • Solution is simple, robust, and future-proof
  • Documentation follows literate programming principles perfectly
  • Tests were properly updated and maintain 100% coverage
  • Version management was handled correctly
  • AI-human collaboration cycle worked smoothly

This is a textbook example of how to fix a production bug.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant