V17.4.0 — auto-restart, setwebhook control command, deployment docs
Reliability
- Auto-restart on fatal bot
'error'event with exponential backoff (3 s, 6 s, 12 s, 24 s, 48 s, capped at 60 s; surrenders after 8 attempts with anode.error). The restart goes throughabortBotthen a fullcreateTelegramBot, which rebuilds thehttp.Agent(orSocksProxyAgent) so stale keep-alive sockets and dead proxy connections are flushed. - Single-flight guard on
restartPolling. Burstpolling_errorevents now queue at most one 3 s restart instead of stacking N parallel ones — eliminating the "12 cycles in 3 minutes" pattern @petermeter69 reported in #442.
Features
- Control node "setwebhook" command for dynamic webhook URL updates (#410):
Emptymsg.payload = { command: "setwebhook", url: "https://new-tunnel.example/bot", options: { ... } }urlcallsdeleteWebHook. Success surfaces asmsg.payload.result, failure asmsg.error. Only meaningful in webhook mode — Telegram rejectssetWebHookwhile polling is active.
Hardening
bot.setMaxListeners(0)(unlimited, hides leaks) →setMaxListeners(50)(covers realistic per-bot listener counts, still catches future regressions of the listener-tracking work).
Documentation
- New top-level
DEPLOYMENT.mdcovering automated / git-managed deployment patterns. Closes the docs half of #432 —credentialSecretinsettings.js, three deployment patterns, common pitfalls. - Architecture documentation set under
doc/architecture/added during the 17.3 cycle (8 chapters + 9 ADRs documenting major design decisions and the V17.2 / V17.3 hardening work).
Test infrastructure (assembled across V17.3.x → V17.4.0)
npm testruns 204 cases in ~6 seconds via mocha + chai + c8 + node-red-node-test-helper.- A loopback HTTP fixture (
test/fixtures/telegram-mock.js) impersonatesapi.telegram.orgfor integration tests of the live polling, sending, andsetWebHookpaths. - CI workflow at
.github/workflows/ci.ymlruns lint + test on Node 18 / 20 / 22 on every push and PR, plus a coverage job that uploadslcov.infoas a build artifact.
Overall coverage at release: 70.6 % statement / 68.4 % branch / 84.9 % function. lib/ aggregate at 99.2 %, converter.js and safe-stringify.js at 100 %.
Remaining open items
out-node.jsper-type switch — 43 % coverage, ~50 case branches. The natural pairing with the recommended table-driven refactor (see doc/architecture/recommendations-for-refactoring.md §2) — refactor + data-driven test together would push this past 95 %.- A handful of Dependabot advisories on the deprecated
requeststack used transitively bynode-telegram-bot-api. The durable cure is an upstream refresh;tough-cookiewas the only one resolvable viaoverrides.