|
| 1 | +# SmartRAG TODO List |
| 2 | + |
| 3 | +## 🚀 High Priority |
| 4 | + |
| 5 | +### Parametreli Sorgu Sistemi (Parameterized Query System) |
| 6 | +**Branch:** `feature/parameterized-queries` |
| 7 | + |
| 8 | +**Neden gerekli:** |
| 9 | +- SQL Injection koruması (güvenlik) |
| 10 | +- Query plan caching (performans) |
| 11 | +- Tip güvenliği (type safety) |
| 12 | +- Production-ready özellik |
| 13 | + |
| 14 | +**Şu anki durum:** |
| 15 | +- ✅ AI literal values kullanıyor (çalışıyor ama ideal değil) |
| 16 | +- ✅ @param, :param, ? syntax yasaklandı (geçici çözüm) |
| 17 | +- ✅ Test success rate: %72.7 |
| 18 | + |
| 19 | +**Implementation Plan:** |
| 20 | + |
| 21 | +1. **Model Class Oluştur** |
| 22 | + ```csharp |
| 23 | + public class SqlQueryWithParameters |
| 24 | + { |
| 25 | + public string Sql { get; set; } |
| 26 | + public Dictionary<string, object> Parameters { get; set; } |
| 27 | + } |
| 28 | + ``` |
| 29 | + |
| 30 | +2. **AI Prompt Değiştir** |
| 31 | + - AI JSON output üretsin: `{"sql": "...", "parameters": {...}}` |
| 32 | + - Örnek: `{"sql": "SELECT * FROM Orders WHERE CustomerID = @p1", "parameters": {"@p1": 5}}` |
| 33 | + |
| 34 | +3. **DatabaseParserService Güncelle** |
| 35 | + - `ExecuteQueryAsync` metodu parametre desteği alsın |
| 36 | + - Her database türü için parametre ekleme: |
| 37 | + - SQL Server: `@p1, @p2` |
| 38 | + - PostgreSQL: `$1, $2` |
| 39 | + - MySQL: `?, ?` |
| 40 | + - SQLite: `?, ?` |
| 41 | + |
| 42 | +4. **MultiDatabaseQueryCoordinator Güncelle** |
| 43 | + - `GenerateDatabaseQueriesAsync`: JSON parse et |
| 44 | + - Parametreleri AI'dan al |
| 45 | + - `ExecuteSingleDatabaseQueryAsync`: Parametreleri geç |
| 46 | + |
| 47 | +5. **Test Et** |
| 48 | + - Cross-database queries |
| 49 | + - Parametre formatları (string, int, decimal, date) |
| 50 | + - Başarı oranını koru (%70+) |
| 51 | + |
| 52 | +**Dosyalar:** |
| 53 | +- `src/SmartRAG/Models/SqlQueryWithParameters.cs` (yeni) |
| 54 | +- `src/SmartRAG/Services/MultiDatabaseQueryCoordinator.cs` (değişecek) |
| 55 | +- `src/SmartRAG/Services/DatabaseParserService.cs` (değişecek) |
| 56 | +- `src/SmartRAG/Interfaces/IDatabaseParserService.cs` (değişecek) |
| 57 | + |
| 58 | +**Risk:** |
| 59 | +- AI JSON üretimi başarısız olabilir |
| 60 | +- Başarı oranı düşebilir |
| 61 | +- Breaking change (major version) |
| 62 | + |
| 63 | +**Süre Tahmini:** 2-3 saat |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## 🛠️ Code Quality |
| 68 | + |
| 69 | +### SOLID/DRY Refactoring - MultiDatabaseQueryCoordinator |
| 70 | +**Issue:** `MultiDatabaseQueryCoordinator.cs` çok büyük (2346 satır) - God Class anti-pattern |
| 71 | + |
| 72 | +**Refactoring Plan:** |
| 73 | + |
| 74 | +``` |
| 75 | +src/SmartRAG/Services/ |
| 76 | + ├── MultiDatabaseQueryCoordinator.cs (orchestrator only ~300 lines) |
| 77 | + ├── QueryAnalysis/ |
| 78 | + │ ├── QueryIntentAnalyzer.cs |
| 79 | + │ └── QueryIntentParser.cs |
| 80 | + ├── SqlGeneration/ |
| 81 | + │ ├── SqlQueryGenerator.cs |
| 82 | + │ ├── SqlPromptBuilder.cs |
| 83 | + │ └── SqlPromptTemplates.cs |
| 84 | + ├── SqlValidation/ |
| 85 | + │ ├── SqlValidator.cs |
| 86 | + │ ├── SqlSyntaxValidator.cs |
| 87 | + │ ├── SqlColumnValidator.cs |
| 88 | + │ └── SqlTableValidator.cs |
| 89 | + └── ResultMerging/ |
| 90 | + ├── QueryResultMerger.cs |
| 91 | + ├── QueryResultParser.cs |
| 92 | + └── SmartJoinEngine.cs |
| 93 | +``` |
| 94 | + |
| 95 | +**Prensipler:** |
| 96 | +- **SRP (Single Responsibility):** Her sınıf tek bir iş yapsın |
| 97 | +- **OCP (Open/Closed):** Extension için açık, modification için kapalı |
| 98 | +- **DRY (Don't Repeat Yourself):** Tekrarlayan kod extraction |
| 99 | + |
| 100 | +**Süre Tahmini:** 3-4 saat |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +## 📊 Feature Enhancements |
| 105 | + |
| 106 | +### Test Success Rate İyileştirme |
| 107 | +**Hedef:** %72.7 → %90+ |
| 108 | + |
| 109 | +**Stratejiler:** |
| 110 | +1. AI prompt daha da netleştir |
| 111 | +2. SQL validation katmanı güçlendir |
| 112 | +3. Retry logic optimize et |
| 113 | +4. Smart merging geliştir |
| 114 | + |
| 115 | +### Multi-Database Transaction Support |
| 116 | +**Özellik:** Cross-database transaction yönetimi |
| 117 | + |
| 118 | +**Use Case:** |
| 119 | +```csharp |
| 120 | +using (var transaction = await coordinator.BeginTransactionAsync()) |
| 121 | +{ |
| 122 | + await coordinator.ExecuteAsync(db1Query); |
| 123 | + await coordinator.ExecuteAsync(db2Query); |
| 124 | + await transaction.CommitAsync(); |
| 125 | +} |
| 126 | +``` |
| 127 | + |
| 128 | +### Query Caching |
| 129 | +**Özellik:** Aynı sorguları cache'le |
| 130 | + |
| 131 | +**Faydalar:** |
| 132 | +- Performans artışı |
| 133 | +- AI token tasarrufu |
| 134 | +- Hızlı yanıt |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +## 🐛 Known Issues |
| 139 | + |
| 140 | +### API Warnings (14 warnings) |
| 141 | +- XML documentation hataları |
| 142 | +- Async method warnings |
| 143 | +- Nullable reference warnings |
| 144 | + |
| 145 | +**Hedef:** 0 warnings |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | +## 📝 Notes |
| 150 | + |
| 151 | +- Her TODO için ayrı branch açılmalı |
| 152 | +- Test coverage artırılmalı |
| 153 | +- Documentation güncel tutulmalı |
| 154 | +- Breaking changes için major version bump |
| 155 | + |
| 156 | +**Last Updated:** 2025-10-21 |
| 157 | + |
0 commit comments