Skip to content

Conversation

@gabrieljablonski
Copy link
Member

@gabrieljablonski gabrieljablonski commented Oct 24, 2025

…inbox creation

Pull Request Template

Description

Please include a summary of the change and issue(s) fixed. Also, mention relevant motivation, context, and any dependencies that this change requires.
Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

This change is Reviewable

Summary by CodeRabbit

  • Bug Fixes
    • Improved Instagram contact identification to ensure proper tracking and attribution of conversations.

@gabrieljablonski gabrieljablonski self-assigned this Oct 24, 2025
Copilot AI review requested due to automatic review settings October 24, 2025 21:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue with Instagram contact inbox creation by ensuring the contact identifier is properly set. The change adds the Instagram ID as the identifier field when creating contact attributes, which is essential for proper contact tracking and management.

Key Changes:

  • Added identifier field to contact attributes during Instagram contact inbox creation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai
Copy link

coderabbitai bot commented Oct 24, 2025

Walkthrough

The change modifies the Channel::Instagram#create_contact_inbox method to include an identifier field set to instagram_id when creating contact attributes. This addition allows the Instagram channel to track contacts via their unique Instagram identifier.

Changes

Cohort / File(s) Summary
Instagram Contact Identifier
app/models/channel/instagram.rb
Added identifier: instagram_id to contact_attributes in the create_contact_inbox method

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single attribute addition to an existing data structure
  • No logic changes or control flow modifications

Poem

🐰 A little ID, so neat and tidy,
Instagram contacts now tagged Friday!
With identifier bright, their names align—
Our rabbit's work makes contact records shine! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix(instagram): include identifier in contact attributes for contact" directly corresponds to the main change in the changeset, which adds identifier: instagram_id to the contact_attributes in the Channel::Instagram#create_contact_inbox method. The title is concise, specific, and uses clear language ("include identifier in contact attributes") that accurately conveys the primary modification without ambiguity. A teammate reviewing the commit history would immediately understand that this change addresses an identifier-related fix for Instagram contacts.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gabrieljablonski/fix-identifier-for-instagram-contact

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ff5834 and f9a3a4a.

📒 Files selected for processing (1)
  • app/models/channel/instagram.rb (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rb

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rb: Ruby: Follow RuboCop rules (150 character max line length)
Error Handling: Use custom exceptions instead of generic ones when raising
Ruby Best Practices: Use compact module/class definitions; avoid nested styles

Files:

  • app/models/channel/instagram.rb
**/app/models/**/*.rb

📄 CodeRabbit inference engine (AGENTS.md)

Models: Validate presence/uniqueness on relevant attributes

Files:

  • app/models/channel/instagram.rb
🧬 Code graph analysis (1)
app/models/channel/instagram.rb (2)
app/jobs/webhooks/instagram_events_job.rb (1)
  • instagram_id (68-74)
app/services/instagram/read_status_service.rb (1)
  • instagram_id (10-12)
🔇 Additional comments (1)
app/models/channel/instagram.rb (1)

37-43: Verify channel consistency before approving identifier addition.

The identifier field is valid and properly indexed in the Contact model with a unique constraint per account. However, this change creates inconsistency: Instagram now adds identifier: instagram_id, but Facebook (which also creates Instagram contacts) does not, nor do Twitter and Web Widget channels.

Additionally, no test specs were found specifically covering create_contact_inbox methods across channels.

Before merging:

  1. Confirm intent: Is adding identifier to Instagram intentional, or should other channels (especially Facebook) also include it?
  2. Test coverage: Add or verify tests for this change in spec/models/channel/instagram_spec.rb or similar.
  3. Data consistency: Clarify impact on existing Instagram contacts without identifiers.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gabrieljablonski gabrieljablonski merged commit f12b77c into main Oct 26, 2025
3 checks passed
@gabrieljablonski gabrieljablonski deleted the gabrieljablonski/fix-identifier-for-instagram-contact branch October 26, 2025 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants