Harden M7.6/7.7: recursive restriction accumulation, MCP server enforcement, fast-fail authorization
This commit is contained in:
@@ -609,6 +609,35 @@ class TestAgentContext:
|
||||
assert "skills" not in d
|
||||
assert "profile" not in d
|
||||
|
||||
def test_toolstep_tools_roundtrip(self):
|
||||
step = ToolStep(
|
||||
tool="my-tool", output_var="out", tools=["safe-*", "official/lint"]
|
||||
)
|
||||
assert ToolStep.from_dict(step.to_dict()).tools == [
|
||||
"safe-*", "official/lint"
|
||||
]
|
||||
|
||||
def test_toolstep_empty_tools_roundtrip(self):
|
||||
step = ToolStep(tool="my-tool", output_var="out", tools=[])
|
||||
serialized = step.to_dict()
|
||||
assert serialized["tools"] == []
|
||||
assert ToolStep.from_dict(serialized).tools == []
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"data",
|
||||
[
|
||||
{"skills": "python"},
|
||||
{"skills": ["*", "python"]},
|
||||
{"skills": ["Python"]},
|
||||
{"tools": "safe-tool"},
|
||||
{"tools": [""]},
|
||||
{"profile": ""},
|
||||
],
|
||||
)
|
||||
def test_toolstep_rejects_invalid_agent_context(self, data):
|
||||
with pytest.raises(ValueError):
|
||||
ToolStep(tool="my-tool", output_var="out", **data)
|
||||
|
||||
def test_promptstep_skills_roundtrip(self):
|
||||
step = PromptStep(
|
||||
prompt="Test", provider="claude", output_var="out",
|
||||
|
||||
Reference in New Issue
Block a user