iachat/spec/services
Gabriel Jablonski 521ce90e79
fix(whatsapp): consolidate fragmented phone/LID contacts to prevent lost messages (#241)
* fix(whatsapp): consolidate fragmented phone/LID contacts to prevent lost messages

When a WhatsApp user had two separate contacts (one by phone, one by LID)
with different contact_ids, the consolidation service did nothing. This caused
update_contact_info to crash with a phone_number uniqueness violation, silently
dropping incoming messages.

Now properly merges the two contacts by treating the phone contact as canonical,
moving conversations from the LID contact, and cleaning up duplicates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(whatsapp): address CodeRabbit review feedback

- Destroy orphaned LID contact when it has no remaining contact_inboxes
- Clarify spec comment to past-tense (no longer an active bug)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(whatsapp): route legacy-source contact_inbox into merge path

When a phone contact_inbox has a non-standard source_id (legacy format)
and a separate LID contact_inbox exists for a different contact,
the consolidation now merges them instead of early-returning.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: assert orphaned LID contact is destroyed in legacy-source spec

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 19:20:11 -03:00
..
account Revert "chore: Upgrade Rails to 7.2.2 and update Gemfile dependencies (#11037)" 2026-02-03 21:09:42 -08:00
audio feat: add audio transcoding support for WhatsApp Cloud API (#220) 2026-02-22 16:21:50 -03:00
auto_assignment fix: Enforce team boundaries to prevent cross-team assignments (#13353) 2026-02-16 14:39:20 +05:30
automation_rules feat: mensagens agendadas (#198) 2026-01-30 22:08:16 -03:00
contacts Chore/merge upstream 4.8.0 (#150) 2025-11-19 16:25:58 -03:00
conversations Chore/merge upstream 4.8.0 (#150) 2025-11-19 16:25:58 -03:00
crm/leadsquared Merge branch main into chore/merge-upstream 2025-12-20 12:44:31 -03:00
email fix: email delivery in Email::SendOnEmailService (#217) 2026-02-18 16:23:13 -03:00
facebook feat: Add message support for input_select type in Facebook (#11627) 2025-06-10 16:15:11 +05:30
google chore: apply Rails/SaveBang cop (#15) 2025-04-03 23:29:24 -03:00
imap feat: Add configurable interval for IMAP sync (#9302) 2024-04-25 18:58:20 -07:00
instagram feat: Handle instagram test service (#11244) 2025-04-11 19:11:29 +05:30
internal feat: add job to remove stale contacts and contact_inboxes (#11186) 2025-03-28 12:18:39 +05:30
labels fix: Update associations when a label is updated (#3046) 2021-09-21 10:16:32 +05:30
line fix: Ensure messages go to correct conversation when receive multi user in 1 LINE webhook (#12322) 2025-09-22 17:05:25 +05:30
linear feat: Whatsapp embedded signup (#11612) 2025-07-14 21:37:06 -07:00
liquid feat: Add liquid processing for SMS campaigns (#10981) 2025-06-11 13:16:44 -04:00
llm_formatter Chore/merge upstream 4.8.0 (#150) 2025-11-19 16:25:58 -03:00
macros feat: Add webhook event support for macros (#11235) 2025-04-02 20:26:55 -07:00
mailbox Chore/merge upstream 4.8.0 (#150) 2025-11-19 16:25:58 -03:00
message_templates Merge branch 'main' into chore/merge-upstream-4.11.0 2026-02-17 23:05:26 -03:00
messages feat: add per-account daily rate limit for outbound emails (#13411) 2026-02-03 02:06:51 +05:30
mfa feat: MFA (#12290) 2025-09-18 20:19:24 +05:30
microsoft chore: apply Rails/SaveBang cop (#15) 2025-04-03 23:29:24 -03:00
notification chore: Disable email notifications for unconfirmed users (#10964) 2025-02-24 12:14:40 -08:00
sms Merge branch 'main' into chore/merge-upstream-4.5.0 2025-08-20 11:20:31 -03:00
telegram Revert "chore: Upgrade Rails to 7.2.2 and update Gemfile dependencies (#11037)" 2026-02-03 21:09:42 -08:00
tiktok feat: TikTok channel (#12741) 2025-12-17 07:54:50 -08:00
twilio Merge branch 'main' into chore/merge-upstream-4.10 2026-01-16 14:01:53 -03:00
twitter chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
whatsapp fix(whatsapp): consolidate fragmented phone/LID contacts to prevent lost messages (#241) 2026-03-19 19:20:11 -03:00
widget Chore/merge upstream 4.8.0 (#150) 2025-11-19 16:25:58 -03:00
account_deletion_service_spec.rb fix(account-deletion): normalize deleted email suffix and handle collisions safely (#13472) 2026-02-07 17:29:27 -08:00
action_service_spec.rb feat: mensagens agendadas (#198) 2026-01-30 22:08:16 -03:00
base_token_service_spec.rb feat: MFA (#12290) 2025-09-18 20:19:24 +05:30
csat_survey_service_spec.rb feat: Implement existing template linking for CSAT surveys (#218) 2026-02-18 18:00:29 -03:00
search_service_spec.rb Merge branch 'main' into chore/merge-upstream-4.10 2026-01-16 14:01:53 -03:00