Repository navigation
User notifications, step 3: the sender of the notices to people - #98
Merged
Merged
Conversation
The outbox user_notice now drains through the people's bot. A pass leases the due rows that have the Telegram channel (a row for the app alone is never leased: the app pulls it), gathers one person's rows into one message per chat in the chat's language (panel language when it has none), loud when any line is loud and disable_notification otherwise, and skips announcements for a chat that said /mute. Kinds come from a registry (text and "still true" check) that the later steps fill; an unknown kind is dropped with a code, a stale one is skipped_stale. Pace is 20 messages a second per bot and one a second per chat. 429 stops the pass and puts the rows back at retry_after; a refused token (401) writes "unauthorized" on the bot's card and the queue waits, neither spends an attempt. 5xx or no answer retries after 1, 2, 4 ... 64 minutes and drops on the eighth failure. 403 or "chat not found" forgets the chat, and a person left with none gets "unlinked". The message ids are kept per chat row id (never the Telegram chat id), so a retry after a partial send does not repeat to the chats that have it. A pass cut short puts its rows back at once. The VPS runs the pass in a loop of Run; the edge tick runs one bounded pass after a one-row read (HasDueUserNotices). "Test" button of a chat: UserNotifyService.TestUserTelegramChat (owner and helper, like Unlink) sends a fixed text in the chat's language at once, outside the outbox; a blocked bot unlinks the chat. Texts in ru/en/zh/tr/fa. Edge: jobs Worker +87 KiB (253 KiB left under its limit), admin +36 KiB, public +16 KiB; no limit raised. The cron test counts one more D1 read per tick. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…let the next pass send the same notices again Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ces due to people Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 3 of user notifications (spec §5, §15): the sender of
user_noticethrough the people's bot.dropped, stale →skipped_stale.retry_after; 401 → "unauthorized" on the bot card, queue waits; both spend no attempt. 5xx/network → 1, 2, 4 … 64 min,droppedafter 8. 403/chat not found → chat forgotten,unlinkedif none left.tg_message_refsby chat row id (never the Telegram chat id); a retry skips chats that already got it. A pass ends within half its lease.TestUserTelegramChat(owner and helper): the "Test" button of a chat, one per 10 s per chat.Checks: go vet/test (telegram, store, auth, app), buf,
test-edge-store.ps1,check-edge-sizes.sh(jobs headroom 253 KiB, admin 2100 KiB, public 187 KiB).🤖 Generated with Claude Code