• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bots-go-framework / bots-fw / 29445037336
28%

Build:
DEFAULT BRANCH: main
Ran 15 Jul 2026 07:35PM UTC
Jobs 1
Files 76
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

15 Jul 2026 07:34PM UTC coverage: 23.363% (+0.2%) from 23.153%
29445037336

push

github

web-flow
feat(botsfw): add SendGate so a platform can refuse a send (#80)

bots-fw currently sends unconditionally, from code a platform cannot intercept.
That is safe on Telegram, where a bot may message any chat it knows at any time -
but that is a Telegram property, not a universal one.

WhatsApp permits free-form messages only within 24 hours of the recipient's last
reply. Outside that window a send fails with error 131047, and only a pre-approved
template may be delivered. Today a platform has no way to say "not now", so the
router would spend an API call to earn a rejection - or worse, deliver a billable
template the app never intended.

SendGate is an OPTIONAL interface on WebhookResponder:

    type SendGate interface {
        CanSend(c context.Context, m botmsg.MessageFromBot) error
    }

A responder that does not implement it is treated as always permitting, so this
is additive rather than breaking. Verified: bots-fw-telegram builds and its tests
pass unchanged against this commit (via a temporary local replace).

This deliberately does NOT change WebhookResponder.SendMessage's signature, which
was the original proposal in the gap analysis. An optional interface achieves the
same refusal without breaking every existing responder, and gates BEFORE the send
rather than reporting after it - which matters when the attempt itself costs money.

Routed the three unconditional send sites through the seam:
- router.go processCommandResponse - every command response
- router.go - the "Unknown Type=%d" message
- driver.go - the panic handler, which pushes up to 3KB of stack trace into the
  user's chat. Best-effort: the panic is already logged and sent to analytics, so
  a refusal here is a warning, not an error.

Refusals log at Warning, not Error: a gated platform declining an unsolicited
message is the system working as designed, not a failure.

Tests: 8 new, covering the compatibility guarantee (ungated responders always
permit), that a refused send reach... (continued)

24 of 42 new or added lines in 3 files covered. (57.14%)

1238 of 5299 relevant lines covered (23.36%)

0.28 hits per line

Uncovered Changes

Lines Coverage ∆ File
11
21.98
-0.79% botswebhook/driver.go
7
87.36
-0.81% botswebhook/router.go
Jobs
ID Job ID Ran Files Coverage
1 29445037336.1 15 Jul 2026 07:34PM UTC 76
23.36
GitHub Action Run
Source Files on build 29445037336
  • Tree
  • List 76
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 21cf9527 on github
  • Prev Build on main (#29390846669)
  • Next Build on main (#29475483533)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc