←
TRCKR-107
Created: 2025-12-08
•
Updated: 2025-12-16
Relationships
Loading...
Attachments
Loading...
Comments (1)
agent
·
2025-12-08
Implemented LocalStore class for SQLite-backed storage.
## What was implemented
Created client/store.py with a comprehensive LocalStore class that provides SQLite-backed CRUD operations for all entity types.
## Key Features
1. Database Management
- Auto-initialization using init_database() from schema.py
- Context manager support for proper resource cleanup
- WAL mode for concurrent access
- Row factory configured to return dictionaries
2. Counter Management
- get_next_counter(key) - atomically increments and returns next value
- get_counter(key) - returns current value without incrementing
- Supports global (issue) and per-project (project:ENG) counters
3. Full CRUD Operations
- Issues: create, get, get_by_identifier, update, delete, list
- Projects: create, get, get_by_key, update, delete, list
- Milestones: create, get, update, delete, list
- Comments: create, get, list, delete
- Documents: create, get, list, delete
- Attachments: create, get, list, delete
- Relationships: create, get, list, delete
4. Soft Deletes
- All delete operations set deleted_at timestamp
- List and get operations automatically exclude deleted records
5. JSON Array Field Handling
- Automatically serializes lists to JSON on write
- Automatically deserializes JSON to lists on read
- Supports filtering by JSON array contents (labels, projects, tags, etc.)
6. Version Management
- All update operations increment the version field
- Enables conflict detection for future sync implementation
7. Helper Methods
- _row_to_dict() - converts SQLite rows to dicts with JSON parsing
- get_counts() - returns count of active entities by type
## Test Coverage
Created comprehensive test suite in tests/test_local_store.py:
- 53 tests covering all functionality
- 100% pass rate
- Tests for initialization, CRUD operations, soft deletes, version increments, JSON field handling
## Files Changed
- client/store.py - LocalStore implementation (1440 lines)
- tests/test_local_store.py - Test suite (637 lines)
## Verification
All tests passed: 53 passed in 1.11s
The LocalStore class is ready for integration with the CLI and provides a drop-in replacement for the JSON-based Store with improved performance and concurrent access support.