Skip to content

fix(chat): migrate legacy UserProfile phone/email on decode#1047

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/chat-legacy-userprofile-migration
Jul 9, 2026
Merged

fix(chat): migrate legacy UserProfile phone/email on decode#1047
bmc08gt merged 1 commit into
code/cashfrom
fix/chat-legacy-userprofile-migration

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Chat member profiles persisted before phone/email were modeled as VerifiableContactMethod stored verifiedPhoneNumber/verifiedEmailAddress as plain strings. After the migration those keys no longer matched, and since the new nullable fields had no defaults, kotlinx.serialization treated them as required and threw MissingFieldException on decode, crashing chat loads for upgrading users.

Decode through a tolerant compat DTO that carries both the current and legacy keys, migrating a present legacy string to a verified VerifiableContactMethod. Add null defaults to the new fields and wrap the decode in runCatching as a backstop against future schema drift.

Chat member profiles persisted before phone/email were modeled as
VerifiableContactMethod stored verifiedPhoneNumber/verifiedEmailAddress
as plain strings. After the migration those keys no longer matched, and
since the new nullable fields had no defaults, kotlinx.serialization
treated them as required and threw MissingFieldException on decode,
crashing chat loads for upgrading users.

Decode through a tolerant compat DTO that carries both the current and
legacy keys, migrating a present legacy string to a verified
VerifiableContactMethod. Add null defaults to the new fields and wrap
the decode in runCatching as a backstop against future schema drift.

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
@bmc08gt bmc08gt self-assigned this Jul 9, 2026
@bmc08gt bmc08gt merged commit 1aef209 into code/cash Jul 9, 2026
3 checks passed
@github-actions github-actions Bot added the type: fix Bug fix label Jul 9, 2026
@bmc08gt bmc08gt deleted the fix/chat-legacy-userprofile-migration branch July 9, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant