Dev/2.3.1#68
Conversation
MAX bots send `gender` as a numeric code and `web_app` as a URL string instead of an object, so `User.model_validate` raised a ValidationError and the bot user failed to load. Widen both field types (gender: str | int, web_app: dict | str) and add regression tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix: parse bot account profiles
📝 WalkthroughWalkthroughPyMax 2.3.1 adds a message forwarding API ( ChangesPyMax 2.3.1 Release
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/messages.rst (1)
69-74:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winGuard the
message.forward()example whenchat_idis missing.
Message.forward()depends on a source chat from the bound message; in partial events this can be absent, causing a runtime failure in copied examples.Suggested doc fix
`@client.on_message`() async def on_message(message: Message, client: Client) -> None: await message.answer("Ответ в тот же чат") await message.reply("Ответ реплаем") - await message.forward(chat_id=654321) + if message.chat_id is not None: + await message.forward(chat_id=654321)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/messages.rst` around lines 69 - 74, The `message.forward()` call in the on_message handler example lacks protection for cases where the message lacks a source chat context (in partial events), which would cause a runtime failure. Add a conditional guard before the `message.forward(chat_id=654321)` invocation to verify that the message has a valid source chat context available, and only proceed with the forward operation when this context is present, ensuring the example is safe for all event scenarios.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@docs/messages.rst`:
- Around line 69-74: The `message.forward()` call in the on_message handler
example lacks protection for cases where the message lacks a source chat context
(in partial events), which would cause a runtime failure. Add a conditional
guard before the `message.forward(chat_id=654321)` invocation to verify that the
message has a valid source chat context available, and only proceed with the
forward operation when this context is present, ensuring the example is safe for
all event scenarios.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 66b64c84-1da5-4a67-9416-2f4052fee9f7
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (18)
docs/client.rstdocs/index.rstdocs/messages.rstdocs/release-2-3-1.rstpyproject.tomlsrc/pymax/__init__.pysrc/pymax/api/messages/payloads.pysrc/pymax/api/messages/service.pysrc/pymax/infra/message.pysrc/pymax/protocol/tcp/compression.pysrc/pymax/protocol/tcp/payload.pysrc/pymax/protocol/tcp/protocol.pysrc/pymax/types/domain/message.pysrc/pymax/types/domain/user.pytests/api/test_message_service.pytests/domain/test_bound_models.pytests/domain/test_user_models.pytests/protocol/test_protocols.py
Описание
Подготавливает PyMax 2.3.1: добавляет пересылку сообщений, исправляет декодирование сжатых TCP payload-ов и разбор профилей bot-аккаунтов. Обновляет документацию, patch notes и версию пакета.
Тип изменений
Связанные задачи / Issue
#66
#67
Summary by CodeRabbit
New Features
Bug Fixes
Dependencies
Documentation