feat: add experimental pushy delivery mode
Some checks failed
tamq-ci / test (push) Has been cancelled
Some checks failed
tamq-ci / test (push) Has been cancelled
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a03397-4d51-7fd1-8ff2-946eb22ea2bc
This commit is contained in:
parent
8186550c9a
commit
9ed8b62b45
16 changed files with 441 additions and 31 deletions
|
|
@ -18,7 +18,7 @@ def test_root_help_exposes_repository_shorthand_and_command(capsys):
|
|||
main(["--help"])
|
||||
assert exc.value.code == 0
|
||||
output = capsys.readouterr().out
|
||||
assert "tamq [--detach] [--command COMMAND] [--no-display] REPO" in output
|
||||
assert "tamq [--detach] [--command COMMAND] [--mode MODE] REPO" in output
|
||||
assert "With no --command" in output
|
||||
assert "@TARGET: MESSAGE" in output
|
||||
|
||||
|
|
@ -45,11 +45,13 @@ def test_start_parser_supports_command_and_cmd_alias():
|
|||
compatibility = parser.parse_args(["start", "--cmd", "claude", "a"])
|
||||
neutral = parser.parse_args(["start", "a", "b"])
|
||||
inbox_only = parser.parse_args(["start", "--no-display", "a"])
|
||||
pushy = parser.parse_args(["start", "--mode", "pushy", "a"])
|
||||
assert canonical.initial_command == "codex --quiet"
|
||||
assert canonical.repos == ["a", "b"]
|
||||
assert compatibility.initial_command == "claude"
|
||||
assert neutral.initial_command is None
|
||||
assert inbox_only.no_display is True
|
||||
assert pushy.mode == "pushy"
|
||||
|
||||
|
||||
def test_repository_first_and_command_first_start_shorthand():
|
||||
|
|
@ -69,6 +71,17 @@ def test_repository_first_and_command_first_start_shorthand():
|
|||
"--no-display",
|
||||
"flex-auth",
|
||||
]
|
||||
assert normalize_argv(["--mode", "pushy", "flex-auth"]) == [
|
||||
"start",
|
||||
"--mode",
|
||||
"pushy",
|
||||
"flex-auth",
|
||||
]
|
||||
assert normalize_argv(["--mode=pushy", "flex-auth"]) == [
|
||||
"start",
|
||||
"--mode=pushy",
|
||||
"flex-auth",
|
||||
]
|
||||
assert normalize_argv(["status"]) == ["status"]
|
||||
assert normalize_argv(["--verbose", "flex-auth", "audit-core"]) == [
|
||||
"--verbose",
|
||||
|
|
@ -179,6 +192,52 @@ def test_registration_failure_rolls_back_created_windows(monkeypatch, capsys):
|
|||
assert "endpoint registration failed: denied" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_pushy_mode_registers_explicit_delivery_mode(monkeypatch, capsys):
|
||||
endpoint = type(
|
||||
"Endpoint",
|
||||
(),
|
||||
{
|
||||
"endpoint_id": "tmux-amq-42",
|
||||
"instance_key": "tmux-amq-42-boot",
|
||||
"pid": 42,
|
||||
"session": "tamq",
|
||||
"repos": ["a", "b"],
|
||||
},
|
||||
)()
|
||||
requests = []
|
||||
|
||||
class Manager:
|
||||
def preflight(self, repos, command):
|
||||
assert repos == ["a", "b"]
|
||||
return "plan"
|
||||
|
||||
def ensure_plan(self, plan, *, tap=True):
|
||||
assert tap is False
|
||||
return endpoint
|
||||
|
||||
def rollback(self, value):
|
||||
pytest.fail("successful registration must not roll back")
|
||||
|
||||
async def register(payload):
|
||||
requests.append(payload)
|
||||
return {"ok": True}
|
||||
|
||||
monkeypatch.setattr("tamq.cli.TmuxManager", Manager)
|
||||
monkeypatch.setattr("tamq.cli.preflight_runtime_paths", lambda: None)
|
||||
monkeypatch.setattr("tamq.cli.ensure_pushy_service", lambda: True)
|
||||
monkeypatch.setattr(
|
||||
"tamq.cli.ensure_output_service",
|
||||
lambda: pytest.fail("output capability must not select pushy mode"),
|
||||
)
|
||||
monkeypatch.setattr("tamq.cli.request", register)
|
||||
|
||||
assert main(["start", "--detach", "--mode", "pushy", "a", "b"]) == 0
|
||||
summary = json.loads(capsys.readouterr().out)
|
||||
assert summary["mode"] == "pushy"
|
||||
assert summary["delivery_mode"] == "pushy"
|
||||
assert requests[0]["delivery_mode"] == "pushy"
|
||||
|
||||
|
||||
def test_tap_requires_explicit_command_and_service(capsys):
|
||||
assert main(["start", "--tap", "a"]) == 2
|
||||
assert "--tap requires an explicit --command" in capsys.readouterr().err
|
||||
|
|
@ -186,3 +245,9 @@ def test_tap_requires_explicit_command_and_service(capsys):
|
|||
assert "--tap cannot be combined with --no-service" in capsys.readouterr().err
|
||||
assert main(["start", "--tap", "--no-display", "--command", "sh", "a"]) == 2
|
||||
assert "--tap cannot be combined with --no-display" in capsys.readouterr().err
|
||||
assert main(["start", "--no-display", "--mode", "pushy", "a"]) == 2
|
||||
assert "conflicts with the selected --mode" in capsys.readouterr().err
|
||||
assert main(["start", "--tap", "--mode", "pushy", "--command", "sh", "a"]) == 2
|
||||
assert "--tap cannot be combined with --mode" in capsys.readouterr().err
|
||||
assert main(["start", "--no-service", "--mode", "pushy", "a"]) == 2
|
||||
assert "--mode cannot be combined with --no-service" in capsys.readouterr().err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue