fix: serialize team_name in StatboticsTeamEvent.toJson - #8
Conversation
StatboticsTeamEvent.fromJson decodes team_name, but toJson left it out, so a record cached through toJson and reloaded through fromJson lost the nickname. The on-device last-good cache round-trips through these two methods, and team_name is the one event-scoped name source (/teams ignores its event parameter), so the loss was silent. Add the field to toJson and two round-trip regression tests. On behalf of @Project516
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change preserves ChangesTeam name serialization
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to This localized change preserves team names during JSON caching and includes round-trip regression coverage; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
|
cc @Project516 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@CHANGELOG.md`:
- Around line 5-7: Rewrite the changelog sentence about
StatboticsTeamEvent.toJson and fromJson so it is grammatical and directly states
that toJson serializes team_name and fromJson preserves it during round trips.
Keep the existing context about nickname preservation without adding unrelated
details.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 840a2294-691d-4e1c-9596-adb53ec19265
📒 Files selected for processing (4)
CHANGELOG.mdlib/src/statbotics_models.dartpubspec.yamltest/statbotics_client_test.dart
Problem
StatboticsTeamEvent.fromJsondecodesteam_name, buttoJsonleft the field out. ThetoJsondoc comment claims the model "round-trips throughfromJsonfor the on-device last-good cache," and the README says models "round-trip throughtoJsonfor caching," so a cached record that survives a relaunch comes back with an emptyteamNameeven though/team_eventshad carried one.team_nameis the one event-scoped name source:/teamsaccepts aneventparameter and ignores it, answering with the global team list. So the loss is silent and the nickname cannot be recovered from any other endpoint thatStatboticsClientexposes.Repro
Fix
Add
'team_name': teamNametoStatboticsClient(well,lib/src/statbotics_models.dart)toJson, and two round-trip regression tests: one with a nickname, one empty. The empty-name test passes before the fix; the nickname test does not, and it guards the field going forward.dart analyzeis clean and the full suite passes (25 tests).Only
team_namewas at risk; every other field intoJsonalready round-tripped, so the added test also asserts the rest of the model.On behalf of @Project516
Summary by CodeRabbit
Bug Fixes
Chores