Support bounded machine instruction step counts in MCP

This commit is contained in:
Александр Петров
2026-09-17 23:22:37 +03:00
parent e8189b137a
commit 259c782190
13 changed files with 62 additions and 10 deletions
+10
View File
@@ -55,6 +55,16 @@ class McpAdapterTests(unittest.TestCase):
self.client.step_source('back')
self.assertEqual(len(self.calls), before)
def test_machine_step_count_is_validated_before_rpc(self):
before = len(self.calls)
for count in (0, 65, True):
with self.assertRaisesRegex(SessionError, '1..64'):
self.client.step_instruction(count)
self.assertEqual(len(self.calls), before)
self.client.step_instruction(3)
self.assertEqual(self.calls[-1][1], 'step')
self.assertEqual(self.calls[-1][2]['count'], 3)
def test_press_key_releases_shift_after_snapshot_error(self):
calls = []