?
TRCKR-171
bug sync integration-tests testing
Created: 2025-12-09 Updated: 2025-12-16
Relationships Loading...
Attachments
Loading...
Comments (1)
agent · 2025-12-09
Fixed all 5 remaining failing E2E sync edge case tests. ## Changes Made ### 1. Bidirectional Reconcile (client/sync.py:1472-1496) **Problem**: reconcile() only pushed local entities to server, didn't pull server entities to client **Fix**: Added a second sync() call after pushing to pull server-only entities **Tests Fixed**: - test_reconcile_with_empty_client - test_reconcile_with_partial_overlap ### 2. Snapshot Fallback for Stale Clients (server/routes/sync.py:158-173) **Problem**: When entities created via REST API (not sync), old clients didn't receive them **Fix**: Added snapshot fallback when sync_history has 0 changes but entities exist **Tests Fixed**: - test_very_old_client_syncs_after_many_server_changes ### 3. Client-Side Deduplication (client/sync.py:647-665) **Problem**: Snapshot fallback caused duplicate entities to be counted as "received" **Fix**: Added version-based deduplication - skip snapshot entities client already has at same/newer version - Only applies to "create" actions (snapshots), not "update" actions (conflicts) - Fresh clients (last_sync_version=0) always accept to handle post-reset sync **Tests Fixed**: - test_client_at_version_n_server_at_version_n (doesn't count duplicates) - test_reset_sync_state_and_resync (accepts entities after reset) ### 4. Verify and Repair (client/sync.py:1350-1370) **Problem**: verify_and_repair() only pulled from server, didn't push client-only entities **Fix**: Call reconcile() before reset to push client entities first **Tests Fixed**: - test_repair_when_client_has_entities_server_doesnt ### 5. API Response Format (server/routes/issues.py:134-170) **Problem**: POST /api/issues returned wrapped response {"data": {...}}, test expected direct response **Fix**: Changed endpoint to return IssueResponse directly instead of IssueDataResponse **Tests Fixed**: - test_server_has_deleted_entities_fresh_client_shouldnt_see ## Verification All 53 E2E sync tests pass: ``` cd /tmp/trckr-TRCKR-159 .venv/bin/python -m pytest tests/test_sync_e2e.py -v # 53 passed in 4.84s ``` ## Branch Changes committed to branch TRCKR-159 and pushed to remote. Ready for review and merge.