Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
statuses: write # goveralls posts the coverage status to the commit

steps:
- name: disable and stop mono-xsp4.service (wtf?)
Expand Down Expand Up @@ -64,10 +61,3 @@ jobs:
uses: golangci/golangci-lint-action@v9
with:
version: v2.15.0

- name: submit coverage
run: |
go install github.com/mattn/goveralls@latest
goveralls -service="github" -coverprofile="$GITHUB_WORKSPACE/profile.cov"
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions docs/backlog/telegram-run-counter-stuck-after-botinfo-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
worth: later
where: provider/telegram.go:TelegramHandler.Run
added: 2026-11-27
---
# Telegram Run keeps its running mark after a BotInfo error

`Run` increments `th.run` before calling `BotInfo` and returns on a `BotInfo` error without
decrementing it; only the `ctx.Done` branch does `th.run.Add(-1)`. After that error the handler still
counts as running, so `ProcessUpdate` refuses every later call with "Run goroutine should not be used
with ProcessUpdate", even though no `Run` loop exists. A caller that falls back to `ProcessUpdate` once
`Run` fails is stuck. Same code in `v2/provider/telegram.go`. Surfaced by the revmux round on the
coveralls-v2-only branch. The fix is a deferred decrement plus a test that fails `BotInfo` and then calls
`ProcessUpdate`. Moving the increment after `BotInfo` would not do: `ProcessUpdate` could then run
during initialization, while `Run` resets the request map.
14 changes: 14 additions & 0 deletions docs/backlog/telegram-test-setup-timeout-leaks-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
worth: later
where: provider/telegram_test.go:setupHandler
added: 2026-11-27
---
# Telegram test setup can leave Run running when its init wait times out

`setupHandler` starts `tg.Run` in a goroutine, then waits with `require.Eventually` for "Run did not
initialize". If that wait times out, `require` stops the test before the cleanup func that cancels the
context and waits for `Run` is returned, so cancel and join are skipped and `Run` can be left running
for the rest of the package's tests: blocked in `BotInfo`, or polling the mock. When `BotInfo` already
returned an error, `Run` has exited and nothing leaks. No run has hit the timeout so far. Same helper in `v2/provider/telegram_test.go`.
Surfaced by the revmux round on the coveralls-v2-only branch; the fix is registering the cancel and join
with `t.Cleanup` inside `setupHandler` before the wait.
17 changes: 17 additions & 0 deletions provider/telegram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strconv"
"strings"
"sync"
"sync/atomic"
"testing"
"time"

Expand Down Expand Up @@ -756,6 +757,22 @@ func TestTelegram_ProcessUpdateFlow(t *testing.T) {
<-runDone
}

func TestTelegram_GetUpdatesErrorKeepsPolling(t *testing.T) {
var calls atomic.Int32
m := &TelegramAPIMock{
GetUpdatesFunc: func(context.Context) (*telegramUpdate, error) {
calls.Add(1)
return nil, errors.New("telegram api unavailable")
},
BotInfoFunc: botInfoFunc,
}

_, cleanup := setupHandler(t, m)
t.Cleanup(cleanup)
require.Eventually(t, func() bool { return calls.Load() >= 2 }, 5*time.Second, time.Millisecond,
"polling stopped after a GetUpdates error")
}

func TestTelegram_TokenVerification(t *testing.T) {
m := &TelegramAPIMock{
GetUpdatesFunc: func(ctx context.Context) (*telegramUpdate, error) {
Expand Down
17 changes: 17 additions & 0 deletions v2/provider/telegram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strconv"
"strings"
"sync"
"sync/atomic"
"testing"
"time"

Expand Down Expand Up @@ -756,6 +757,22 @@ func TestTelegram_ProcessUpdateFlow(t *testing.T) {
<-runDone
}

func TestTelegram_GetUpdatesErrorKeepsPolling(t *testing.T) {
var calls atomic.Int32
m := &TelegramAPIMock{
GetUpdatesFunc: func(context.Context) (*telegramUpdate, error) {
calls.Add(1)
return nil, errors.New("telegram api unavailable")
},
BotInfoFunc: botInfoFunc,
}

_, cleanup := setupHandler(t, m)
t.Cleanup(cleanup)
require.Eventually(t, func() bool { return calls.Load() >= 2 }, 5*time.Second, time.Millisecond,
"polling stopped after a GetUpdates error")
}

func TestTelegram_TokenVerification(t *testing.T) {
m := &TelegramAPIMock{
GetUpdatesFunc: func(ctx context.Context) (*telegramUpdate, error) {
Expand Down
Loading