@@ -95,6 +95,29 @@ mod tests {
9595 assert ! ( mc. embedding. strict) ;
9696 }
9797
98+ #[ test]
99+ fn embedding_provider_is_the_resolved_slug_not_the_config_field ( ) {
100+ // The regression this pins: `memory.embedding_provider` is not
101+ // authoritative. A user embedding entirely locally still reads as
102+ // `"cloud"` there, because neither local rung of the ladder rewrites
103+ // the field. Since `provider` keys the vector space, mapping it
104+ // straight through would file local vectors under the cloud provider.
105+ let mut config = TestHostConfig :: default ( ) ;
106+ config. memory . embedding_provider = "cloud" . to_string ( ) ;
107+ // Rung 1 of the ladder: an explicit Ollama endpoint + model.
108+ config. memory_tree . embedding_endpoint = Some ( "http://127.0.0.1:11434" . to_string ( ) ) ;
109+ config. memory_tree . embedding_model = Some ( "nomic-embed-text" . to_string ( ) ) ;
110+
111+ let mc = memory_config_from ( & config, PathBuf :: from ( "/tmp/ws" ) ) ;
112+
113+ assert_eq ! (
114+ mc. embedding. provider, "ollama" ,
115+ "locally-resolved embeddings must be keyed as ollama, not the \
116+ stale 'cloud' spelling in memory.embedding_provider"
117+ ) ;
118+ assert_ne ! ( mc. embedding. provider, config. memory. embedding_provider) ;
119+ }
120+
98121 #[ test]
99122 fn tree_defaults_match_engine_constants ( ) {
100123 // The base mapping leaves tree budgets at the crate defaults, which are
0 commit comments