Skip to content

Refresh BlueBubbles contacts and reconcile room participant profiles - #238

Open
chrisbutler wants to merge 1 commit into
mautrix:masterfrom
chrisbutler:fix/bluebubbles-contact-sync
Open

chrisbutler wants to merge 1 commit into
mautrix:masterfrom
chrisbutler:fix/bluebubbles-contact-sync

Conversation

@chrisbutler

Copy link
Copy Markdown

BlueBubbles contact names and photos can remain stale after the Mac address book changes. Updating a ghost's global profile also does not reliably refresh its per-room membership profile, so the same person can have a correct name in a direct chat and a phone number in a group.

This refreshes the BlueBubbles cache before the existing hourly sync, updates existing ghosts at startup and during periodic sync, and reconciles existing unified (any) direct rooms and joined group participant profiles. Group changes preserve membership and extension fields, skip already-current profiles, retain existing photos when the source has none, and verify writes by reading the member state back. No rooms are created by contact updates. Custom name overrides remain respected.

The connector now serializes refreshes, protects cache readers, retains its previous cache on transient empty/error responses, tolerates a missing avatar, and avoids dumping full contact/photo records into trace logs. Ongoing refresh uses the existing bridge.periodic_sync setting; it must be enabled for hourly updates. Contact or photo deletion is deliberately not propagated as destructive profile removal.

Validation:

  • go test ./... passed on macOS arm64.
  • go test -race ./imessage/bluebubbles passed.
  • HTTP/SQLite regression tests cover contact updates, empty/error responses, concurrent cache access, legacy/unified DM lookup without portal creation, stale group names/photos, idempotency, departed/invited members, extension preservation, write failure/retry, and mismatched readback.
  • The same contact behavior is deployed on a BlueBubbles-backed installation; 269 stale membership profiles across 126 group rooms were repaired with successful readback and zero group-sync failures.

This PR contains only contact synchronization changes. Implementation and tests were developed with Codex assistance and exercised locally; no user contact data or room IDs are included.

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.

1 participant