fix: Retry loop safety, doctor model matching, regenerator robustness
Three defensive improvements from peer code review: Replace unreachable!() in GitLab client retry loops: Both request() and request_with_headers() had unreachable!() after their for loops. While the logic was sound (the final iteration always reaches the return/break), any refactor to the loop condition would turn this into a runtime panic. Restructured both to store last_response with explicit break, making the control flow self-documenting and the .expect() message useful if ever violated. Doctor model name comparison asymmetry: Ollama model names were stripped of their tag (:latest, :v1.5) for comparison, but the configured model name was compared as-is. A config value like "nomic-embed-text:v1.5" would never match. Now strips the tag from both sides before comparing. Regenerator savepoint cleanup and progress accuracy: - upsert_document's error path did ROLLBACK TO but never RELEASE, leaving a dangling savepoint that could nest on the next call. Added RELEASE after rollback so the connection is clean. - estimated_total for progress reporting was computed once at start but the dirty queue can grow during processing. Now recounts each loop iteration with max() so the progress fraction never goes backwards. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -418,7 +418,11 @@ async fn check_ollama(config: Option<&Config>) -> OllamaCheck {
|
||||
.map(|m| m.name.split(':').next().unwrap_or(&m.name))
|
||||
.collect();
|
||||
|
||||
if !model_names.iter().any(|m| *m == model) {
|
||||
// Strip tag from configured model name too (e.g.
|
||||
// "nomic-embed-text:v1.5" → "nomic-embed-text") so both
|
||||
// sides are compared at the same granularity.
|
||||
let model_base = model.split(':').next().unwrap_or(model);
|
||||
if !model_names.contains(&model_base) {
|
||||
return OllamaCheck {
|
||||
result: CheckResult {
|
||||
status: CheckStatus::Warning,
|
||||
|
||||
Reference in New Issue
Block a user