Bug Description
The "Add Index" functionality in the Golden Repos admin UI only offers "Semantic + FTS" as a combined option. Users cannot add Semantic or FTS indexes independently. When a repo already has FTS (but not Semantic), selecting "Semantic + FTS" errors because FTS already exists.
Environment
- Version: $(git describe --tags --always 2>/dev/null || echo "current")
- OS: Linux
- Component: CIDX Server Web UI - Golden Repos management page
- Discovered In: stepscommand repo (has FTS only, needed to add Semantic)
Steps to Reproduce
- Have a golden repo with FTS index only (no Semantic) - e.g., stepscommand repo
- Navigate to Golden Repos admin page
- Click "Details" to expand the repo
- Click "Add Index" button
- Observe: Only "Semantic + FTS" option is available (no "Semantic only" option)
- Select "Semantic + FTS" and click Submit
- Error occurs because FTS already exists
Expected Behavior
- Should be able to add Semantic, FTS, Temporal, and SCIP indexes independently
- Should be able to rebuild/recreate existing indexes
- Should be able to select multiple indexes to create at once
- Confirmation dialog should warn differently when rebuilding vs creating new
Actual Behavior
- Only combined "Semantic + FTS" option exists
- Cannot add Semantic alone when FTS exists
- Cannot rebuild existing indexes (blocked by _index_exists() check)
- No granular control over individual index types
Error Messages / Logs
ValueError: Index type 'semantic_fts' already exists for golden repo 'stepscommand'
(Error occurs in golden_repo_manager.py line 1806-1808 when FTS exists but Semantic doesn't)
Impact Assessment
Severity: High - Blocks core admin workflow
Affected Users: All admins managing golden repositories
Frequency: Every time user needs to add a single index type when partial indexes exist
Workaround: None - cannot add missing index independently through UI
Root Cause Analysis
UI Layer (golden_repos_list.html:178-181)
{% if not (repo.has_semantic and repo.has_fts) %}
<option value="semantic_fts">Semantic + FTS</option>
{% endif %}
Only offers combined option, no individual Semantic or FTS choices.
Backend Layer (golden_repo_manager.py)
- Valid types restricted (line 1797):
valid_index_types = ["semantic_fts", "temporal", "scip"]
- Existence check blocks rebuild (line 1805-1808):
if self._index_exists(golden_repo, index_type):
raise ValueError(f"Index type '{index_type}' already exists...")
-
_index_exists() uses AND logic (line 1927-1946):
Returns True only when BOTH semantic AND FTS exist, but error is thrown when either exists during creation.
-
Combined creation (line 1824-1825):
if index_type == "semantic_fts":
command = ["cidx", "index", "--fts"] # Creates BOTH indexes
Affected Files
src/code_indexer/server/web/templates/partials/golden_repos_list.html - UI dropdown
src/code_indexer/server/web/static/js/golden_repo_indexes.js - JS submission logic
src/code_indexer/server/repositories/golden_repo_manager.py - Backend validation and creation
src/code_indexer/server/app.py - AddIndexRequest model, valid_index_types validation
Fix Implementation
Changes Required
1. Backend (golden_repo_manager.py)
2. API (app.py)
3. UI (golden_repos_list.html)
4. JavaScript (golden_repo_indexes.js)
Testing Required
Implementation Status
Completion: 0/6 tasks complete (0%)
Verification Evidence
[To be added after fix]
Reported By: Claude Code
Assigned To: [Unassigned]
Found In: current master branch
Fixed In: [To be updated]
Bug Description
The "Add Index" functionality in the Golden Repos admin UI only offers "Semantic + FTS" as a combined option. Users cannot add Semantic or FTS indexes independently. When a repo already has FTS (but not Semantic), selecting "Semantic + FTS" errors because FTS already exists.
Environment
Steps to Reproduce
Expected Behavior
Actual Behavior
Error Messages / Logs
(Error occurs in golden_repo_manager.py line 1806-1808 when FTS exists but Semantic doesn't)
Impact Assessment
Severity: High - Blocks core admin workflow
Affected Users: All admins managing golden repositories
Frequency: Every time user needs to add a single index type when partial indexes exist
Workaround: None - cannot add missing index independently through UI
Root Cause Analysis
UI Layer (golden_repos_list.html:178-181)
{% if not (repo.has_semantic and repo.has_fts) %} <option value="semantic_fts">Semantic + FTS</option> {% endif %}Only offers combined option, no individual Semantic or FTS choices.
Backend Layer (golden_repo_manager.py)
_index_exists() uses AND logic (line 1927-1946):
Returns True only when BOTH semantic AND FTS exist, but error is thrown when either exists during creation.
Combined creation (line 1824-1825):
Affected Files
src/code_indexer/server/web/templates/partials/golden_repos_list.html- UI dropdownsrc/code_indexer/server/web/static/js/golden_repo_indexes.js- JS submission logicsrc/code_indexer/server/repositories/golden_repo_manager.py- Backend validation and creationsrc/code_indexer/server/app.py- AddIndexRequest model, valid_index_types validationFix Implementation
Changes Required
1. Backend (golden_repo_manager.py)
["semantic", "fts", "temporal", "scip"]semantic_ftscombined type entirely (no backwards compatibility)semantic->cidx index(no --fts flag)fts->cidx index --rebuild-fts-indextemporal->cidx index --index-commits ...scip->cidx scip generate_index_exists()blocker - allow rebuilding2. API (app.py)
index_types: List[str]3. UI (golden_repos_list.html)
4. JavaScript (golden_repo_indexes.js)
{ index_types: [...] }Testing Required
Implementation Status
Completion: 0/6 tasks complete (0%)
Verification Evidence
[To be added after fix]
Reported By: Claude Code
Assigned To: [Unassigned]
Found In: current master branch
Fixed In: [To be updated]