feat: add reliable trigger and worker message blocks
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 23:22:39 +02:00
parent 72f22a13f7
commit 17b6bd7ae7
25 changed files with 588 additions and 67 deletions

View file

@ -17,7 +17,8 @@ def test_broker_accepts_worker_output_with_distinct_provenance(tmp_path, monkeyp
monkeypatch.setattr("tamq.broker.validate_targets", lambda targets: None)
store = Store(tmp_path / "queue.sqlite3")
broker = InputBroker(store, BrokerIdentity("ep", "net-kingdom"))
assert broker.inspect_worker_line("To:railiance-platform: hello") is not None
assert broker.inspect_worker_line("To:railiance-platform: hello") is None
assert broker.inspect_worker_line("") is not None
assert store.list()[0]["provenance"] == "worker_output"
@ -25,12 +26,42 @@ def test_broker_accepts_case_insensitive_framed_worker_output(tmp_path, monkeypa
monkeypatch.setattr("tamq.broker.validate_targets", lambda targets: None)
store = Store(tmp_path / "queue.sqlite3")
broker = InputBroker(store, BrokerIdentity("ep", "net-kingdom"))
assert broker.inspect_worker_line("• tO:railiance-platform: hello") is not None
assert broker.inspect_worker_line("• tO:railiance-platform: hello") is None
assert broker.inspect_worker_line("") is not None
row = store.list()[0]
assert row["body"] == "hello"
assert row["provenance"] == "worker_output"
def test_broker_collects_worker_followup_lines_until_empty(tmp_path, monkeypatch):
monkeypatch.setattr("tamq.broker.validate_targets", lambda targets: None)
store = Store(tmp_path / "queue.sqlite3")
broker = InputBroker(store, BrokerIdentity("ep", "net-kingdom"))
assert broker.inspect_worker_line("• To:railiance-platform: Review this") is None
assert broker.inspect_worker_line(" Context: AUTH-WP-4.") is None
assert broker.inspect_worker_line(" Reply with accepted or blocked.") is None
assert broker.inspect_worker_line("") is not None
row = store.list()[0]
assert row["body"] == (
"Review this\nContext: AUTH-WP-4.\nReply with accepted or blocked."
)
def test_new_worker_address_flushes_previous_block(tmp_path, monkeypatch):
monkeypatch.setattr("tamq.broker.validate_targets", lambda targets: None)
store = Store(tmp_path / "queue.sqlite3")
broker = InputBroker(store, BrokerIdentity("ep", "net-kingdom"))
broker.inspect_worker_line("To:first: one")
assert broker.inspect_worker_line("To:second: two") is not None
assert broker.flush_worker_message() is not None
assert [(row["target_repo"], row["body"]) for row in store.list()] == [
("first", "one"),
("second", "two"),
]
def test_case_insensitive_delivery_envelopes_are_not_rescanned(tmp_path):
store = Store(tmp_path / "queue.sqlite3")
broker = InputBroker(store, BrokerIdentity("ep", "net-kingdom"))