feat: add readable duplex messaging
Some checks failed
tamq-ci / test (push) Failing after 6s

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a03397-4d51-7fd1-8ff2-946eb22ea2bc
This commit is contained in:
tegwick 2026-08-25 19:26:27 +02:00
parent 788eb8e2ed
commit 92881b6b56
35 changed files with 1206 additions and 806 deletions

View file

@ -1,17 +1,30 @@
import pytest
from tamq.routing import parse_address_line
from tamq.routing import parse_address_line, parse_command_line
@pytest.mark.parametrize("prefix", ["@", "#"])
def test_direct_address(prefix):
routed = parse_address_line(f"{prefix}railiance-platform: do something!")
def test_direct_address_uses_readable_case_sensitive_grammar():
routed = parse_address_line("To:railiance-platform: do something!")
assert routed.body == "do something!"
assert routed.target_repo == "railiance-platform"
def test_ordinary_input_is_unchanged():
assert parse_address_line("hello @repo: not at start") is None
assert parse_address_line("@repo:") is None
assert parse_address_line("# from repo: inbound envelope") is None
assert parse_address_line("##repo: not an address") is None
@pytest.mark.parametrize(
"line",
[
"@repo: removed",
"#repo: removed",
"to:repo: wrong case",
"hello To:repo: not at start",
"To:repo:",
"From:repo: inbound envelope",
],
)
def test_non_protocol_and_legacy_input_is_not_routed(line):
assert parse_address_line(line) is None
def test_operator_command_grammar():
assert parse_command_line("Cmd: mode=trigger") == "mode=trigger"
assert parse_command_line("Cmd: reset-limits") == "reset-limits"
assert parse_command_line("cmd: mode=trigger") is None