channel.member.list returns 'User undefined' when row's data JSON lacks user_id (read schema columns instead) #34
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_collab#34
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Symptom
Channel detail panel renders one or more members as "User undefined". Surfaced during dogfooding while testing a
viewer_testaccount in#general.Root cause
channel.member.list(crates/hero_collab_server/src/handlers/channel.rs::member_list) readuser_idandchannel_idONLY from the JSONcm.datablob. Those fields are also schema columns onchannel_members(the PK is(channel_id, user_id)with FK tousers.id), but the handler ignored them and trusted the data blob.When a
channel_members.datarow was ever written without those fields properly serialised — buggy migration, manual SQL, or a test fixture — the response carried nouser_id, and the client'smember.user_id-keyed lookups fell through to the "User undefined" / "Unknown" fallbacks at chat-app.js:3121 and :3817.The specific corrupted row in this case was a test fixture I inserted during canvas read-only testing:
The
dataJSON omitteduser_id/channel_id, exposing the latent fragility.Why the schema column is the right source
channel_members.user_idis part of the primary key. Cannot be NULL.users.id. Cannot disagree with the joined user.datablob ever DID disagree with the schema column, that's corruption — and the schema column is the answer.Fix in
PR linked below. Server-side only; the client renderers work correctly once
user_idis reliably in the response.