Commit0af64a92Recorded6 May 2026Repositoryapiary

Fix APIary smoke channel scope

Message

Provision smoke leader bots with #hive in their auto-join scope so newer Enclave bot channel policy allows JOIN, BATCH, and channel sends during smoke runs.

Update the live smoke driver to assert the current bare IRC-native mention form and add labeled smoke assertions so future assertion-recording failures identify the failing contract.

Verification:

  • PATH=/tmp/sigil-t-e6e9/build/dev/bin:/home/daviwil/.nix-profile/bin:/home/daviwil/.sigil/bin:/home/daviwil/.bin:/home/daviwil/.local/bin:/home/daviwil/.npm-global/bin:/home/daviwil/.guix-home/profile/bin:/home/daviwil/.guix-home/profile/sbin:/run/privileged/bin:/home/daviwil/.config/guix/current/bin:/home/daviwil/.guix-home/profile/bin:/home/daviwil/.guix-home/profile/sbin:/home/daviwil/.guix-profile/bin:/run/current-system/profile/bin:/run/current-system/profile/sbin test/smoke.sh
  • PATH=/tmp/sigil-t-e6e9/build/dev/bin:/home/daviwil/.nix-profile/bin:/home/daviwil/.sigil/bin:/home/daviwil/.bin:/home/daviwil/.local/bin:/home/daviwil/.npm-global/bin:/home/daviwil/.guix-home/profile/bin:/home/daviwil/.guix-home/profile/sbin:/run/privileged/bin:/home/daviwil/.config/guix/current/bin:/home/daviwil/.guix-home/profile/bin:/home/daviwil/.guix-home/profile/sbin:/home/daviwil/.guix-profile/bin:/run/current-system/profile/bin:/run/current-system/profile/sbin ENCLAVE_BIN=/home/daviwil/Projects/Code/sigil/enclave/build/dev/bin/enclave test/smoke-keepalive-integration.sh
  • /tmp/sigil-t-e6e9/build/dev/bin/sigil test
Changed
 test/smoke-driver.sgl               | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------
 test/smoke-keepalive-integration.sh |   2 +-
 test/smoke.sh                       |   2 +-
 3 files changed, 62 insertions(+), 42 deletions(-)
Diff
test/smoke-driver.sglmodified
@@ -208,6 +208,26 @@
208
(and (string? target) (> (string-length target) 0)
209
(substring target 1 (string-length target)))))
210
+211
(define (smoke-check label value)
+212
(let ((ok? (assert-true value)))
+213
(when (not ok?)
+214
(display (string-append "FAIL " label "\n")))
+215
ok?))
+216
+217
(define (smoke-check-false label value)
+218
(let ((ok? (assert-false value)))
+219
(when (not ok?)
+220
(display (string-append "FAIL " label "\n")))
+221
ok?))
+222
+223
(define (smoke-check-equal label expected actual)
+224
(let ((ok? (assert-equal expected actual)))
+225
(when (not ok?)
+226
(display (string-append "FAIL " label
+227
" expected=" (format "~a" expected)
+228
" actual=" (format "~a" actual) "\n")))
+229
ok?))
+230
231
(test-group "live bridge: connect + filter + listen-peer"
232
(test "leader bridge connects, broadcasts presence, applies filter"
233
(with-async
@@ -272,7 +292,7 @@
292
;; a second bot. Instead exercise listen-peer: add the peer
293
;; nick to the listened-peers set and confirm the predicate
294
;; flips.
275
(assert-false (trusted-sender? state "stranger"))
+295
(smoke-check-false "stranger-initially-untrusted" (trusted-sender? state "stranger"))
296
297
;; --- listen-peer mechanics (session-local) ---
298
;; Direct bridge-state mutation is exposed via setters, so we
@@ -280,10 +300,10 @@
300
(set-enclave-bridge-state-listened-peers!
301
state (cons "stranger"
302
(enclave-bridge-state-listened-peers state)))
283
(assert-true (trusted-sender? state "stranger"))
+303
(smoke-check "stranger-trusted-after-listen" (trusted-sender? state "stranger"))
304
(set-enclave-bridge-state-listened-peers!
305
state '())
286
(assert-false (trusted-sender? state "stranger"))
+306
(smoke-check-false "stranger-untrusted-after-unlisten" (trusted-sender? state "stranger"))
307
(display "PASS listen-peer-mutation\n")
308
309
;; --- Self-echo suppression check (state-level) ---
@@ -294,16 +314,16 @@
314
;; loops. Verify our own-nick is what we expect.
315
(let ((nick (enclave-conn-current-nick
316
(enclave-bridge-state-conn state))))
297
(assert-true (string-ci=? nick +leader-nick+)))
+317
(smoke-check "self-nick-known" (string-ci=? nick +leader-nick+)))
318
(display "PASS self-nick-known\n")
319
320
;; --- draft/multiline cap negotiated ---
321
;; The bridge ran negotiate-extra-caps! during enclave-connect;
322
;; assert the cap landed in the conn's caps-acked list.
323
(let ((conn (enclave-bridge-state-conn state)))
304
(assert-true (enclave-conn-cap-acked? conn "draft/multiline"))
305
(assert-true (enclave-conn-cap-acked? conn "batch"))
306
(assert-true (enclave-conn-cap-acked? conn "message-tags")))
+324
(smoke-check "cap-draft-multiline" (enclave-conn-cap-acked? conn "draft/multiline"))
+325
(smoke-check "cap-batch" (enclave-conn-cap-acked? conn "batch"))
+326
(smoke-check "cap-message-tags" (enclave-conn-cap-acked? conn "message-tags")))
327
(display "PASS multiline-cap-negotiated\n")
328
329
;; --- Bug A smoke: spawn-worker without explicit `groups`
@@ -320,7 +340,7 @@
340
groups: (or-empty-env #f "APIARY_WORKER_GROUP")
341
reports-to: +leader-nick+))
342
(status (or (assoc-ref "status" result) "?")))
323
(assert-equal "ok" status)
+343
(smoke-check-equal "spawn-worker-status" "ok" status)
344
;; Whois the new bot — verify it landed in the env-var
345
;; group. The whois response surfaces a `groups: <csv>` line.
346
(let* ((whois (enclave-services-call conn
@@ -332,7 +352,7 @@
352
(cons body
353
(if (list? lines) lines '()))
354
"\n")))
335
(assert-true
+355
(smoke-check "spawn-worker-group"
356
(string-contains? haystack "ops-workers"))))
357
(display "PASS bug-A-spawn-worker-default-groups\n")
358
@@ -351,8 +371,8 @@
371
(cons body
372
(if (list? lines) lines '()))
373
"\n")))
354
(assert-equal "ok" (or (assoc-ref "status" result) "?"))
355
(assert-true (string-contains? haystack "smoke-bee-1")))
+374
(smoke-check-equal "list-members-status" "ok" (or (assoc-ref "status" result) "?"))
+375
(smoke-check "list-members-has-worker" (string-contains? haystack "smoke-bee-1")))
376
(display "PASS bug-B-list-members-surfaces-subordinates\n")
377
378
;; --- Bug C smoke: send-message with markdown prose
@@ -364,16 +384,16 @@
384
"Got it via DM. The fix landed — does Goguma's conversations list now show this thread? That's the actual test — message delivery was always working...")
385
(result (enclave-bridge-send-dm! state "daviwil" trigger
386
format: 'markdown)))
367
(assert-true (string? result))
+387
(smoke-check "dm-result-string" (string? result))
388
;; Success path returns "DM to <nick>: ..." — error path
389
;; would start with "Error:".
370
(assert-false (string-starts-with? result "Error:")))
+390
(smoke-check-false "dm-result-not-error" (string-starts-with? result "Error:")))
391
(display "PASS bug-C-send-message-markdown-em-dash\n")
392
393
;; --- send-channel with multi-line text emits a BATCH ---
394
;; daviwil should observe BATCH +ref / N tagged PRIVMSGs /
375
;; BATCH -ref. The first body line carries an `@` mention
376
;; prefix because we passed mention: "daviwil".
+395
;; BATCH -ref. The first body line carries a bare IRC-native
+396
;; mention prefix because we passed mention: "daviwil".
397
(vector-set! captured-cell 0 '())
398
(enclave-bridge-send-channel! state "daviwil"
399
"first line of three\nsecond line of three\nthird line of three")
@@ -396,21 +416,21 @@
416
(irc-message-tag (captured-msg (car es)) "batch"))
417
(car es))
418
(else (scan (cdr es)))))))
399
(assert-true open)
400
(assert-true close)
401
(assert-equal +leader-nick+ (captured-sender open))
402
(assert-equal "draft/multiline" (captured-text open))
403
(assert-true
+419
(smoke-check "batch-open" open)
+420
(smoke-check "batch-close" close)
+421
(smoke-check-equal "batch-open-sender" +leader-nick+ (captured-sender open))
+422
(smoke-check-equal "batch-open-type" "draft/multiline" (captured-text open))
+423
(smoke-check "batch-first-line"
424
(find-text events
405
(lambda (t) (string=? t "@daviwil: first line of three"))))
406
(assert-true
+425
(lambda (t) (string=? t "daviwil: first line of three"))))
+426
(smoke-check "batch-second-line"
427
(find-text events
428
(lambda (t) (string=? t "second line of three"))))
409
(assert-true
+429
(smoke-check "batch-third-line"
430
(find-text events
431
(lambda (t) (string=? t "third line of three"))))
412
(assert-true tagged)
413
(assert-equal (event-batch-reftag open)
+432
(smoke-check "batch-tagged-privmsg" tagged)
+433
(smoke-check-equal "batch-reftag" (event-batch-reftag open)
434
(irc-message-tag (captured-msg tagged) "batch")))
435
(display "PASS multiline-batch-emit\n")
436
@@ -424,10 +444,10 @@
444
((null? es) #f)
445
((eq? (event-batch-kind (car es)) 'open) #t)
446
(else (scan (cdr es)))))))
427
(assert-true
+447
(smoke-check "single-line-content"
448
(find-text events
449
(lambda (t) (string=? t "single-line content"))))
430
(assert-false any-open))
+450
(smoke-check-false "single-line-no-open" any-open))
451
(display "PASS single-line-no-batch\n")
452
453
;; --- BATCH-rejection fallback: when the server FAILs the
@@ -449,8 +469,8 @@
469
"BATCH +zz0 unsupported/type #hive\r\n")
470
(sleep 0.2)
471
(let ((fail (enclave-conn-last-batch-fail conn)))
452
(assert-true fail)
453
(assert-equal "UNSUPPORTED_TYPE" (car fail))))
+472
(smoke-check "batch-fail-present" fail)
+473
(smoke-check-equal "batch-fail-code" "UNSUPPORTED_TYPE" (car fail))))
474
(display "PASS batch-fail-flag-set\n")
475
476
;; --- enclave-post-multiline returns 'sent-per-line when
@@ -468,20 +488,20 @@
488
(list "fallback line a"
489
"fallback line b"
490
"fallback line c"))))
471
(assert-equal 'sent-per-line outcome))
+491
(smoke-check-equal "fallback-outcome" 'sent-per-line outcome))
492
(sleep 0.5)
493
(let ((events (vector-ref captured-cell 0)))
474
(assert-true
+494
(smoke-check "fallback-line-a"
495
(find-text events
496
(lambda (t) (string=? t "fallback line a"))))
477
(assert-true
+497
(smoke-check "fallback-line-b"
498
(find-text events
499
(lambda (t) (string=? t "fallback line b"))))
480
(assert-true
+500
(smoke-check "fallback-line-c"
501
(find-text events
502
(lambda (t) (string=? t "fallback line c"))))
503
;; And NO BATCH should have been emitted.
484
(assert-false
+504
(smoke-check-false "fallback-no-batch-open"
505
(let scan ((es events))
506
(cond
507
((null? es) #f)
@@ -522,8 +542,8 @@
542
;; authoritative source.
543
(cond
544
(dm-msg
525
(assert-true (string?
526
(irc-message-tag (captured-msg dm-msg) "msgid"))))
+545
(smoke-check "dm-msgid-tag"
+546
(string? (irc-message-tag (captured-msg dm-msg) "msgid"))))
547
(else
548
;; No echo — the contract is asserted by enclave's
549
;; wire smoke. Soft-pass.
@@ -546,12 +566,12 @@
566
"+draft/react"))
567
(car es))
568
(else (scan (cdr es)))))))
549
(assert-true react)
550
(assert-equal "👍"
+569
(smoke-check "react-privmsg" react)
+570
(smoke-check-equal "react-tag" "👍"
571
(irc-message-tag (captured-msg react) "+draft/react"))
552
(assert-equal "👍"
+572
(smoke-check-equal "reaction-tag" "👍"
573
(irc-message-tag (captured-msg react) "+draft/reaction"))
554
(assert-equal "stub-msgid-12345"
+574
(smoke-check-equal "reply-tag" "stub-msgid-12345"
575
(irc-message-tag (captured-msg react) "+draft/reply")))
576
(display "PASS send-react-tagged\n")
577
test/smoke-keepalive-integration.shmodified
@@ -71,7 +71,7 @@ ENCLAVE_DB_PATH="$DB" "$ENCLAVE_BIN" \
71
user add daviwil --password "$DAVIWIL_PASS" --role admin > /dev/null
72
73
LEADER_OUT=$(ENCLAVE_DB_PATH="$DB" "$ENCLAVE_BIN" \
74
bot register leader-quinn --owner daviwil --allow-services yes)
+74
bot register leader-quinn --owner daviwil --allow-services yes --auto-join "#hive")
75
LEADER_TOKEN=$(echo "$LEADER_OUT" | grep -oE '[a-f0-9]{64}' | head -1)
76
if [ -z "$LEADER_TOKEN" ]; then
77
echo "FATAL: no leader-quinn token" >&2; exit 1
test/smoke.shmodified
@@ -66,7 +66,7 @@ ENCLAVE_DB_PATH="$DB" "$ENCLAVE_BIN" \
66
group create ops-workers > /dev/null 2>&1 || true
67
68
LEADER_OUT=$(ENCLAVE_DB_PATH="$DB" "$ENCLAVE_BIN" \
69
bot register leader-davos --owner daviwil --allow-services yes)
+69
bot register leader-davos --owner daviwil --allow-services yes --auto-join "#hive")
70
LEADER_TOKEN=$(echo "$LEADER_OUT" | grep -oE '[a-f0-9]{64}' | head -1)
71
[ -z "$LEADER_TOKEN" ] && { echo "FATAL: no leader-davos token" >&2; exit 1; }
72
echo " leader-davos token: ${LEADER_TOKEN:0:8}…(${#LEADER_TOKEN})"