docs(android): note the empty-subscriptions PUT serialization gotcha #38

Merged
whitlocktech merged 1 commits from docs/notifications-empty-subscriptions-gotcha into main 2026-07-22 16:39:32 +00:00
Member

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/subscriptions validator requires streams (body('streams').isArray()), but kotlinx.serialization omits a property equal to its default (encodeDefaults=false), so a DTO field streams: List<String> = emptyList() was dropped when empty — the app sent {} and the server rejected it 400. Any non-empty set still included the field, so only the final toggle-off broke.

The lesson (generalized): any "replace the full set" PUT/POST whose 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

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/subscriptions` validator requires `streams` (`body('streams').isArray()`), but kotlinx.serialization omits a property equal to its default (`encodeDefaults=false`), so a DTO field `streams: List<String> = emptyList()` was dropped when empty — the app sent `{}` and the server rejected it `400`. Any non-empty set still included the field, so only the final toggle-off broke. **The lesson (generalized):** any "replace the full set" `PUT`/`POST` whose 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](https://claude.com/claude-code)
wtclaude added 1 commit 2026-07-22 16:38:09 +00:00
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>
whitlocktech approved these changes 2026-07-22 16:39:23 +00:00
whitlocktech merged commit 2686ade632 into main 2026-07-22 16:39:32 +00:00
whitlocktech deleted branch docs/notifications-empty-subscriptions-gotcha 2026-07-22 16:39:34 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: RunicGateway/docs#38
No description provided.