Skip to content

fix(sync): account for modified files in sync total work and fix telemetry test retention date - #122

Open
markusbrand wants to merge 1 commit into
masterfrom
fix/sync-progress-total-work-calculation
Open

markusbrand wants to merge 1 commit into
masterfrom
fix/sync-progress-total-work-calculation

Conversation

@markusbrand

Copy link
Copy Markdown
Owner

Summary

  1. Accurate Sync Progress Accounting for Modified Files:

    • In client-tauri/src-tauri/src/sync.rs, total_work was previously computed using path set differences (current_remote \ current_local and current_local \ current_remote) before planning to_download and to_upload.
    • Because modified existing files are present in both local and remote path sets, they were excluded from the set differences. This caused total_work to evaluate to 0 when only existing files were modified (suppressing the progress bar entirely in Settings.tsx), or severely undercounting total work (causing done to exceed total_work, reporting progress percentages well over 100% like upload 3 / 1).
    • Moved transfer planning (to_download and to_upload) upfront before executing deletions.
    • Accurately calculated total_work as (to_del_remote.len() + to_del_local.len() + to_download.len() + to_upload.len()) as u64.
    • Logged the complete sync plan upfront before starting any mutations.
    • Added unit tests in sync.rs verifying total_work accounting with modified files.
  2. Telemetry Test Retention Cutoff Time-Bomb Fix:

    • In backend/tests/test_telemetry.py:167, test_telemetry_api_routes hardcoded a fixed date 2026-09-16T21:00:00Z.
    • Because server_events_retention_days = 30, any telemetry summary older than 30 days is automatically purged on ingest by prune_telemetry_records. More than 30 days having elapsed since September 16, 2026 caused the test record to be pruned immediately on ingest, failing subsequent assertions.
    • Updated test_telemetry_api_routes to use dynamic timestamps relative to now.
  3. OpenSpec Change Tracking:

    • Tracked with OpenSpec change fix-sync-progress-total-work-calculation including proposal, delta spec for desktop-client, design doc, and completed tasks.

Verification

  • cd client-tauri/src-tauri && cargo test -> 23 passed, 0 failed.
  • cd web && npm run build -> successful production build.
  • .venv/bin/python -m pytest backend -q -> 108 passed, 0 failed.
  • ./scripts/run-qa.sh -> all QA checks passed cleanly.

…metry test retention date

- Construct download and upload transfer plans before deletion execution in sync.rs.
- Calculate total_work accurately as the sum of all planned operations (server deletions, local deletions, downloads, and uploads) rather than using set differences that omit modified existing files.
- Log the complete sync plan upfront before starting mutations.
- Add regression unit tests verifying total_work includes modified files and calculates accurately in mixed scenarios.
- Use dynamic timestamps in backend test_telemetry_api_routes to prevent retention pruning (>30 days) failure.
- Add OpenSpec change artifacts for fix-sync-progress-total-work-calculation.
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