Refine bounded traversal contracts
This commit is contained in:
parent
c69cd16515
commit
4ae9b31db5
8 changed files with 101 additions and 26 deletions
|
|
@ -70,6 +70,14 @@ class DocForgeMcpTests(unittest.IsolatedAsyncioTestCase):
|
|||
names = tuple(tool.name for tool in response.tools)
|
||||
self.assertEqual(ALL_TOOLS, names)
|
||||
self.assertEqual(14, len(PROPOSAL_TOOLS))
|
||||
tools = {tool.name: tool for tool in response.tools}
|
||||
for name in (
|
||||
"docforge_backlinks",
|
||||
"docforge_dependencies",
|
||||
"docforge_impact",
|
||||
):
|
||||
self.assertIn("limit", tools[name].inputSchema["properties"])
|
||||
self.assertNotIn("limit", tools[name].inputSchema.get("required", []))
|
||||
self.assertFalse(
|
||||
any(
|
||||
token in name
|
||||
|
|
@ -193,6 +201,24 @@ class DocForgeMcpTests(unittest.IsolatedAsyncioTestCase):
|
|||
self.assertLessEqual(context["estimated_tokens"], 180)
|
||||
self.assertTrue(context["omissions"])
|
||||
|
||||
async def test_invalid_traversal_limit_is_a_structured_domain_error(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = self.copy_fixture("alpha", Path(directory))
|
||||
ProjectIndex(Project.open(root)).build()
|
||||
async with create_connected_server_and_client_session(
|
||||
create_server(root), raise_exceptions=True
|
||||
) as session:
|
||||
result = await session.call_tool(
|
||||
"docforge_impact",
|
||||
{"node_id": "guide.foundation", "limit": 0},
|
||||
)
|
||||
|
||||
self.assertEqual("error", result.structuredContent["status"])
|
||||
self.assertEqual(
|
||||
"invalid_limit",
|
||||
result.structuredContent["error"]["code"],
|
||||
)
|
||||
|
||||
async def test_sync_register_rebase_apply_and_lifecycle_are_one_bound_workflow(
|
||||
self,
|
||||
) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue