add black-box debug harness
This commit is contained in:
23
internal/harness/scenarios/child_exit.json
Normal file
23
internal/harness/scenarios/child_exit.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "child_exit",
|
||||
"trust": ["exit0"],
|
||||
"presets": {
|
||||
"processes": [
|
||||
{
|
||||
"name": "exit0",
|
||||
"argv": ["sh", "-lc", "exit 0"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"steps": [
|
||||
{
|
||||
"type": "mcp_call",
|
||||
"method": "spawn_process",
|
||||
"params": { "kind": "command", "preset": "exit0" },
|
||||
"save_as": "proc"
|
||||
},
|
||||
{ "type": "wait_stable", "timeout_ms": 3000 },
|
||||
{ "type": "assert_mcp", "method": "list_processes", "path": "0.status", "equals": "exited" },
|
||||
{ "type": "assert_mcp", "method": "list_processes", "path": "0.exit_code", "equals": 0 }
|
||||
]
|
||||
}
|
||||
30
internal/harness/scenarios/mcp_send_input.json
Normal file
30
internal/harness/scenarios/mcp_send_input.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "mcp_send_input",
|
||||
"steps": [
|
||||
{
|
||||
"type": "mcp_call",
|
||||
"method": "spawn_process",
|
||||
"params": {
|
||||
"kind": "command",
|
||||
"argv": ["sh", "-lc", "read line; echo got:$line; sleep 5"],
|
||||
"name": "reader"
|
||||
},
|
||||
"save_as": "proc"
|
||||
},
|
||||
{
|
||||
"type": "mcp_call",
|
||||
"method": "send_input",
|
||||
"params": {
|
||||
"process_id": "{{proc.process_id}}",
|
||||
"kind": "text",
|
||||
"text": "hello",
|
||||
"submit": true,
|
||||
"wait_ms": 250,
|
||||
"tail_mode": "grid"
|
||||
},
|
||||
"save_as": "input"
|
||||
},
|
||||
{ "type": "assert_saved", "from": "input", "path": "tail.content", "contains": "got:hello" },
|
||||
{ "type": "wait_text", "contains": "got:hello", "timeout_ms": 5000 }
|
||||
]
|
||||
}
|
||||
26
internal/harness/scenarios/spawn_process_via_palette.json
Normal file
26
internal/harness/scenarios/spawn_process_via_palette.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "spawn_process_via_palette",
|
||||
"presets": {
|
||||
"processes": [
|
||||
{
|
||||
"name": "ready",
|
||||
"argv": ["ready-script"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": [
|
||||
{
|
||||
"name": "ready-script",
|
||||
"body": "#!/bin/sh\necho READY\nsleep 5\n"
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{ "type": "wait_stable", "timeout_ms": 3000 },
|
||||
{ "type": "send_chord", "chord": "ctrl-k" },
|
||||
{ "type": "send_text", "text": "ready" },
|
||||
{ "type": "send_chord", "chord": "enter" },
|
||||
{ "type": "wait_text", "contains": "READY", "timeout_ms": 5000 },
|
||||
{ "type": "assert_mcp", "method": "list_processes", "path": "0.name", "equals": "ready" },
|
||||
{ "type": "assert_mcp", "method": "list_processes", "path": "0.status", "equals": "running" }
|
||||
]
|
||||
}
|
||||
34
internal/harness/scenarios/switch_via_palette.json
Normal file
34
internal/harness/scenarios/switch_via_palette.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "switch_via_palette",
|
||||
"scripts": [
|
||||
{
|
||||
"name": "named-loop",
|
||||
"body": "#!/bin/sh\necho \"$1 READY\"\nsleep 5\n"
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"type": "mcp_call",
|
||||
"method": "spawn_process",
|
||||
"params": { "kind": "command", "argv": ["named-loop", "first"], "name": "first" },
|
||||
"save_as": "first"
|
||||
},
|
||||
{
|
||||
"type": "mcp_call",
|
||||
"method": "spawn_process",
|
||||
"params": { "kind": "command", "argv": ["named-loop", "second"], "name": "second" },
|
||||
"save_as": "second"
|
||||
},
|
||||
{ "type": "wait_text", "contains": "second READY", "timeout_ms": 5000 },
|
||||
{ "type": "send_chord", "chord": "ctrl-k" },
|
||||
{ "type": "send_text", "text": "Switch to first" },
|
||||
{ "type": "send_chord", "chord": "enter" },
|
||||
{ "type": "wait_text", "contains": "first READY", "timeout_ms": 5000 },
|
||||
{
|
||||
"type": "assert_mcp",
|
||||
"method": "get_project_status",
|
||||
"path": "processes.0.name",
|
||||
"equals": "first"
|
||||
}
|
||||
]
|
||||
}
|
||||
19
internal/harness/scenarios/trust_required.json
Normal file
19
internal/harness/scenarios/trust_required.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "trust_required",
|
||||
"presets": {
|
||||
"processes": [
|
||||
{
|
||||
"name": "untrusted",
|
||||
"argv": ["sh", "-lc", "echo should-not-run"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"steps": [
|
||||
{
|
||||
"type": "assert_mcp",
|
||||
"method": "spawn_process",
|
||||
"params": { "kind": "command", "preset": "untrusted" },
|
||||
"error_kind": "needs_trust"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user