Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion server/src/agent_control_server/endpoints/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,25 @@ async def _validate_control_definition(

evaluator_cls = available_evaluators.get(parsed.name)
if evaluator_cls is None:
continue
available = list(available_evaluators.keys())
raise APIValidationError(
error_code=ErrorCode.EVALUATOR_NOT_FOUND,
detail=f"Evaluator '{parsed.name}' is not registered",
resource="Evaluator",
hint=(
f"Check evaluator '{evaluator_ref}'. "
f"Available evaluators: {available or 'none'}."
),
errors=[
ValidationErrorItem(
resource="Control",
field=f"{field_prefix}.evaluator.name",
code="evaluator_not_found",
message=f"Evaluator '{parsed.name}' not found",
value=evaluator_ref,
)
],
)

try:
evaluator_cls.config_model(**evaluator_spec.config)
Expand Down
30 changes: 30 additions & 0 deletions server/tests/test_controls_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,33 @@ def test_validation_nested_agent_scoped_evaluator_error_uses_bracketed_field_pat
and err.get("code") == "evaluator_not_found"
for err in body.get("errors", [])
)


def test_validation_standalone_evaluator_error_uses_bracketed_field_path(
client: TestClient,
):
"""Standalone evaluator failures should identify the exact nested leaf path."""
control_id = create_control(client)
payload = deepcopy(VALID_CONTROL_PAYLOAD)
payload["condition"] = {
"or": [
{
"selector": {"path": "input"},
"evaluator": {
"name": "missing-evaluator",
"config": {},
},
}
]
}

resp = client.put(f"/api/v1/controls/{control_id}/data", json={"data": payload})

assert resp.status_code == 422
body = resp.json()
assert body["error_code"] == "EVALUATOR_NOT_FOUND"
assert any(
err.get("field") == "data.condition.or[0].evaluator.name"
and err.get("code") == "evaluator_not_found"
for err in body.get("errors", [])
)
11 changes: 11 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@
"prettify:check": "Check formatting with Prettier without changing files"
},
"dependencies": {
"@codemirror/autocomplete": "^6.20.1",
"@codemirror/lang-json": "^6.0.2",
"@codemirror/language": "^6.12.3",
"@codemirror/lint": "^6.9.5",
"@codemirror/state": "^6.6.0",
"@codemirror/view": "^6.40.0",
"@emotion/is-prop-valid": "^1.4.0",
"@lezer/highlight": "^1.2.3",
"@mantine/charts": "^7.17.8",
"@mantine/code-highlight": "7.17.5",
"@mantine/core": "7.17.5",
Expand All @@ -56,6 +63,10 @@
"@tanstack/react-query": "5.74.4",
"@tanstack/react-query-devtools": "5.72.2",
"@tanstack/react-table": "8.20.5",
"@uiw/codemirror-extensions-basic-setup": "^4.25.9",
"@uiw/codemirror-themes": "^4.25.9",
"@uiw/codemirror-themes-all": "4.25.9",
"@uiw/react-codemirror": "^4.25.9",
"axios": "1.12.0",
"classix": "2.2.0",
"date-fns": "4.1.0",
Expand Down
Loading
Loading