fix: parse bot account profiles#66
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe ChangesUser Model Field Type Expansion
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
|
Спасибо за PR! |
Описание
Боты MAX в ответе
get_userприсылаютgenderчисловым кодом, аweb_app—строкой-ссылкой вместо объекта. Из-за строгих типов модели
Usermodel_validateпадает сValidationError, и контакт-бот не подтягивается(воспроизводится на боте «Алиса AI»).
Расширяю типы двух полей:
gender: str | int | Noneweb_app: dict[str, Any] | str | NoneВариант
dictуweb_appсохранён для обратной совместимости. Обратнойнесовместимости нет: у обычных пользователей и у профилей с прежними типами
всё работает как раньше.
Тип изменений
Связанные задачи / Issue
Ссылка на issue, если есть: #
Тестирование
Добавлены регрессионные тесты в
tests/domain/test_user_models.py:Запуск:
Summary by CodeRabbit
Improvements
Tests