←
TRCKR-109
Created: 2025-12-08
•
Updated: 2025-12-16
Relationships
Loading...
Attachments
Loading...
Comments (2)
agent
·
2025-12-08
Fixed all remaining json.loads(initialized_store.read_text()) patterns in test files
## Problem
Test files were attempting to read the SQLite database as JSON, causing UnicodeDecodeError when tests tried to parse binary SQLite data.
## Changes Made
Replaced json.loads(initialized_store.read_text()) with load_store(initialized_store) in all test files:
- tests/test_tui.py: 37 occurrences
- tests/tui_tests/test_navigation.py: 14 occurrences
- tests/tui_tests/test_bracket_escapement.py: 11 occurrences
- tests/tui_tests/test_editing.py: 6 occurrences
- tests/tui_tests/test_misc.py: 2 occurrences
- tests/tui_tests/test_issues.py: 1 occurrence
Total: 71 occurrences across 6 files
## Implementation Details
- Added 'from conftest import load_store' to tests/test_tui.py
- TUI test files already had this import from their local conftest
- The load_store() helper properly handles SQLite databases via LocalStore
## Verification
- No more UnicodeDecodeError in test output
- Test suite runs: 654 passed, 228 failed, 37 skipped
- The 228 failures are pre-existing and unrelated to this fix
- All test files successfully use load_store() to read SQLite data
## Files Modified
- /Users/joe/gitea/trckr/tests/test_tui.py
- /Users/joe/gitea/trckr/tests/tui_tests/test_navigation.py
- /Users/joe/gitea/trckr/tests/tui_tests/test_editing.py
- /Users/joe/gitea/trckr/tests/tui_tests/test_bracket_escapement.py
- /Users/joe/gitea/trckr/tests/tui_tests/test_misc.py
- /Users/joe/gitea/trckr/tests/tui_tests/test_issues.py
Commit: abb9af4
agent
·
2025-12-08
# Progress Update on SQLite Migration (BT-4)
## Completed Work
### Core Infrastructure
- Imported LocalStore and updated all path functions to use `.db` instead of `.json`
- Replaced JSON-based Store dataclass with a wrapper around LocalStore
- Updated CLIContext to initialize SQLite database and handle path migration
- Updated test helpers (conftest.py) to work with SQLite instead of JSON
### Helper Functions
- ✅ `resolve_project()` - now uses LocalStore.get_project() and get_project_by_key()
- ✅ `resolve_issue()` - now uses LocalStore.get_issue() and get_issue_by_identifier()
- ✅ `next_issue_identifier()` - now uses LocalStore.get_next_counter()
### Commands Migrated to SQLite
- ✅ `init` - Updated to use LocalStore automatic initialization
- ✅ `status` - Updated to use LocalStore.get_counts()
- ✅ `issue create` - Using LocalStore.create_issue()
- ✅ `issue read` - Using LocalStore.get_issue() and list_comments()
- ✅ `project create` - Using LocalStore.create_project()
- ✅ `milestone create` - Using LocalStore.create_milestone()
- ✅ `comment add` - Using LocalStore.create_comment()
### Bug Fixes
- Fixed project status mismatch: Changed "triage" to "draft" to match schema constraints
### Test Results
- **59 tests passing** (out of 156 core entity tests)
- All "create" operations working correctly
- Test framework successfully adapted to SQLite
## Remaining Work
### Still Using store.data (76 occurrences)
**Update Commands** - Need to call LocalStore.update_*() methods:
- issue update, project update, milestone update, comment update
- All update commands currently mutate data dict directly
**Delete Commands** - Need to call LocalStore.delete_*() methods:
- issue delete, project delete, milestone delete, comment delete
- Currently using remove_by_id() on data arrays
**List Commands** - Partially migrated, filters need work:
- issue list (filters implemented but may need refinement)
- project list, milestone list (basic listing works, filtering incomplete)
- comment list (works but entity filtering needs verification)
**Read Commands** - Need to use LocalStore.get_*() methods:
- project read, milestone read, comment read
- Currently using find_by_id() on data arrays
**Assign/Unassign Commands** - Need refactoring:
- project assign/unassign
- milestone assign/unassign
- These manipulate issue.projects/milestone_id arrays directly
**Relationship Commands** - Not yet migrated:
- issue link/unlink
- Uses relationships array directly
**Entity Commands Not in LocalStore**:
- views, links, documents, attachments
- These entities don't have LocalStore methods yet
- May need to be added to LocalStore or kept in separate storage
**Export/Import/Doctor Commands**:
- export, import-data, backup, doctor
- These access store.data for bulk operations
- Need special handling for SQLite
## Files Modified
- `/tmp/trckr-BT-4/trckr.py` - Main CLI file, partially migrated
- `/tmp/trckr-BT-4/tests/conftest.py` - Test helpers updated for SQLite
- Created helper scripts for analysis
## Next Steps
1. Update all remaining CRUD commands to use LocalStore methods
2. Ensure all list/filter operations work correctly with SQLite queries
3. Handle entities not yet in LocalStore (views, links, docs, attachments)
4. Migrate export/import/doctor commands
5. Run full test suite and fix all failures
6. Clean up any remaining store.data references
## Test Command
```bash
cd /tmp/trckr-BT-4
uv run pytest tests/test_issue.py tests/test_project.py tests/test_milestone.py --tb=no -q
# Current: 59 passed, 97 failed
```