signal-bot/signal_bot/stats
Krzysztof kuhy Rudnicki 8df2646377 feat: weekly, monthly and year-in-review posts, keyed off the day reported
A Sunday closes a week, a month's last day closes the month, and
31 December closes the year. Keyed off the day being *reported* rather
than off today, which is the only reading that stays right when the bot
has been offline: catching up on a week-old Sunday now also posts that
week's summary, and there is a test asserting the five messages a
three-day outage produces.

One scheduler, a date predicate. Three background tasks firing at the
same wall-clock time into the same group is three independent ways for
an evening to go wrong, for no gain over an if-statement. A failed
period summary is deliberately best-effort and runs after the day has
been marked, so it cannot make the bot re-post the daily one tomorrow.

Also: the quote frame arrived while this was being written, and it
carries a trap. `quote` has its own nested `attachments` array holding
the *quoted* message's media -- so a text reply to somebody's photo has
attachments in the payload that belong to somebody else. Reading them
would credit the replier with a photo they did not post, in a group
where people reply to photos constantly, inflating one number without
ever looking wrong.

The parser already read the top level only and is correct. It is now
pinned by a test built from the exact captured frame, and written up in
DOCS-signal-envelopes.md, because "it happens to be right" and "it
cannot silently stop being right" are different things. This is the same
wrong-nesting-level mistake that once made the bot ignore its own
stickers.

test_bot.py went past the 250-line cap on the way, so the report and
catch-up tests move into files named for what they cover.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015d48t4qsQLBJnDwDeo2Nom
2026-08-30 19:56:25 +02:00
..
__init__.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
backfill.py feat: survive an outage, and keep the counts that predate the event log 2026-08-30 19:23:53 +02:00
commands.py feat: nine commands for asking the statistics questions 2026-08-30 19:49:41 +02:00
curiosities.py feat: the nightly post notices things 2026-08-30 19:43:55 +02:00
events.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
facts.py feat: the nightly post notices things 2026-08-30 19:43:55 +02:00
highlights.py feat: nine commands for asking the statistics questions 2026-08-30 19:49:41 +02:00
nightly.py feat: weekly, monthly and year-in-review posts, keyed off the day reported 2026-08-30 19:56:25 +02:00
periods.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
queries_day.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
queries_period.py feat: periods, records and the crown 2026-08-30 19:38:54 +02:00
recorder.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
records.py feat: the nightly post notices things 2026-08-30 19:43:55 +02:00
render_day.py feat: survive an outage, and keep the counts that predate the event log 2026-08-30 19:23:53 +02:00
render_extra.py feat: nine commands for asking the statistics questions 2026-08-30 19:49:41 +02:00
render_period.py feat: nine commands for asking the statistics questions 2026-08-30 19:49:41 +02:00
streaks.py feat: periods, records and the crown 2026-08-30 19:38:54 +02:00
text.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00