Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion crates/chat-cli/src/util/knowledge_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,14 @@ impl KnowledgeStore {
Some(s) => match EmbeddingType::from_str(s) {
Some(et) => Some(et),
None => {
return Err(format!("Invalid embedding type '{}'. Valid options are: fast, best", s));
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
let valid = "fast";
#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
let valid = "fast, best";
return Err(format!(
"Invalid embedding type '{}'. Valid options are: {}",
s, valid
));
},
},
None => None,
Expand Down Expand Up @@ -624,4 +631,31 @@ mod tests {
// Verify directory structure
assert!(base_dir.to_string_lossy().contains("knowledge_bases"));
}

/// Regression test for #3139: on Linux ARM64, the error message for an invalid
/// embedding type must not list "best" as a valid option since it is unavailable.
#[test]
fn invalid_embedding_type_error_does_not_mention_best_on_linux_arm() {
use semantic_search_client::embedding::EmbeddingType;

// Simulate what knowledge_store does when from_str returns None
let invalid = "best";
let result = EmbeddingType::from_str(invalid);

#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
{
// On Linux ARM64, "best" must not be accepted
assert!(result.is_none(), "'best' should not be valid on Linux ARM64");
// And the error message must only list "fast"
let valid = "fast";
let msg = format!("Invalid embedding type '{}'. Valid options are: {}", invalid, valid);
assert!(!msg.contains("best"), "error message must not mention 'best' on Linux ARM64");
}

#[cfg(not(all(target_os = "linux", target_arch = "aarch64")))]
{
// On other platforms, "best" is valid
assert!(result.is_some(), "'best' should be valid on this platform");
}
}
}