mirror of
https://github.com/logos-co/logos-protocol.git
synced 2026-08-27 12:01:15 +00:00
An EMPTY event name means "every event on this object". LogosObject::onEvent
has always honoured it -- RemoteEventHelper appends the callbacks registered
under QString() to every dispatch, and PlainEventSubSharingTest.
ANamedAndAWildcardSubscriberEachGetOneCopy already pins that on the plain
transport. onEventWhenAvailable refused it.
There was no reason for the refusal, and I looked for one before removing it:
* the guard is a single `objectName.isEmpty() || eventName.isEmpty() ||
!callback` line from the original commit (#47), whose message never
mentions wildcards;
* nothing anywhere asserted the refusal;
* the registry already carries empty event names -- whenObjectAvailable()
adds its readiness entries with exactly that, so add(), takeMatching(),
pending() and reviveArmed() have always handled them;
* the arm path is `handle->onEvent(e.eventName, e.callback)`, which passes
the name straight through, so the wildcard needs no code of its own.
It was a category error: an empty objectName and a null callback are unusable,
while an empty eventName is meaningful. Lumping the three together silently
denied the deferred path to every hand-rolled wildcard subscriber, leaving them
on exactly the one-shot requestObject() + onEvent() this class exists to
replace. logoscore's `watch <module>` with no --event is one such caller, and
had to route around it through whenObjectAvailable().
pendingEventSubscriptions() now renders a wildcard as `<module>::(any)` rather
than a truncated `<module>::`.
Three tests, in the style of the file: subscribe-before-publish (firing two
DIFFERENT event names, because one would pass for a subscription that merely
matched the empty string against nothing), its publish-first control, and the
refusals that REMAIN -- pinned so widening the guard cannot quietly widen it
further, including that a refusal still ANSWERS via onArmed(false) rather than
going quiet.
Negative control: with the tests present and the guard restored, both wildcard
tests fail and the refusal test still passes. With the change, the full suite
is green (540 tests).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>