Skip to content

Add group management IQs and participant types - #268

Merged
jlucaso1 merged 1 commit into
mainfrom
feat-improve-groups-handlers
Feb 5, 2026
Merged

Add group management IQs and participant types#268
jlucaso1 merged 1 commit into
mainfrom
feat-improve-groups-handlers

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator

Implement multiple group management IqSpecs and helpers: SetGroupSubject,
SetGroupDescription, LeaveGroup, Add/Remove/Promote/DemoteParticipants, GetGroupInviteLink and ParticipantChangeResponse with parsing/builders.

Add DownloadParams in download.rs implementing Downloadable for raw media parameters.

Simplify logging calls by removing explicit target="Client" arguments.

Re-export Jid from crate root, update imports, and expose new group types
in features mod

Summary by CodeRabbit

Release Notes

New Features

  • Extended group management with subject and description editing, participant management (add, remove, promote, demote), group departure, and invite link retrieval
  • Introduced raw parameter-based download capability independent of message context
  • Added message read receipt marking functionality

@jlucaso1
jlucaso1 requested a review from Copilot February 5, 2026 23:24
@coderabbitai

coderabbitai Bot commented Feb 5, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR introduces comprehensive group management APIs with eight new operations, adds IQ specifications for participant management and metadata updates, enables downloads from raw parameters, and implements message read receipts. Additionally, it refactors logging invocations across handlers and client code to remove explicit target specifications, and updates the message-processing flow to handle critical nodes inline.

Changes

Cohort / File(s) Summary
Group Management Operations
src/features/groups.rs, wacore/src/iq/groups.rs
Added eight new group management methods (set_subject, set_description, leave, add_participants, remove_participants, promote_participants, demote_participants, get_invite_link) and their corresponding IQ specs, enabling participant modifications, metadata updates, and invite link operations.
Public API Exports
src/features/mod.rs, src/lib.rs
Expanded public re-exports to include GroupDescription, GroupSubject, ParticipantChangeResponse, and Jid; reflects new group management capabilities in the public interface.
Logging Refactors
src/client.rs, src/handlers/ib.rs, src/handlers/iq.rs, src/handlers/notification.rs, src/handshake.rs
Removed explicit logging target specifications from log and warn macro invocations across multiple handler files and core client code; changes affect log metadata attribution without altering observable behavior.
Client Message Processing
src/client.rs
Refactored message-processing loop to handle critical nodes ("success", "failure", "stream:error") inline for deterministic login state updates, while non-critical nodes are processed in spawned tasks for concurrency; updated frame processing with explicit transport receiver handling and decoder ordering.
Download Capability
src/download.rs
Added download_from_params() public method and DownloadParams struct to enable downloads using raw media parameters without an originating message, reusing the existing download pipeline.
Read Receipt Support
src/receipt.rs
Implemented mark_as_read() public method to send read receipts with support for single or multiple message IDs and optional participant attribution.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through group chats now,
With subjects set and members bowed,
Receipts marked clear, downloads swift,
The logging cleaned—a tidy gift!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.75% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add group management IQs and participant types' directly and accurately summarizes the main changes, which focus on introducing group management IQ specifications and participant-related types.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat-improve-groups-handlers

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.

Implement multiple group management IqSpecs and helpers:
SetGroupSubject,
SetGroupDescription, LeaveGroup, Add/Remove/Promote/DemoteParticipants,
GetGroupInviteLink and ParticipantChangeResponse with parsing/builders.

Add DownloadParams in download.rs implementing Downloadable for raw
media parameters.

Simplify logging calls by removing explicit target="Client" arguments.

Re-export Jid from crate root, update imports, and expose new group
types
in features mod
@jlucaso1
jlucaso1 force-pushed the feat-improve-groups-handlers branch from 43ec4d1 to a92a0b8 Compare February 5, 2026 23:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements comprehensive group management functionality for WhatsApp, including operations to modify group settings, manage participants, and handle group invitations. It also adds the ability to download media from raw parameters and simplifies logging by removing redundant explicit target specifications.

Changes:

  • Implemented 7 new IQ specifications for group management: SetGroupSubject, SetGroupDescription, LeaveGroup, Add/Remove/Promote/DemoteParticipants, and GetGroupInviteLink
  • Added ParticipantChangeResponse type with ProtocolNode implementation for parsing participant operation responses
  • Introduced DownloadParams struct to enable downloading media from raw parameters without requiring the original message
  • Simplified logging calls by removing explicit target="Client" arguments throughout the codebase while preserving specific context targets
  • Added mark_as_read method to Client for sending read receipts
  • Exposed Jid and new group types (GroupSubject, GroupDescription, ParticipantChangeResponse) in public API

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
wacore/src/iq/groups.rs Core implementation of 7 new group management IQ specs with ParticipantChangeResponse type and comprehensive test coverage
src/features/groups.rs Public API methods for group management operations (set_subject, set_description, leave, add/remove/promote/demote participants, get_invite_link)
src/download.rs Added DownloadParams struct and download_from_params method for downloading media from raw parameters
src/receipt.rs Implemented mark_as_read method for sending read receipts with batch support
src/handshake.rs Simplified logging by removing explicit target="Client"
src/handlers/notification.rs Simplified logging and removed redundant comment
src/handlers/iq.rs Simplified logging
src/handlers/ib.rs Simplified logging
src/client.rs Simplified logging throughout the file
src/lib.rs Re-exported Jid and new group types from crate root
src/features/mod.rs Updated exports to include GroupSubject, GroupDescription, and ParticipantChangeResponse

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

@github-actions

github-actions Bot commented Feb 5, 2026

Copy link
Copy Markdown

🐰 Bencher Report

Branchfeat-improve-groups-handlers
Testbedubuntu-latest

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
binary_benchmark::unpack_group::bench_unpack_compressedInstructions
instructions x 1e3
📈 plot
🚷 threshold
🚨 alert (🔔)
555.72 x 1e3
(+8.36%)Baseline: 512.86 x 1e3
538.50 x 1e3
(103.20%)

Click to view all benchmark results
BenchmarkInstructionsBenchmark Result
instructions
(Result Δ%)
Upper Boundary
instructions
(Limit %)
binary_benchmark::attr_parser_group::bench_attr_parser attr_lookup:setup_attr_marshaled()📈 view plot
🚷 view threshold
7,011.00
(-3.40%)Baseline: 7,257.45
7,620.32
(92.00%)
binary_benchmark::child_iteration_group::bench_get_children_by_tag📈 view plot
🚷 view threshold
848,370.00
(-0.38%)Baseline: 851,604.55
894,184.77
(94.88%)
binary_benchmark::jid_optimization_group::bench_jid_to_owned_access jid_access:setup_jid_heavy_marshaled()📈 view plot
🚷 view threshold
24,760.00
(-0.54%)Baseline: 24,895.14
26,139.90
(94.72%)
binary_benchmark::marshal_group::bench_marshal_allocating📈 view plot
🚷 view threshold
127,234.00
(-7.28%)Baseline: 137,225.86
144,087.15
(88.30%)
binary_benchmark::marshal_group::bench_marshal_long_string📈 view plot
🚷 view threshold
19,576.00
(+0.16%)Baseline: 19,544.44
20,521.66
(95.39%)
binary_benchmark::marshal_group::bench_marshal_reusing_buffer📈 view plot
🚷 view threshold
127,334.00
(-7.28%)Baseline: 137,326.45
144,192.77
(88.31%)
binary_benchmark::roundtrip_group::bench_roundtrip large:setup_large_marshaled()📈 view plot
🚷 view threshold
106,440.00
(+0.14%)Baseline: 106,286.68
111,601.01
(95.38%)
binary_benchmark::roundtrip_group::bench_roundtrip small:setup_small_marshaled()📈 view plot
🚷 view threshold
8,495.00
(+0.09%)Baseline: 8,487.64
8,912.02
(95.32%)
binary_benchmark::unmarshal_group::bench_unmarshal large:setup_large_marshaled()📈 view plot
🚷 view threshold
49,137.00
(-0.64%)Baseline: 49,452.86
51,925.50
(94.63%)
binary_benchmark::unmarshal_group::bench_unmarshal small:setup_small_marshaled()📈 view plot
🚷 view threshold
3,017.00
(-4.12%)Baseline: 3,146.63
3,303.96
(91.31%)
binary_benchmark::unpack_group::bench_unpack_compressed📈 view plot
🚷 view threshold
🚨 view alert (🔔)
555,716.00
(+8.36%)Baseline: 512,856.83
538,499.67
(103.20%)

binary_benchmark::unpack_group::bench_unpack_uncompressed📈 view plot
🚷 view threshold
771.00
(-0.97%)Baseline: 778.53
817.46
(94.32%)
libsignal_benchmark::conversation_group::bench_full_dm_conversation full:setup_conversation_data()📈 view plot
🚷 view threshold
27,574,520.00
(-0.67%)Baseline: 27,759,962.58
29,147,960.71
(94.60%)
libsignal_benchmark::dm_group::bench_dm_decrypt_first_message decrypt_prekey:setup_dm_with_first_message()📈 view plot
🚷 view threshold
5,540,334.00
(-0.50%)Baseline: 5,568,156.60
5,846,564.43
(94.76%)
libsignal_benchmark::dm_group::bench_dm_encrypt_first_message first_msg:setup_dm_session()📈 view plot
🚷 view threshold
178,106.00
(+0.09%)Baseline: 177,944.10
186,841.30
(95.32%)
libsignal_benchmark::dm_group::bench_dm_encrypt_subsequent_message subsequent:setup_established_dm_session()📈 view plot
🚷 view threshold
178,917.00
(+0.09%)Baseline: 178,756.06
187,693.86
(95.32%)
libsignal_benchmark::dm_group::bench_dm_session_establishment setup:setup_dm_users()📈 view plot
🚷 view threshold
17,263,891.00
(-0.15%)Baseline: 17,290,504.79
18,155,030.03
(95.09%)
libsignal_benchmark::group_messaging_group::bench_group_create_distribution_message create:setup_group_sender()📈 view plot
🚷 view threshold
295,894.00
(+0.04%)Baseline: 295,787.69
310,577.08
(95.27%)
libsignal_benchmark::group_messaging_group::bench_group_decrypt_message decrypt:setup_group_with_encrypted_message()📈 view plot
🚷 view threshold
12,745,885.00
(+1.19%)Baseline: 12,595,462.50
13,225,235.62
(96.38%)
libsignal_benchmark::group_messaging_group::bench_group_encrypt_message encrypt:setup_group_with_distribution()📈 view plot
🚷 view threshold
715,619.00
(-0.04%)Baseline: 715,911.04
751,706.59
(95.20%)
libsignal_benchmark::session_optimization_group::bench_decrypt_with_previous_session previous_session:setup_with_archived_sessions()📈 view plot
🚷 view threshold
41,833.00
(+0.14%)Baseline: 41,774.85
43,863.59
(95.37%)
libsignal_benchmark::session_optimization_group::bench_message_key_eviction eviction:setup_message_key_eviction()📈 view plot
🚷 view threshold
15,561,842.00
(+0.00%)Baseline: 15,561,178.67
16,339,237.60
(95.24%)
libsignal_benchmark::session_optimization_group::bench_out_of_order_decryption out_of_order:setup_out_of_order_messages()📈 view plot
🚷 view threshold
5,504,889.00
(-0.45%)Baseline: 5,529,613.33
5,806,094.00
(94.81%)
libsignal_benchmark::session_optimization_group::bench_promote_matching_session promote:setup_promote_matching_session()📈 view plot
🚷 view threshold
956,786.00
(-0.88%)Baseline: 965,264.70
1,013,527.93
(94.40%)
libsignal_benchmark::signature_group::bench_key_generation keygen📈 view plot
🚷 view threshold
2,822,769.00
(-0.02%)Baseline: 2,823,311.76
2,964,477.35
(95.22%)
libsignal_benchmark::signature_group::bench_signature_creation sign:setup_keypair_with_message()📈 view plot
🚷 view threshold
3,444,364.00
(-4.21%)Baseline: 3,595,787.53
3,775,576.91
(91.23%)
libsignal_benchmark::signature_group::bench_signature_verification verify:setup_keypair_with_message()📈 view plot
🚷 view threshold
125,387,875.00
(-0.00%)Baseline: 125,394,058.47
131,663,761.39
(95.23%)
reporting_token_benchmark::content_extraction_group::bench_content_extraction extended:setup_extended_message()📈 view plot
🚷 view threshold
11,669.00
(-1.16%)Baseline: 11,805.54
12,395.82
(94.14%)
reporting_token_benchmark::content_extraction_group::bench_content_extraction simple:setup_simple_message()📈 view plot
🚷 view threshold
3,774.00
(-1.45%)Baseline: 3,829.61
4,021.10
(93.86%)
reporting_token_benchmark::full_generation_group::bench_full_token_generation extended:setup_full_gen_extended()📈 view plot
🚷 view threshold
87,781.00
(-0.25%)Baseline: 88,002.55
92,402.68
(95.00%)
reporting_token_benchmark::full_generation_group::bench_full_token_generation simple:setup_full_gen_simple()📈 view plot
🚷 view threshold
79,909.00
(-0.18%)Baseline: 80,049.63
84,052.11
(95.07%)
reporting_token_benchmark::key_derivation_group::bench_key_derivation📈 view plot
🚷 view threshold
51,010.00
(-0.05%)Baseline: 51,033.80
53,585.48
(95.19%)
reporting_token_benchmark::message_encoding_group::bench_message_encoding extended:setup_extended_message()📈 view plot
🚷 view threshold
5,753.00
(+0.36%)Baseline: 5,732.49
6,019.12
(95.58%)
reporting_token_benchmark::message_encoding_group::bench_message_encoding simple:setup_simple_message()📈 view plot
🚷 view threshold
2,109.00
(-0.33%)Baseline: 2,116.07
2,221.88
(94.92%)
reporting_token_benchmark::token_calculation_group::bench_token_calculation📈 view plot
🚷 view threshold
21,920.00
(+0.04%)Baseline: 21,910.47
23,005.99
(95.28%)
🐰 View full continuous benchmarking report in Bencher

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/features/groups.rs`:
- Around line 156-232: The mutating group methods (set_subject, set_description,
leave, add_participants, remove_participants, promote_participants,
demote_participants, and get_invite_link when reset=true) must acquire the
per-chat lock from Client::chat_locks before calling client.execute to avoid
races; update each method to obtain the per-chat lock for the target jid (using
the same locking API/pattern already used elsewhere in the codebase) and hold
that guard while calling the corresponding IQ executor (e.g.,
SetGroupSubjectIq::new, SetGroupDescriptionIq::new, LeaveGroupIq::new,
AddParticipantsIq::new, RemoveParticipantsIq::new, PromoteParticipantsIq::new,
DemoteParticipantsIq::new, GetGroupInviteLinkIq::new) so the execute calls are
serialized per-chat.

Comment thread src/features/groups.rs
@jlucaso1
jlucaso1 merged commit 7f779cd into main Feb 5, 2026
5 checks passed
@jlucaso1
jlucaso1 deleted the feat-improve-groups-handlers branch February 5, 2026 23:50
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