Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

test(embeddings): skip the fastembed config test when the backend falls back (#1991)

qwist1233-cpuc1383c52b78b
diff --git a/.github/full-suite-known-failures.txt b/.github/full-suite-known-failures.txt
index 84c680ce..8caf5da6 100644
--- a/.github/full-suite-known-failures.txt
+++ b/.github/full-suite-known-failures.txt
@@ -64,13 +64,6 @@ tests/semantic_extract/test_cache_backends.py::test_sqlite_rejects_symlinked_db
tests/ingest/test_ingestors.py::TestUnifiedIngest::test_ingest_web_dispatch
tests/ingest/test_ingestors.py::TestWebIngestor::test_ingest_url
-# --- Local embedding backend unavailable offline ------------------------------
-# The generator-config case is the exception: on the Linux runner the model does
-# load and the test passes, so it is marked `# windows-only` rather than left to
-# a strict xfail that would fail on that pass. The rest of this group is gone:
-# #1931 restored the semantic_extract config isolation and they now pass.
-tests/test_embedding_providers.py::TestEmbeddingProviders::test_embedding_generator_config # windows-only
-
# --- Progress tracking is forced off for the whole process --------------------
# `semantica_mcp/mcp/__init__.py` sets `SEMANTICA_DISABLE_PROGRESS=1` at import
# and `tests/test_mcp_package_export_graphml_parquet.py` sets it at module scope
diff --git a/tests/test_embedding_providers.py b/tests/test_embedding_providers.py
index 6fcc8735..73d17e52 100644
--- a/tests/test_embedding_providers.py
+++ b/tests/test_embedding_providers.py
@@ -76,7 +76,30 @@ class TestEmbeddingProviders(unittest.TestCase):
}
}
generator = EmbeddingGenerator(config=config)
- embeddings = generator.generate_embeddings(["Test text"], data_type="text")
+ # TextEmbedder silently falls back to the 128-dim hash method whenever
+ # the requested backend cannot be loaded: fastembed missing, or the
+ # model not reachable because the Hugging Face hub is down or
+ # rate-limited. Asserting 384 in that state reports an outage as a
+ # dimension regression, so check which backend is actually active and
+ # skip instead. A loaded fastembed model with the wrong dimension still
+ # fails.
+ active_method = generator.get_text_method()
+ if active_method != "fastembed":
+ self.skipTest(
+ "fastembed backend unavailable: TextEmbedder fell back to "
+ f"'{active_method}', so the model dimension cannot be checked"
+ )
+ try:
+ embeddings = generator.generate_embeddings(["Test text"], data_type="text")
+ except Exception as exc:
+ # `_initialize_model` keeps the fastembed object when only its
+ # dimension probe raises, so a model that loads but cannot embed
+ # still reports 'fastembed' above. An exception is never a
+ # dimension regression -- that surfaces as the assertion below --
+ # so it belongs with the outage case.
+ self.skipTest(
+ f"fastembed backend reported active but cannot embed: {exc}"
+ )
self.assertEqual(embeddings.shape[1], 384)
print("EmbeddingGenerator config test passed.")