feat: harden runtime readiness and session workflow
This commit is contained in:
@@ -7,6 +7,7 @@ from typer.testing import CliRunner
|
||||
from tht.cli import app
|
||||
from tht.config import load_config
|
||||
from tht.jobs.dwh_pipeline import DwhPreprocessPipeline, config_dwh_binding
|
||||
from tht.ports.vector import VectorReadUnavailable
|
||||
from tht.mschema.models import ColumnPhysical, PhysicalSchema, TablePhysical
|
||||
from tht.vectorstore.embeddings import EmbeddingsError
|
||||
|
||||
@@ -116,6 +117,21 @@ def test_pack_json_and_session_file(tmp_path, monkeypatch):
|
||||
assert "Retrieval pack" in pack.read_text()
|
||||
|
||||
|
||||
def test_pack_degrades_direct_vector_read_error(tmp_path, monkeypatch):
|
||||
cfg = _workspace(tmp_path)
|
||||
|
||||
class _BrokenSearcher:
|
||||
def search(self, vec, top_n, kinds=None):
|
||||
raise VectorReadUnavailable("Vector read operation unavailable")
|
||||
|
||||
_patch(monkeypatch, _FakeEmbedder(), _BrokenSearcher())
|
||||
res = CliRunner().invoke(app, ["search", "pack", "q", "-c", str(cfg), "--json"])
|
||||
assert res.exit_code == 0, res.output
|
||||
data = json.loads(res.output[res.output.index("{"):])
|
||||
assert data["tables"] == [] and data["evidence"] == [] and data["solved"] == []
|
||||
assert len(data["warnings"]) == 2
|
||||
|
||||
|
||||
def test_pack_degrades_gracefully(tmp_path, monkeypatch):
|
||||
cfg = _workspace(tmp_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user