Skip to content

Add name quality tracking to prevent display name flip-flopping#885

Open
jlxq0 wants to merge 1 commit intomautrix:mainfrom
jlxq0:name-quality-tracking
Open

Add name quality tracking to prevent display name flip-flopping#885
jlxq0 wants to merge 1 commit intomautrix:mainfrom
jlxq0:name-quality-tracking

Conversation

@jlxq0
Copy link
Copy Markdown

@jlxq0 jlxq0 commented Jan 21, 2026

Track the "quality" of display name sources to prevent lower-quality names from overwriting higher-quality ones. This fixes the issue where contacts constantly flip between different name formats when WhatsApp events contain different subsets of contact data.

Quality hierarchy (highest to lowest):

  • FullName (contact list name) - most stable, user-preferred
  • BusinessName (WhatsApp Business account name) - stable
  • Phone number - stable fallback
  • PushName (user's self-set name) - can change frequently

Also prevents updating to empty names entirely.

Inspired by the similar contact_list_names implementation in mautrix-signal.

Tested in my production.

Track the "quality" of display name sources to prevent lower-quality
names from overwriting higher-quality ones. This fixes the issue where
contacts constantly flip between different name formats when WhatsApp
events contain different subsets of contact data.

Quality hierarchy (highest to lowest):
- FullName (contact list name) - most stable, user-preferred
- BusinessName (WhatsApp Business account name) - stable
- Phone number - stable fallback
- PushName (user's self-set name) - can change frequently

Also prevents updating to empty names entirely.

Inspired by the similar contact_list_names implementation in mautrix-signal.
@mrclauss
Copy link
Copy Markdown

Hmm, I'm not sure you want to put PushName above Phone number in priorities. That effectively results in PushName never being used in most scenarios, doesn't it?

Personally I'd rather like to have PushNames when available, since most of my contacts have at least their first name in the profile, while I hardly know their mobile phone numbers from memory.

@jlxq0
Copy link
Copy Markdown
Author

jlxq0 commented Jan 28, 2026

Fair point. The flip-flopping I was trying to fix was mainly FullName ↔ PushName oscillation (e.g., "John Smith" vs "John"), not PushName vs phone number.

I could try to make two changes:

  1. Make the hierarchy configurable:
bridge:
  name_quality_order:
    - full_name
    - business_name
    - push_name
    - phone
  1. Make quality tracking opt-in (off by default):
bridge:
  name_quality_tracking: false

That way the default behavior stays unchanged, and users experiencing flip-flopping can opt-in with their preferred hierarchy. Would that work better?

@mrclauss
Copy link
Copy Markdown

Sounds like a good idea to me. But let's see what @tulir thinks of this pull request first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants