aboutsummaryrefslogtreecommitdiff
path: root/todo.org
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-27 21:55:39 -0500
committerCraig Jennings <c@cjennings.net>2026-05-27 21:55:39 -0500
commitbfec0eab1132b7713a35500323e06ebea2da17a4 (patch)
tree6a41cdb82ec097713d614126262c677eb546c8cd /todo.org
parent2a6ffb0e6a10fdf4fd42fe3e5689f300b25c7cf6 (diff)
downloaddotemacs-bfec0eab1132b7713a35500323e06ebea2da17a4.tar.gz
dotemacs-bfec0eab1132b7713a35500323e06ebea2da17a4.zip
test(signel): cover the JSON-RPC success-result dispatch contract
The fork commit (4740d97 in the signel fork) added a request-callback table, extended signel--send-rpc with an optional success-callback, and routed result responses through signel--dispatch. These tests lock that contract from the consuming project so a future fork change can't silently break the picker that will read listContacts through it. Five tests, Normal / Boundary / Error categories plus a reconnect-invalidation case: - result-invokes-callback (Normal): a result response with a registered id fires the callback with the value and removes the handler. - send-rpc-registers-success-callback (Normal): passing a success callback stores it under the returned id. - unknown-id-is-noop (Boundary): a result with no registered id is silent — no receive or error handler fires, map stays empty. - error-cleans-up-handler (Error): an error response removes the handler without firing the callback, so a retry starts clean. - stop-clears-handler-map: signel-stop empties the map, so a restart can't replay stale callbacks waiting on responses that will never arrive. The dispatch tests synthesize JSON alists directly. No live process is needed. The send-rpc test stubs get-process and process-send-string so it doesn't need a running signal-cli. Refactor audit on signel.el surfaced one unrelated pre-existing smell I'm not fixing here: signel--handle-error reads from signel--request-buffer-map but never remhashes, so error responses leak request-id → buffer-name entries. Filed as a separate [#C] follow-up under the Signal parent task; the maps clear on stop/start so the impact is bounded to a single live session. todo.org: the dispatch task flips to DOING (the fork commit is in, the test contract is locked) and gets the leak follow-up appended.
Diffstat (limited to 'todo.org')
-rw-r--r--todo.org5
1 files changed, 4 insertions, 1 deletions
diff --git a/todo.org b/todo.org
index 07fc9942..59c7d27c 100644
--- a/todo.org
+++ b/todo.org
@@ -53,9 +53,12 @@ Installed signal-cli 0.14.4.1 (AUR; imported AsamK's signing key FA10826A... to
*** TODO [#B] Contact picker command :feature:
=cj/signel-pick-contact=: call signal-cli =listContacts= over JSON-RPC, feed the result through =cj/signal--parse-contacts= (done), =completing-read= the labels, open the chosen recipient's chat. signel today opens by raw phone number only.
-*** TODO [#B] JSON-RPC success-result dispatch for signel :feature:
+*** DOING [#B] JSON-RPC success-result dispatch for signel :feature:
The contact picker needs =listContacts= results, but signel currently dispatches only =receive= notifications and RPC errors; successful =((id . N) (result . VALUE))= responses have no callback/result path. Add a request handler table or equivalent success-result dispatch in the fork, clean handlers up on success/error/reconnect, then build =cj/signel--fetch-contacts= on that contract. Review: [[file:docs/design/signal-client-review.org][docs/design/signal-client-review.org]].
+*** TODO [#C] signel--handle-error leaks request-buffer-map entries :bug:
+Surfaced during the JSON-RPC dispatch refactor audit. =signel--handle-error= reads =signel--request-buffer-map= by id but never =remhash='es the entry, so every error response leaves the request-id → buffer-name mapping behind for the life of the process. Low impact (the map clears on stop/start, and id collisions are unlikely at the counter scale), but unbounded growth in a long-lived session and inconsistent with how the new request-handler-map is cleaned up on error.
+
*** TODO [#B] Notify only for the unviewed conversation :feature:
Wire =cj/signal--should-notify-p= (done) into signel's =signel--handle-receive= notify block (signel.el:277), route through Craig's notify script instead of bare =notifications-notify=, and gate sound behind a defcustom that defaults off.