fix(buzz): reconcile media pipeline with landed dispatch + threading contracts

Post-rebase composition over #99431/#99429/#99427: file-attachment sends
route through _run_message_send so the mention-recovery ladder covers
media captions; _send_file_attachment/_send_local_file honor the
resolved thread-root anchor and reply_to_mode opt-out; send() records
event_meta on the verified receipt id (#75826); test fakes gain the
auth_tag kwarg and accepted-receipt shape.
This commit is contained in:
Teknium
2026-08-31 09:47:36 -07:00
parent ce94f2b8f4
commit c816957a43
2 changed files with 10 additions and 8 deletions
+2 -2
View File
@@ -1508,7 +1508,7 @@ class BuzzAdapter(BasePlatformAdapter):
)
if reply_target and self._reply_to_mode != "off":
args += ["--reply-to", str(reply_target)]
code, out, err = await self._run_cli(args, input_text=caption or "")
code, out, err = await self._run_message_send(args, caption or "")
if code != 0:
return SendResult(
success=False,
@@ -1576,7 +1576,7 @@ class BuzzAdapter(BasePlatformAdapter):
)
if reply_target and self._reply_to_mode != "off":
args += ["--reply-to", str(reply_target)]
code, out, err = await self._run_cli(args, input_text=caption or "")
code, out, err = await self._run_message_send(args, caption or "")
if code != 0:
return SendResult(
success=False,
+8 -6
View File
@@ -367,7 +367,7 @@ class TestMultiplexProfileScope:
async def fake_exec(cli_path, args, *, relay_url, private_key, auth_tag="", input_text=None, timeout=None):
calls["relay"] = relay_url
return 0, '{"event_id": "e1"}', ""
return 0, '{"accepted": true, "event_id": "e1"}', ""
monkeypatch.setattr(_buzz_mod, "_exec_buzz", fake_exec)
monkeypatch.setattr(
@@ -546,7 +546,7 @@ class TestMultiplexProfileScope:
async def fake_exec(cli_path, args, *, relay_url, private_key, auth_tag="", input_text=None, timeout=None):
calls["args"] = args
return 0, '{"event_id": "e1"}', ""
return 0, '{"accepted": true, "event_id": "e1"}', ""
monkeypatch.setattr(_buzz_mod, "_exec_buzz", fake_exec)
monkeypatch.setattr(
@@ -2224,6 +2224,7 @@ class TestBuzzAdapterSend:
args, _stdin = cli.calls[0]
assert args[args.index("--reply-to") + 1] == "stable-root"
@pytest.mark.asyncio
@pytest.mark.parametrize(
("stdout", "error_fragment"),
[
@@ -3031,15 +3032,16 @@ class TestInboundMediaAuthorizationGate:
CHANNEL,
str(media),
caption="caption",
reply_to="root-event",
metadata={"thread_id": "ignored-thread"},
reply_to="latest-child",
metadata={"thread_id": "stable-root"},
)
assert result.success is True
assert result.message_id == "evt-media"
args, stdin_text = cli.calls[0]
assert args[args.index("--file") + 1] == str(media)
assert args[args.index("--reply-to") + 1] == "root-event"
# Threading contract (#99429): stable thread root beats latest-child.
assert args[args.index("--reply-to") + 1] == "stable-root"
assert stdin_text == "caption"
@pytest.mark.asyncio
@@ -3466,7 +3468,7 @@ class TestStandaloneSend:
captured = {}
async def fake_exec(cli_path, args, *, relay_url, private_key, input_text=None, timeout=30.0):
async def fake_exec(cli_path, args, *, relay_url, private_key, auth_tag="", input_text=None, timeout=30.0):
captured["args"] = args
return 0, json.dumps({"accepted": True, "event_id": "evt-media"}), ""