Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a03397-4d51-7fd1-8ff2-946eb22ea2bc
This commit is contained in:
parent
d7d92502b4
commit
8186550c9a
10 changed files with 379 additions and 33 deletions
|
|
@ -55,6 +55,66 @@ def test_bare_reply_targets_latest_inbound_sender(tmp_path, monkeypatch, capsys)
|
|||
store.close()
|
||||
|
||||
|
||||
def test_interactive_reply_shows_latest_and_cycles_session_recipients(tmp_path, monkeypatch, capsys):
|
||||
monkeypatch.setenv("TAMQ_STATE_DIR", str(tmp_path / "state"))
|
||||
monkeypatch.setenv("TAMQ_REPO", "audit-core")
|
||||
monkeypatch.setenv(
|
||||
"TAMQ_RECIPIENTS", '["audit-core","railiance-platform","flex-auth"]'
|
||||
)
|
||||
monkeypatch.setattr("tamq.cli.ping", service_is_down)
|
||||
monkeypatch.setattr("tamq.cli.validate_targets", lambda repos: None)
|
||||
store = Store(tmp_path / "state" / "tamq.sqlite3")
|
||||
store.add("flex-auth", "audit-core", "latest inbound")
|
||||
store.close()
|
||||
seen = []
|
||||
|
||||
def compose(recipients):
|
||||
seen.append(recipients)
|
||||
return "railiance-platform", "What's up?"
|
||||
|
||||
monkeypatch.setattr("tamq.cli.compose_message", compose)
|
||||
assert main(["reply"]) == 0
|
||||
message_id = capsys.readouterr().out.strip()
|
||||
|
||||
assert seen == [("flex-auth", "railiance-platform")]
|
||||
store = Store(tmp_path / "state" / "tamq.sqlite3")
|
||||
row = next(row for row in store.list() if row["message_id"] == message_id)
|
||||
assert (row["sender_repo"], row["target_repo"], row["body"]) == (
|
||||
"audit-core", "railiance-platform", "What's up?"
|
||||
)
|
||||
store.close()
|
||||
|
||||
|
||||
def test_interactive_reply_uses_first_peer_without_history(tmp_path, monkeypatch, capsys):
|
||||
monkeypatch.setenv("TAMQ_STATE_DIR", str(tmp_path / "state"))
|
||||
monkeypatch.setenv("TAMQ_REPO", "audit-core")
|
||||
monkeypatch.setenv("TAMQ_RECIPIENTS", '["audit-core","flex-auth"]')
|
||||
monkeypatch.setattr("tamq.cli.ping", service_is_down)
|
||||
monkeypatch.setattr("tamq.cli.validate_targets", lambda repos: None)
|
||||
monkeypatch.setattr(
|
||||
"tamq.cli.compose_message", lambda recipients: (recipients[0], "hello")
|
||||
)
|
||||
|
||||
assert main(["reply"]) == 0
|
||||
message_id = capsys.readouterr().out.strip()
|
||||
store = Store(tmp_path / "state" / "tamq.sqlite3")
|
||||
row = next(row for row in store.list() if row["message_id"] == message_id)
|
||||
assert row["target_repo"] == "flex-auth"
|
||||
store.close()
|
||||
|
||||
|
||||
def test_interactive_reply_cancellation_queues_nothing(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("TAMQ_STATE_DIR", str(tmp_path / "state"))
|
||||
monkeypatch.setenv("TAMQ_REPO", "audit-core")
|
||||
monkeypatch.setenv("TAMQ_RECIPIENTS", '["audit-core","flex-auth"]')
|
||||
monkeypatch.setattr("tamq.cli.compose_message", lambda recipients: None)
|
||||
|
||||
assert main(["reply"]) == 130
|
||||
store = Store(tmp_path / "state" / "tamq.sqlite3")
|
||||
assert store.list() == []
|
||||
store.close()
|
||||
|
||||
|
||||
def test_bare_reply_requires_managed_identity_and_prior_sender(tmp_path, monkeypatch, capsys):
|
||||
monkeypatch.setenv("TAMQ_STATE_DIR", str(tmp_path / "state"))
|
||||
monkeypatch.setattr("tamq.cli.ping", service_is_down)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue