fix: harden durable Telegram delivery#38
Conversation
| import pytest | ||
| from aiogram import Dispatcher, Router | ||
|
|
||
| import telegram_resender.storage as storage_module |
| assert bot.attempts == 1 | ||
| assert second_message.answers == [RU_MESSAGES.request_in_progress] | ||
| bot.release.set() | ||
| await first |
| bot.release.set() | ||
|
|
||
| with pytest.raises(RuntimeError, match="temporary delivery failure"): | ||
| await first_confirm |
| from telegram_resender.storage import RequestLog, export_records_csv | ||
| import pytest | ||
|
|
||
| import telegram_resender.storage as storage_module |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 330ee8b8b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| owner_token, owner_version, owner_expires_at | ||
| FROM pending_requests | ||
| WHERE chat_id = ? AND user_id = ? AND expires_at > ? | ||
| AND owner_token IS NULL {request_predicate} |
There was a problem hiding this comment.
Do not skip the newest claimed preview for bare confirms
When a user has multiple pending previews and the newest one is already claimed by an in-flight /confirm, this owner_token IS NULL filter removes that newest row before ORDER BY version DESC, so a second /confirm without an ID claims and forwards the next older unclaimed request instead. The prompt says bare commands apply to the latest request; in this scenario they should report that the latest request is in progress rather than silently delivering a stale preview.
Useful? React with 👍 / 👎.
Summary
py -3.12 -m pytest -p no:cacheprovider(112 passed, 87.16% coverage)py -3.12 -m ruff check src testspy -3.12 -m ruff format --check src testspy -3.12 -m mypy srcpy -3.12 -m compileall -q src testspy -3.12 -m pip checkpy -3.12 -m build --no-isolationReliability details
pip-auditCVE ignores now that the lock uses aiogram 3.29.0 and aiohttp 3.14.1.Checklist