Skip to content

Self-improving AI Employees for everyone

test: catch up with pre-existing test drift (12 → 0 failing)

trohitg7974e9f37789
diff --git a/server/pyproject.toml b/server/pyproject.toml
index 2ba918a3..c7aaf405 100644
--- a/server/pyproject.toml
+++ b/server/pyproject.toml
@@ -117,6 +117,7 @@ dev = [
docs = [
"beautifulsoup4>=4.12.0",
"pypdf>=5.0.0",
+ "langchain-text-splitters>=0.3.0",
]
keyring = [
"keyring>=25.0.0", # OS-native credential storage (Windows/macOS/Linux)
diff --git a/server/tests/llm/test_factory.py b/server/tests/llm/test_factory.py
index bf0639dc..e813c287 100644
--- a/server/tests/llm/test_factory.py
+++ b/server/tests/llm/test_factory.py
@@ -11,6 +11,7 @@ def test_native_providers_set():
assert NATIVE_PROVIDERS == {
"anthropic", "openai", "gemini", "openrouter", "xai",
"deepseek", "kimi", "mistral",
+ "ollama", "lmstudio",
}
diff --git a/server/tests/nodes/test_code_fs_process.py b/server/tests/nodes/test_code_fs_process.py
index f0dc1a41..d0e9af30 100644
--- a/server/tests/nodes/test_code_fs_process.py
+++ b/server/tests/nodes/test_code_fs_process.py
@@ -313,8 +313,10 @@ class TestFileRead:
harness.assert_output_shape(result, ["content", "file_path"])
payload = result["result"]
assert payload["content"] == "line1\nline2\n"
- assert payload["file_path"] == "notes.txt"
- backend.read.assert_called_once_with("notes.txt", offset=0, limit=100)
+ # ``normalize_virtual_path`` prepends ``/`` to relative inputs so the
+ # path reaches deepagents in its canonical virtual-mode form.
+ assert payload["file_path"] == "/notes.txt"
+ backend.read.assert_called_once_with("/notes.txt", offset=0, limit=100)
async def test_missing_file_path_short_circuits(self, harness):
# No backend patch: we should short-circuit before reaching it.
@@ -333,7 +335,10 @@ class TestFileRead:
)
harness.assert_envelope(result, success=False)
- assert "no such file" in result["error"].lower()
+ # ``normalize_virtual_path`` rejects ``..`` segments before the
+ # backend is even called, so the error comes from deepagents'
+ # ``validate_path`` helper, not the (unreached) FileNotFoundError.
+ assert "path traversal not allowed" in result["error"].lower()
# ============================================================================
@@ -344,7 +349,11 @@ class TestFileRead:
class TestFileModify:
async def test_write_happy_path(self, harness):
backend = MagicMock(name="LocalShellBackend")
- backend.write = MagicMock(return_value=_FakeWriteResult(path="hello.txt"))
+ backend.write = MagicMock(return_value=_FakeWriteResult(path="/hello.txt"))
+ # ``write`` now does a pre-flight ``backend._resolve_path(...).exists()``
+ # check so it can unlink-and-replace; teach the mock that the target
+ # doesn't exist yet so the wholesale-write path proceeds.
+ backend._resolve_path.return_value.exists.return_value = False
with _patch_fs_backend(backend):
result = await harness.execute(
@@ -359,8 +368,8 @@ class TestFileModify:
harness.assert_envelope(result, success=True)
harness.assert_output_shape(result, ["operation", "file_path"])
assert result["result"]["operation"] == "write"
- assert result["result"]["file_path"] == "hello.txt"
- backend.write.assert_called_once_with("hello.txt", "hi there")
+ assert result["result"]["file_path"] == "/hello.txt"
+ backend.write.assert_called_once_with("/hello.txt", "hi there")
async def test_edit_happy_path_returns_occurrences(self, harness):
backend = MagicMock(name="LocalShellBackend")
@@ -386,7 +395,7 @@ class TestFileModify:
)
assert result["result"]["occurrences"] == 3
backend.edit.assert_called_once_with(
- "README.md", "foo", "bar", replace_all=True
+ "/README.md", "foo", "bar", replace_all=True
)
async def test_edit_missing_old_string_short_circuits(self, harness):
@@ -559,7 +568,7 @@ class TestFsSearch:
result, ["path", "pattern", "matches", "count"]
)
assert result["result"]["count"] == 1
- backend.glob_info.assert_called_once_with("**/*.py", path="src")
+ backend.glob_info.assert_called_once_with("**/*.py", path="/src")
async def test_grep_returns_string_error_as_error_envelope(self, harness):
# Per doc: grep_raw returns a str on error, list on success.
diff --git a/server/tests/test_node_spec.py b/server/tests/test_node_spec.py
index 79f96855..0221e766 100644
--- a/server/tests/test_node_spec.py
+++ b/server/tests/test_node_spec.py
@@ -16,6 +16,19 @@ from services.node_input_schemas import (
from services.node_spec import get_node_spec, list_node_types_with_spec
+def _numeric_constraints(prop: dict) -> dict:
+ """Pydantic emits ``Optional[float] = Field(ge=..., le=...)`` as
+ ``{anyOf: [{number, minimum, maximum}, {null}]}``. This helper digs
+ out the numeric branch so tests don't have to special-case nullable
+ vs. required fields each time we tweak Params."""
+ if "minimum" in prop or "maximum" in prop:
+ return prop
+ for branch in prop.get("anyOf", ()):
+ if branch.get("type") == "number" or "minimum" in branch or "maximum" in branch:
+ return branch
+ return prop
+
+
class TestInputSchemas:
def test_registry_not_empty(self):
assert len(NODE_INPUT_MODELS) > 50
@@ -35,8 +48,9 @@ class TestInputSchemas:
schema = get_node_input_schema("aiAgent")
assert schema is not None
props = schema["properties"]
- assert props["temperature"]["minimum"] == 0.0
- assert props["temperature"]["maximum"] == 2.0
+ temp = _numeric_constraints(props["temperature"])
+ assert temp["minimum"] == 0.0
+ assert temp["maximum"] == 2.0
# snake_case keys per Wave 11.E.4+ convention.
# NB: ``api_key`` is NOT a declared field — credentials live in
# the credentials DB and are auto-injected at execution time.
@@ -237,7 +251,7 @@ class TestPhase3cCoverage:
# All 16 specialized agents share SpecializedAgentParams - constraints
# like temperature 0-2 should appear identically.
spec = get_node_spec("coding_agent")
- temp = spec["inputs"]["properties"]["temperature"]
+ temp = _numeric_constraints(spec["inputs"]["properties"]["temperature"])
assert temp["minimum"] == 0.0
assert temp["maximum"] == 2.0