test(01-06): add failing matrix command-only regressions

- Assert skills text no longer includes reaction-era labels
- Require converter to drop reaction callback support
- Lock !settings dashboard to read-only snapshot copy
This commit is contained in:
Mikhail Putilovskij 2026-04-03 12:32:21 +03:00
parent 80800be60c
commit 974935c880
3 changed files with 12 additions and 28 deletions

View file

@ -2,7 +2,8 @@ from __future__ import annotations
from types import SimpleNamespace
from adapter.matrix.converter import from_command, from_reaction, from_room_event
import adapter.matrix.converter as converter
from adapter.matrix.converter import from_command, from_room_event
from core.protocol import IncomingCallback, IncomingCommand, IncomingMessage
@ -36,15 +37,6 @@ def image_event(url: str = "mxc://x/img", mime: str = "image/jpeg"):
)
def reaction_event(key: str, relates_to: str = "$orig"):
return SimpleNamespace(
sender="@a:m.org",
event_id="$r1",
key=key,
content={"m.relates_to": {"key": key, "event_id": relates_to}},
)
async def test_plain_text_to_incoming_message():
result = from_room_event(text_event("Hello"), room_id="!r:m.org", chat_id="C1")
assert isinstance(result, IncomingMessage)
@ -100,14 +92,5 @@ async def test_image_attachment():
assert result.attachments[0].mime_type == "image/jpeg"
async def test_reaction_confirm():
result = from_reaction(reaction_event("👍"), sender="@a:m.org", chat_id="C1")
assert isinstance(result, IncomingCallback)
assert result.action == "confirm"
async def test_reaction_toggle_skill():
result = from_reaction(reaction_event("2"), sender="@a:m.org", chat_id="C1")
assert isinstance(result, IncomingCallback)
assert result.action == "toggle_skill"
assert result.payload["skill_index"] == 2
def test_converter_module_does_not_expose_reaction_callbacks():
assert not hasattr(converter, "from_reaction")

View file

@ -165,6 +165,9 @@ async def test_mat11_settings_returns_dashboard():
assert len(result) >= 1
text = result[0].text
assert "Скиллы" in text or "скиллы" in text.lower()
assert "Изменить" in text or "!skills" in text
assert "Личность" in text
assert "Безопасность" in text
assert "Активные чаты" in text
assert "Изменить" not in text
assert "!connectors" not in text
assert "!whoami" not in text

View file

@ -3,7 +3,6 @@ from __future__ import annotations
from adapter.matrix.reactions import (
build_confirmation_text,
build_skills_text,
reaction_to_skill_index,
)
from sdk.interface import UserSettings
@ -20,6 +19,10 @@ def test_build_skills_text():
assert "web-search" in text
assert "fetch-url" in text
assert "!skill on/off" in text
assert "1" not in text
assert "2" not in text
assert "👍" not in text
assert "" not in text
def test_build_confirmation_text():
@ -27,8 +30,3 @@ def test_build_confirmation_text():
assert "Отправить письмо?" in text
assert "!yes" in text
assert "!no" in text
def test_reaction_to_skill_index():
assert reaction_to_skill_index("1") == 1
assert reaction_to_skill_index("👍") is None