fix: keep embedded session controls visible and handle empty memory
Publish documentation / publish (push) Successful in 34s
Publish documentation / publish (push) Successful in 34s
Cap the embedded shell at its portal container height so steering and stop controls remain accessible. Skip vector retrieval for an empty authoritative Memory archive and compute SQL-rule embeddings lazily. Validated with 54 Memory tests, 90 frontend tests, five browser scenarios, frontend and Docker builds, and a read-only comparison against the real empty Memory archive.
This commit is contained in:
@@ -1067,3 +1067,36 @@ def test_hybrid_recall_with_configured_real_embedding_and_isolated_stores(databa
|
||||
scope=scope)} == {rule, general, parent}
|
||||
finally:
|
||||
s.close()
|
||||
|
||||
|
||||
def test_empty_archive_rules_skip_unavailable_embedding_and_vectors(service, monkeypatch):
|
||||
import json
|
||||
from types import SimpleNamespace
|
||||
|
||||
from typer.testing import CliRunner
|
||||
|
||||
from tht.cli import app, memory_cmd, vector_cmd
|
||||
from tht.ports.vector import VectorStoreError
|
||||
from tht.vectorstore.embeddings import EmbeddingsError
|
||||
|
||||
s, _ = service
|
||||
snapshot = review_snapshot(s)
|
||||
snapshot.decisions[:] = [d for d in snapshot.decisions
|
||||
if not (d.type == "phase_approved" and int(d.subject.split(":")[1]) > 3)]
|
||||
|
||||
def unavailable_embedding(_):
|
||||
raise EmbeddingsError("Embedding unavailable")
|
||||
|
||||
def unavailable_search(*args, **kwargs):
|
||||
raise VectorStoreError("BM25 collection configuration mismatch")
|
||||
|
||||
cfg = SimpleNamespace(database=SimpleNamespace(database="dwh", db_schema="sales"), embeddings=None)
|
||||
monkeypatch.setattr(memory_cmd, "_load_config_or_exit", lambda _: cfg)
|
||||
monkeypatch.setattr(memory_cmd, "memory_service", lambda _: s)
|
||||
monkeypatch.setattr(memory_cmd, "load_snapshot_or_exit", lambda *_: snapshot)
|
||||
monkeypatch.setattr(s, "close", lambda: None)
|
||||
monkeypatch.setattr(vector_cmd, "open_searcher", lambda _: SimpleNamespace(search=unavailable_search))
|
||||
monkeypatch.setattr(vector_cmd, "make_embedder", lambda _: SimpleNamespace(embed_query=unavailable_embedding))
|
||||
result = CliRunner().invoke(app, ["memory", "rules", "Order", "--session", snapshot.manifest.id, "--json"])
|
||||
assert result.exit_code == 0, result.output
|
||||
assert json.loads(result.output) == []
|
||||
|
||||
Reference in New Issue
Block a user