←
TRCKR-386
Created: 2025-12-16
•
Updated: 2025-12-16
Relationships
Loading...
Attachments
Loading...
Comments (7)
qa-agent
·
2025-12-16
## QA PASSED
See QA report document: 2bf3de85-512d-4763-aa40-133f152d8a93
**Summary:** The TRCKR-382 fix is working correctly. Documents now sync to the server and appear in the web UI.
**Root cause of initial failure:** Stale CLI installation prevented doctor command from detecting missing sync_log entries.
**Workflow verified:**
1. ✅ `trckr doctor` detects entities missing sync_log entries
2. ✅ `trckr doctor --fix` backfills 877 missing entries (including 8 documents)
3. ✅ `trckr sync` pushes documents to server
4. ✅ Web UI displays all 8 documents at https://trckr.roboalch.com/web/documents
**Evidence:**
- Screenshot: /tmp/TRCKR-157-documents-visible.png (note: filename has wrong issue number but content is correct)
- All 8 documents visible including the TRCKR-386 Triage Report referenced in the original issue
No regressions detected. Fix approved.
qa-agent
·
2025-12-16
## QA FAILED - Doctor Command Not Working
See QA report document: 36c8a8c7-6486-4fbc-a3a1-ef3ab1d473f0
**Summary:** The fix in TRCKR-382 is NOT working. The `trckr doctor --fix` command does not create sync_log entries for documents.
**Evidence:**
- Local database has 7 documents but 0 sync_log entries for documents
- Production server shows 0 documents despite successful sync
- Running `trckr doctor` does not detect missing sync_log entries
- The code exists at lines 3096-3141 but is not executing
**Root cause:** The doctor command is not running the sync_log backfill code. Either:
1. The trckr installation is using old code (not reinstalled after changes)
2. There's a bug in the detection logic preventing execution
3. The code path is different than expected
**Required actions:**
1. Verify trckr installation: Run `make install` to ensure latest code is active
2. Add debug logging to trace doctor execution
3. Fix the detection/backfill logic
4. Re-test full workflow
Returning to todo for fixes.
agent
·
2025-12-16
## Fix Implementation Complete
Added sync_log backfill functionality to the `trckr doctor` command. This addresses the root cause of documents not appearing in the web UI - entities created before TRCKR-382 lack sync_log entries needed for server sync.
### Changes Made
**trckr.py (lines 3096-3141):**
- Added detection of entities missing sync_log create entries
- Checks all syncable entity types: issues, projects, milestones, comments, documents, relationships
- Reports count of entities missing entries (truncates to first 10 for readability)
- With `--fix` flag, creates sync_log entries for all entities without them
**tests/test_global.py:**
- Added `test_doctor_detects_missing_sync_log_entries` - verifies detection
- Added `test_doctor_fix_missing_sync_log_entries` - verifies backfill creates entries
### Verification
- All 961 tests pass
- `trckr doctor` on production data correctly shows 876 entities missing sync_log entries
- Deployed to trckr.roboalch.com
### Usage
To fix documents not syncing to the server:
1. Resolve existing sync conflicts: `trckr sync conflicts --resolve`
2. Add sync_log entries for existing entities: `trckr doctor --fix`
3. Trigger sync: `trckr sync`
Documents should then appear in the web UI after sync.
### Root Cause Analysis
The documents existed in SQLite (verified via `trckr doc list` showing 7 documents) but:
- The `sync_log` table had 0 entries for documents
- Without sync_log entries, entities never get pushed to the server
- TRCKR-382 added sync logging to document CRUD, but existing documents were not backfilled
This fix adds the backfill mechanism to doctor --fix.
qa-agent
·
2025-12-16
## QA FAILED - DATA MIGRATION ISSUE
See QA report document: a15ddd7a-2adb-4364-bd07-2f78ef8826de
**Summary:** The TRCKR-382 code implementation is CORRECT and works perfectly. The web interface displays documents when they exist in the database. However, documents are not syncing because:
1. **Existing documents have no sync_log entries** (created before TRCKR-382 added sync logging)
2. **Client database shows 0 documents** despite `trckr doc list` showing 5 (migration issue?)
3. **225 sync conflicts** blocking sync operations
**Verified working:**
- Server document handlers (create/update/delete)
- Documents included in snapshots
- Web interface displays documents correctly
- Client sync logging for new documents
**What needs fixing:**
- Backfill sync_log entries for pre-existing documents
- Complete JSON to SQLite migration for documents
- Resolve sync conflicts or provide mechanism to handle them
**Evidence:**
- /tmp/TRCKR-386-no-documents.png (before: 0 documents)
- /tmp/TRCKR-386-document-visible.png (after manual DB insert: 1 document shown)
**Recommendation:** This is a data migration issue, not a code bug. Create separate issue for backfilling sync_log entries for documents created before TRCKR-382.
Returning to todo - requires data migration work.
agent
·
2025-12-16
## Implementation Complete
Added full document sync support to trckr. Changes:
### Client Store (client/store.py)
- Added _log_sync_change() calls to create_document(), update_document(), and delete_document() methods
- Document operations now record sync log entries with proper versioning for conflict detection
- Added optional id parameter to create_document() for receiving documents from server sync
### Server Sync (server/routes/sync.py)
- Added _apply_create() handler for document entities
- Added _apply_update() handler for document entities
- Added _apply_delete() handler for document entities
- Added _get_entity() lookup for documents
- Added documents to _build_full_snapshot() for fresh client sync
- Added documents to create_snapshot() with entity counts
- Added documents to sync_status() and sync_verify() endpoints
- Added "documents" -> "document" mapping in plural_to_singular dicts
### Client Sync (client/sync.py)
- Added documents to _compute_local_checksums() for sync verification
### Tests
- Added TestDocumentSyncLog class with 4 tests covering create/update/delete operations
- Updated test_snapshot_e2e.py to expect documents in entity counts
### Verification
- All 1275 tests pass
- Document CRUD operations now properly sync between client and server
- Sync verification includes document checksums
agent
·
2025-12-16
Agent assigned. Work in progress in worktree: /tmp/trckr-TRCKR-386
triage-agent
·
2025-12-16
## Bug Triage Complete
**Reproduction:** CONFIRMED
**Summary:** Documents and attachments are NOT supported by the sync protocol. The server-side sync implementation in `/server/routes/sync.py` only handles issues, projects, milestones, comments, and relationships. Documents are:
1. Not logged to sync_log on the client side (CRUD operations skip `_log_sync_change()`)
2. Not processed by server sync endpoints (`_apply_create/update/delete` have no document cases)
3. Not included in snapshots (`_build_full_snapshot()` and `create_snapshot()` skip documents)
**Evidence:**
- Server database: 0 documents
- Local database: 1 document (others exist as files but no DB records)
- Screenshot: /tmp/TRCKR-386-documents-page.png
**TDD Approach:**
1. Add `_log_sync_change()` to client document CRUD operations
2. Add document handling to server sync processing functions
3. Include documents in snapshot generation
4. (Future) Design file content sync strategy
**Complexity:** High - requires coordinated client+server changes plus file sync strategy decision.
See attached triage report (doc 61954ea0-fb71-42ee-93c3-7508ac5eaf47) for full details.