From ca2d78001820b55dbe0ec01f4233b4f5f782a7af Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Mon, 23 Feb 2026 23:15:19 -0800 Subject: [PATCH] Full source paths. --- castle-api/src/castle_api/routes.py | 4 ++-- castle-api/src/castle_api/tools.py | 4 ++-- castle-api/tests/test_tools.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/castle-api/src/castle_api/routes.py b/castle-api/src/castle_api/routes.py index bdc6356..bd2834c 100644 --- a/castle-api/src/castle_api/routes.py +++ b/castle-api/src/castle_api/routes.py @@ -161,7 +161,7 @@ def _summary_from_program(name: str, comp: ProgramSpec, root: Path) -> Component # Infer runner from source directory runner = None if source: - source_dir = root / source + source_dir = Path(source) if (source_dir / "pyproject.toml").exists(): runner = "python" elif source_dir.is_file(): @@ -316,7 +316,7 @@ def _program_from_spec( source = comp.source runner = None if source: - source_dir = root / source + source_dir = Path(source) if (source_dir / "pyproject.toml").exists(): runner = "python" elif source_dir.is_file(): diff --git a/castle-api/src/castle_api/tools.py b/castle-api/src/castle_api/tools.py index 30eded6..68f720e 100644 --- a/castle-api/src/castle_api/tools.py +++ b/castle-api/src/castle_api/tools.py @@ -30,8 +30,8 @@ def _tool_summary( # Infer runner from source directory runner = None source = comp.source - if source and root: - source_dir = root / source + if source: + source_dir = Path(source) if (source_dir / "pyproject.toml").exists(): runner = "python" elif source_dir.is_file(): diff --git a/castle-api/tests/test_tools.py b/castle-api/tests/test_tools.py index abdc90d..249b92c 100644 --- a/castle-api/tests/test_tools.py +++ b/castle-api/tests/test_tools.py @@ -29,7 +29,7 @@ class TestToolsList: data = response.json() tool = next(t for t in data if t["id"] == "test-tool") assert tool["description"] == "Test tool" - assert tool["source"] == "test-tool" + assert tool["source"].endswith("/test-tool") assert tool["system_dependencies"] == ["pandoc"] def test_installed_flag(self, client: TestClient) -> None: @@ -57,7 +57,7 @@ class TestToolDetail: assert response.status_code == 200 data = response.json() assert data["id"] == "test-tool" - assert data["source"] == "test-tool" + assert data["source"].endswith("/test-tool") assert data["system_dependencies"] == ["pandoc"] def test_no_docs(self, client: TestClient) -> None: