signal-bot/tests
Krzysztof kuhy Rudnicki 63f262bddd feat: survive an outage, and keep the counts that predate the event log
Two gaps kuhy pointed at, both about not losing messages the bot was not
awake for.

Missed *counts* already worked and now have a test saying so: an event
is keyed by Signal's own send timestamp, signal-cli keeps receiving in
json-rpc mode while the bot is down, and the replay on reconnect is
absorbed by the primary key. Messages sent during an outage come back
filed under the day they were actually sent.

Missed *reports* did not. A bot that was down at 21:37 never posted that
day and never went back for it. The last day reported is now written
down per group, so returning from an outage posts every day it owes,
oldest first, bounded at a week. A day nobody spoke on is marked settled
rather than reconsidered forever; a day whose send *failed* is
deliberately left unmarked so the next run retries it.

The pre-0.1.0 counter is carried over rather than discarded: 342
messages across four groups, 319 of them in the real group. What the
counter cannot say is when, so before assuming, four places were checked
for a real inbound timestamp -- journald (commands only), signal-cli's
account.db (19 tables, none inbound; message_send_log is the bot's own
outgoing resend buffer), Signal Desktop (unlinked, empty, and it does
not backfill on link), and signal-api/attachments (the one dated
artifact). The attachment mtimes put 12 files on 29 Aug against 79 on
30 Aug inside the counter's window, which is why the whole counter is
filed under 30 Aug rather than split.

That day is marked in group_meta, and a marked day claims no average
message length -- those messages have a count but no lengths, so
"średnio 0 znaków" would be a measurement nobody took. The mark is also
what will keep the day out of personal records: a merged 22-hour day
would otherwise hand somebody a record they never set.

render_day's options move into a DayView value object; the keyword list
had reached eight and this renderer is about to be shared by several
commands that each want a different subset.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015d48t4qsQLBJnDwDeo2Nom
2026-08-30 19:23:53 +02:00
..
__init__.py feat: rewrite the bot so it runs, and gate it like the other repos 2026-08-29 13:05:42 +02:00
conftest.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_allowlist.py feat: refuse to look healthy while deaf, and heal the container by itself 2026-08-29 19:01:55 +02:00
test_animals.py fix: !gekon really is random (iNaturalist ignores order_by=random) 2026-08-29 23:35:53 +02:00
test_announce.py feat: name every release after a pope, and tell the group when one lands 2026-08-29 22:51:20 +02:00
test_app.py fix: a signal-api that is not up yet no longer kills the bot at boot 2026-08-30 15:23:42 +02:00
test_bot.py feat: survive an outage, and keep the counts that predate the event log 2026-08-30 19:23:53 +02:00
test_changelog.py feat: name every release after a pope, and tell the group when one lands 2026-08-29 22:51:20 +02:00
test_cli.py feat: discover groups from the account, so adding the bot is the whole setup 2026-08-29 15:30:08 +02:00
test_config.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_counting.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_decorators.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_discovery.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_dispatcher.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_fake_account.py feat: refuse to look healthy while deaf, and heal the container by itself 2026-08-29 19:01:55 +02:00
test_fake_groups.py feat: discover groups from the account, so adding the bot is the whole setup 2026-08-29 15:30:08 +02:00
test_fake_server.py release: 0.0.7 «Telesfor» — !papież, and the bot can test itself 2026-08-30 17:06:25 +02:00
test_folding.py fix: commands resolve when typed on another alphabet's keyboard 2026-08-30 14:22:43 +02:00
test_healthz.py fix: a signal-api that is not up yet no longer kills the bot at boot 2026-08-30 15:23:42 +02:00
test_http_client.py feat: !gekon posts a research-grade gecko photo 2026-08-29 23:26:40 +02:00
test_liveness.py feat: refuse to look healthy while deaf, and heal the container by itself 2026-08-29 19:01:55 +02:00
test_main.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_membership.py feat: discover groups from the account, so adding the bot is the whole setup 2026-08-29 15:30:08 +02:00
test_models.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_popes_command.py release: 0.0.7 «Telesfor» — !papież, and the bot can test itself 2026-08-30 17:06:25 +02:00
test_portcheck.py feat: make the bot actually reply on Signal, and gate every way it went silent 2026-08-29 14:37:27 +02:00
test_portraits.py release: 0.0.7 «Telesfor» — !papież, and the bot can test itself 2026-08-30 17:06:25 +02:00
test_quoting.py feat: answer the message that asked, not just the room 2026-08-29 23:01:01 +02:00
test_registry.py release: 0.0.7 «Telesfor» — !papież, and the bot can test itself 2026-08-30 17:06:25 +02:00
test_scenario.py feat: answer the message that asked, not just the room 2026-08-29 23:01:01 +02:00
test_scheduler.py feat: rewrite the bot so it runs, and gate it like the other repos 2026-08-29 13:05:42 +02:00
test_selftest.py release: 0.0.7 «Telesfor» — !papież, and the bot can test itself 2026-08-30 17:06:25 +02:00
test_startup.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_stats_backfill.py feat: survive an outage, and keep the counts that predate the event log 2026-08-30 19:23:53 +02:00
test_stats_events.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_stats_nightly.py feat: survive an outage, and keep the counts that predate the event log 2026-08-30 19:23:53 +02:00
test_stats_periods.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_stats_render_day.py feat: survive an outage, and keep the counts that predate the event log 2026-08-30 19:23:53 +02:00
test_stats_text.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_store.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_transport_base.py feat: rewrite the bot so it runs, and gate it like the other repos 2026-08-29 13:05:42 +02:00
test_transport_fake.py feat: rewrite the bot so it runs, and gate it like the other repos 2026-08-29 13:05:42 +02:00
test_transport_rest.py feat: answer the message that asked, not just the room 2026-08-29 23:01:01 +02:00
test_trust.py feat: the message event log, and the nightly report built on it 2026-08-30 19:14:43 +02:00
test_versioning.py release: 0.0.7 «Telesfor» — !papież, and the bot can test itself 2026-08-30 17:06:25 +02:00