fix: preserve Task 2 command loading contracts
This commit is contained in:
@@ -160,3 +160,34 @@ def test_preprocess_evidence_uses_runtime_identity_for_dev_fd_config(monkeypatch
|
||||
monkeypatch.setattr("tht.corpus.pipeline.CorpusPipeline", FakePipeline)
|
||||
command.run_from_config(Path("/dev/fd/3"))
|
||||
assert captured["workspace_id"] == "runtime-workspace"
|
||||
|
||||
|
||||
def test_preprocess_gc_uses_runtime_identity_for_dev_fd_config(monkeypatch, tmp_path):
|
||||
import tht.cli.preprocess_cmd as command
|
||||
|
||||
cfg = SimpleNamespace(
|
||||
runtime_identity=SimpleNamespace(workspace_id="runtime-workspace"),
|
||||
embeddings=SimpleNamespace(model="m", dim=4),
|
||||
vector=SimpleNamespace(max_chunk_chars=10, retain_published_generations=1),
|
||||
paths=SimpleNamespace(artifacts=tmp_path / "artifacts"),
|
||||
)
|
||||
captured = {}
|
||||
|
||||
class FakePipeline:
|
||||
def __init__(self, **kwargs):
|
||||
captured.update(kwargs)
|
||||
|
||||
def gc(self, **kwargs):
|
||||
captured.update(kwargs)
|
||||
captured["workspace_id"] = self.workspace_id
|
||||
return {"status": "succeeded", "dry_run": True, "evicted": [], "failures": []}
|
||||
|
||||
monkeypatch.setattr(command, "_load_config_or_exit", lambda _: cfg)
|
||||
monkeypatch.setattr("tht.adapters.factory.build_evidence_sources", lambda _: [])
|
||||
monkeypatch.setattr("tht.adapters.factory.build_vector_store", lambda *_args, **_kwargs: object())
|
||||
monkeypatch.setattr("tht.cli.vector_cmd.make_embedder", lambda _: object())
|
||||
monkeypatch.setattr("tht.corpus.pipeline.CorpusPipeline", FakePipeline)
|
||||
|
||||
command.gc_from_config(Path("/dev/fd/3"), dry_run=True)
|
||||
assert captured["dry_run"] is True
|
||||
assert captured["workspace_id"] == "runtime-workspace"
|
||||
|
||||
Reference in New Issue
Block a user