fix(types): make ElementAttributes.url optional#57
Conversation
Animoji/sticker elements arrive from the server without a `url` field, so the strict `url: str` validation raises ValidationError and breaks login sync. The server returns such elements without `url`, so the model is stricter than the protocol itself.
|
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 (1)
📝 WalkthroughWalkthrough
ChangesElement Attributes Type Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 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 |
|
Да, такая проблема есть (причем это не единичный случай) |
Проблема
У элементов-анимоджи и стикеров в ответе сервера поля
urlнет. Из-за строгой моделиElementAttributes.url: strэто даётValidationErrorи ломает синхронизацию при логине, когда в истории/сообщениях встречаются такие элементы.Сервер реально отдаёт
ElementAttributesбезurl, то есть модель сейчас строже самого протокола.Изменение
Делает
urlопциональным — по аналогии с уже опциональными полями вElement(from_,attributes). Обратной несовместимости нет: у элементов сurlвсё работает как прежде.Контекст
Гоняем PyMax в проде как HTTP-шлюз к MAX. В 2.1.2 вы уже приняли два фикса, которые мы держали локальными патчами (
LoginResponse.token→ Optional и guardif response.token is not Noneвapp.py) — спасибо! Это последний оставшийся патч, после мержа сможем выпилить локальное патчирование полностью.Summary by CodeRabbit