]> git.aero2k.de Git - urlbot-v3.git/commit
Fix leading-'#' zero-match in routing.matches(); extend the smoke test
authorThorsten <mail@aero2k.de>
Sat, 18 Jul 2026 09:02:11 +0000 (11:02 +0200)
committerThorsten <mail@aero2k.de>
Sat, 18 Jul 2026 09:02:11 +0000 (11:02 +0200)
commit5b012a51b7ac36e3143fe196c48664a0ab51a865
tree42679fba8437615f46853a2936a463afae922d05
parentcf5e2232be5f462a80345db9ec3131e98b246077
Fix leading-'#' zero-match in routing.matches(); extend the smoke test

routing.matches() (used by the NATS classifier dispatch and the AMQP test
harness alike) only fixed up the trailing zero-match case ("nick.dice.#"
matching bare "nick.dice"). Real AMQP topic exchanges let '#' match zero
words at any position, so a binding key like "#.doctor.#" must also match
"doctor" as the literal first word with nothing before it - that shape
was silently broken under the NATS backend (confirmed live: Doctor and
DidYouKnow, the only two plugins using a bare leading '#', never fired for
that phrasing on munin). Fixed with a symmetric leading-anchor rewrite,
plus unit test coverage. A narrower gap remains for a '#' with zero words
strictly between two literals (documented in routing.py) - only affects
Selfreaction's degenerate "me.<nick>" phrasing, not worth a fully general
regex rewrite for.

Also extends muc_smoke_check.py with checks for the trickiest binding-key
shapes in the codebase: Doctor (leading '#', the bug above), Selfreaction
(mid-pattern '#', the shape with no NATS-subject equivalent at all), and
TeaTimer (a two-phase check - immediate confirmation, then the scheduled
event firing on its own via the JetStream-durable action_processing path,
with no new message sent to prompt it). Confirmed live: after this fix,
Doctor passes on munin (NATS) too, matching aero2k.de (AMQP) exactly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
src/distbot/common/routing.py
tests/muc_smoke_check.py
tests/test_unit/test_routing.py [new file with mode: 0644]