-
-
Notifications
You must be signed in to change notification settings - Fork 124
perf!: skipped keys out of the protobuf chain, MessageInfo 968→536 B, inline message ids #1390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
05c5ff4
5853a1c
01c6da5
5e06bf5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -423,7 +423,7 @@ impl Client { | |
|
|
||
| ChatMessageId { | ||
| chat, | ||
| id: id.to_owned(), | ||
| id: id.into(), | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,29 +89,27 @@ impl Client { | |
| wacore::telemetry::recv("decrypted"); | ||
| self.stats.record_message_received(); | ||
|
|
||
| let mut info = Arc::clone(info); | ||
| if info.ephemeral_expiration.is_none() | ||
| && let Some(exp) = msg.get_base_message().get_ephemeral_expiration() | ||
| { | ||
| Arc::make_mut(&mut info).ephemeral_expiration = Some(exp); | ||
| } | ||
| // Both ride on the `InboundMessage`, not the shared `MessageInfo`: | ||
| // writing them into the `Arc` every `<enc>` of the stanza holds | ||
| // deep-copied the whole info on every disappearing-chat message. | ||
| let ephemeral_expiration = msg.get_base_message().get_ephemeral_expiration(); | ||
|
|
||
| // Keep this ordered with dispatch; add-on messages can immediately | ||
| // reference the secret from the stanza just processed. | ||
| self.maybe_capture_inbound_msg_secret(&msg, &info).await; | ||
| self.maybe_capture_inbound_msg_secret(&msg, info).await; | ||
| let decrypted = self | ||
| .maybe_decrypt_secret_encrypted_message(&msg, &info) | ||
| .maybe_decrypt_secret_encrypted_message(&msg, info) | ||
| .await; | ||
| // A decrypted comment surfaces as its inner body Message, which has no | ||
| // slot for the parent post key; carry the threading link on the info. | ||
| if decrypted.is_some() | ||
| && let Some(target) = msg | ||
| .enc_comment_message | ||
| // slot for the parent post key; carry the threading link beside it. | ||
| let comment_target = if decrypted.is_some() { | ||
| msg.enc_comment_message | ||
| .as_option() | ||
| .and_then(|c| c.target_message_key.as_option().cloned()) | ||
| { | ||
| Arc::make_mut(&mut info).comment_target = Some(target); | ||
| } | ||
| .map(Box::new) | ||
| } else { | ||
| None | ||
| }; | ||
| let dispatch_msg = Arc::new(decrypted.unwrap_or(msg)); | ||
|
|
||
| // Newsletters never enter the commit pipeline: the plaintext stanza | ||
|
|
@@ -126,7 +124,9 @@ impl Client { | |
| .messages(Arc::from([wacore::types::events::InboundMessage::builder( | ||
| ) | ||
| .message(dispatch_msg) | ||
| .info(info) | ||
| .info(Arc::clone(info)) | ||
| .maybe_ephemeral_expiration(ephemeral_expiration) | ||
| .maybe_comment_target(comment_target) | ||
|
Comment on lines
+127
to
+129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- repository convention and learning scopes ---'
find /tmp/coderabbit-repo-knowledge/oxidezap-whatsapp-rust-0f309e03 -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- changed dispatch section ---'
cat -n src/message/dispatch.rs | sed -n '80,165p'
printf '%s\n' '--- bound MessageContext implementation ---'
rg -n -A35 -B10 'MessageContext|from_inbound|on_message' src/bot.rs srcRepository: oxidezap/whatsapp-rust Length of output: 50379 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- scoped repository rules ---'
for f in /tmp/coderabbit-repo-knowledge/oxidezap-whatsapp-rust-0f309e03/conventions/*.md /tmp/coderabbit-repo-knowledge/oxidezap-whatsapp-rust-0f309e03/*/*.md; do
[ -f "$f" ] || continue
case "$f" in
*conventions*/*|*learnings*/*|*architecture*/*) cat "$f";;
esac
doneRepository: oxidezap/whatsapp-rust Length of output: 17959 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- direct metadata definitions and consumers ---'
rg -n -A20 -B12 'ephemeral_expiration|comment_target' src/message src/bot.rs
printf '%s\n' '--- inbound construction and context call sites ---'
rg -n -A25 -B15 'InboundMessage|from_inbound|MessageContext' srcRepository: oxidezap/whatsapp-rust Length of output: 50379 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- InboundMessage and MessageInfo definitions ---'
rg -n -A45 -B10 'pub struct InboundMessage|struct InboundMessage|pub struct MessageInfo|struct MessageInfo|comment_target|ephemeral_expiration' wacore/src src/types
printf '%s\n' '--- event-to-bot conversion and public context access ---'
cat -n src/bot.rs | sed -n '1040,1067p'
rg -n -A20 -B10 'pub struct InboundMessage|impl.*InboundMessage|pub struct MessageInfo|impl.*MessageInfo' wacore/src srcRepository: oxidezap/whatsapp-rust Length of output: 50380 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- exact definitions by filename ---'
fd -t f -e rs . | while read -r f; do
if rg -q 'struct InboundMessage|struct MessageInfo' "$f"; then
printf '%s\n' "--- $f"
rg -n -A35 -B8 'struct InboundMessage|struct MessageInfo' "$f"
fi
doneRepository: oxidezap/whatsapp-rust Length of output: 6703 Preserve inbound metadata in
🤖 Prompt for AI Agents |
||
| .build()])) | ||
| .origin(wacore::types::events::BatchOrigin::Live) | ||
| .build(), | ||
|
|
@@ -141,7 +141,9 @@ impl Client { | |
| self.commit_or_batch_inbound( | ||
| wacore::types::events::InboundMessage::builder() | ||
| .message(dispatch_msg) | ||
| .info(info) | ||
| .info(Arc::clone(info)) | ||
| .maybe_ephemeral_expiration(ephemeral_expiration) | ||
| .maybe_comment_target(comment_target) | ||
| .build(), | ||
| track_commit, | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Preserve
ephemeral_expirationandcomment_targetwhen convertingInboundMessageintoMessageContext.from_inboundcurrently forwards onlymessageandinfo, so callbacks lose both fields even though this dispatch now populates them.Prompt for AI agents