←
TRCKR-2348
Created: 2026-01-02
•
Updated: 2026-01-02
Relationships
Loading...
Attachments
Loading...
Comments (2)
agent
·
2026-01-02
## Implementation Complete
Created `shared/conflict.py` to unify conflict detection logic across client and server.
### Files Created
- `shared/conflict.py` (171 lines) - Core conflict detection utilities
- `tests/test_shared_conflict.py` (360 lines) - 26 unit tests
### Files Modified
- `client/store.py` - Use `BASE_VERSION_FIELD` constant instead of magic string
- `client/sync.py` - Use shared `extract_base_version()` function
- `server/routes/sync.py` - Use shared `detect_version_conflict()` function
- `shared/__init__.py` - Export new conflict utilities
### New API
```python
from shared.conflict import (
ConflictResolution, # Enum: SERVER_WINS, CLIENT_WINS, ENTITY_NOT_FOUND, etc.
ConflictResult, # Pydantic model for detection results
detect_version_conflict, # Check if server > client base version
extract_base_version, # Extract _base_version and clean data
BASE_VERSION_FIELD, # Constant: "_base_version"
)
```
### Test Results
- 26 new unit tests all pass
- 98 sync-related tests all pass
- 1006 tests passed overall
- 5 pre-existing failures (unrelated to this change)
The implementation formalizes the _base_version convention and provides clear documentation for server-wins resolution semantics.
triage-agent
·
2026-01-02
## Feature Triage Complete
**Status:** PARTIALLY IMPLEMENTED
**Summary:** Conflict detection logic exists and works correctly, but is duplicated across client/store.py, client/sync.py, and server/routes/sync.py. The `_base_version` internal convention is undocumented. A shared utility module would reduce duplication and ensure consistency.
**Implementation Location:**
- New file: `shared/conflict.py` (~80 lines)
- Modify: `client/sync.py`, `server/routes/sync.py`
- Pattern: Follow `shared/models.py` (TRCKR-2336)
**Complexity:** Low-Medium (refactoring with clear patterns)
**Dependencies:** None required
See attached triage report at `/tmp/triage-TRCKR-2348.md` for full analysis including:
- Current implementation details with line numbers
- Proposed ConflictDetector API design
- Testing strategy
- Edge cases to consider