?
TRCKR-2337
refactor shared-logic feature
Created: 2026-01-02 Updated: 2026-01-02
Relationships Loading...
Attachments
Loading...
Comments (2)
agent · 2026-01-02
## Implementation Complete Created `shared/identifiers.py` with unified identifier utilities: ### New Functions - `next_issue_identifier(store, project_id, fill_gaps)` - Generates TRCKR-N or PROJECT-N identifiers - `generate_project_key(name, existing_keys)` - Creates unique project keys from names - `validate_identifier(identifier)` - Validates identifier format - `parse_identifier(identifier)` - Parses identifier into (prefix, number) tuple - `validate_project_key(key)` - Validates project key format - `get_existing_identifier_numbers(store, prefix)` - Gets used numbers for a prefix - `find_lowest_available(existing)` - Finds lowest available number (gap-filling) ### Files Modified - `shared/identifiers.py` - New file with shared utilities (273 lines) - `shared/__init__.py` - Updated exports - `trckr.py` - CLI now delegates to shared module with fill_gaps=True - `server/routes/issues.py` - Uses shared with fill_gaps=False - `server/routes/projects.py` - Uses shared generate_project_key - `server/routes/sync.py` - Uses shared with fill_gaps=True - `server/routes/web.py` - Uses shared with fill_gaps=False ### Tests - Added `tests/test_identifiers.py` with 33 comprehensive unit tests - All existing tests continue to pass (148 CLI tests, 116 server tests) ### Design Decisions - Added `fill_gaps` parameter to control gap-filling behavior: - CLI and sync endpoints use fill_gaps=True (find lowest available) - API and web endpoints use fill_gaps=False (sequential counters) - Used Protocol pattern (`IdentifierStore`) for store interface abstraction - Maintained backward compatibility with existing wrapper functions
triage-agent · 2026-01-02
## Feature Triage Complete **Status:** NOT IMPLEMENTED - Shared identifier utilities do not exist yet **Summary:** - Identifier generation logic is duplicated across 5 files (trckr.py, sync.py, projects.py, issues.py, web.py) - Inconsistencies exist between implementations (gap-filling behavior differs) - The shared/ package exists and is the natural home for this refactoring **Implementation Location:** - New file: shared/identifiers.py - 8 files need modification to use shared utilities - TUI currently imports directly from trckr.py **Complexity:** Low-Medium - Mechanical extraction with some abstraction decisions **Key Decisions Needed:** 1. Should all implementations fill gaps (find lowest available number)? 2. Add identifier validation utilities? 3. Address thread safety for concurrent identifier generation? See attached triage report document for full analysis.