docs(android): note the empty-subscriptions PUT serialization gotcha #38
Reference in New Issue
Block a user
No description provided.
Delete Branch "docs/notifications-empty-subscriptions-gotcha"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Records a good-to-keep bug class in
docs/android/PLAN.md§11 (Push notifications → App).The bug: clearing your last notification subscription failed with "could not save" and the toggle stuck. The
PUT /auth/me/notifications/subscriptionsvalidator requiresstreams(body('streams').isArray()), but kotlinx.serialization omits a property equal to its default (encodeDefaults=false), so a DTO fieldstreams: List<String> = emptyList()was dropped when empty — the app sent{}and the server rejected it400. Any non-empty set still included the field, so only the final toggle-off broke.The lesson (generalized): any "replace the full set"
PUT/POSTwhose empty value equals a DTO default will silently drop the field — prefer no default on required request fields so kotlinx always encodes them.Companion to Android-app PR #25 (
fix/notifications-empty-subscriptions), which applies the fix and was verified on-device against the live site.AI-assisted: authored with Claude Code (disclosed per org policy).
🤖 Generated with Claude Code
Record the "can't turn off the last notification" class of bug in PLAN.md §11: the PUT /auth/me/notifications/subscriptions validator requires `streams`, so an empty set must serialize as {"streams":[]} not {}. kotlinx.serialization drops a property equal to its default (encodeDefaults=false), so a request DTO field defaulting to emptyList() gets omitted when empty and the server rejects it 400. Generalized to any "replace the full set" PUT/POST whose empty value equals a DTO default. Documents the fix in Android-app fix/notifications-empty-subscriptions. Co-Authored-By: Claude <noreply@anthropic.com>