fix(storage): contain logical corpus root

This commit is contained in:
2026-07-11 21:26:47 +02:00
parent 7f3f6f7ce7
commit a0daa319ca
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -79,6 +79,17 @@ def test_nested_root_symlink_escape_is_rejected(tmp_path):
resolve_workspace_paths(cfg_path, cfg, tmp_path / "data")
def test_corpus_symlink_escape_is_rejected(tmp_path):
cfg_path = _write_config(tmp_path / "demo.yaml")
cfg = load_config(cfg_path)
workspace = tmp_path / "data/workspaces/demo"
workspace.mkdir(parents=True)
(workspace / "corpus").symlink_to(tmp_path / "private", target_is_directory=True)
with pytest.raises(ConfigError, match="outside workspace root"):
resolve_workspace_paths(cfg_path, cfg, tmp_path / "data")
def test_data_root_environment_activates_portable_paths(monkeypatch, tmp_path):
cfg_path = _write_config(tmp_path / "demo.yaml")
monkeypatch.setenv("THT_DATA_ROOT", str(tmp_path / "data"))
+1 -1
View File
@@ -50,5 +50,5 @@ def resolve_workspace_paths(
sessions=_resolve_root(roots.sessions, workspace, "sessions"),
artifacts=_resolve_root(roots.artifacts, workspace, "artifacts"),
indexes=_resolve_root(roots.indexes, workspace, "indexes"),
corpus=(workspace / "corpus").resolve(),
corpus=_resolve_root(Path("corpus"), workspace, "corpus"),
)