Skip to content

chore(proto): bump WhatsApp protocol surface to 2.3000.1042742319 - #1001

Merged
jlucaso1 merged 9 commits into
mainfrom
claude/whatsapp-rust-whatspec-review-p7w53u
Jul 8, 2026
Merged

chore(proto): bump WhatsApp protocol surface to 2.3000.1042742319#1001
jlucaso1 merged 9 commits into
mainfrom
claude/whatsapp-rust-whatspec-review-p7w53u

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Updates the whatspec-generated artifacts and the pinned client version from 2.3000.1040878135 to 2.3000.1042742319 (latest live web.whatsapp.com bundle).

Regenerated artifacts (copied verbatim from whatspec)

  • wacore/src/iq/abprops.rs — A/B-props registry
  • wacore/src/iq/mex_operations.rs — typed mex (GraphQL) operations
  • wacore/appstate/src/schemas.rs — AppState (syncd) action schemas
  • waproto/src/whatsapp.proto — protobuf schema (+ regenerated whatsapp.desc / whatsapp.desc.sha256)

Code changes required by the new protocol surface

  • Version bump: default app_version tertiary → 1042742319 (wacore/src/store/device.rs).
  • Kyber prekey fields: the new proto adds kyberPreKeyId / kyberCiphertext to PreKeySignalMessage and PendingPreKey. Both are initialized to None — post-quantum prekeys are not implemented, so this preserves the classic X3DH behavior while keeping the struct literals valid.
  • LID migration messages retained: WhatsApp dropped LIDMigrationMapping and LIDMigrationMappingSyncPayload from the public JS bundle, but the wire still carries them as the protobuf-encoded payload of LIDMigrationMappingSyncMessage. They are kept in the proto (with a comment) so the existing LID-migration decode/encode path keeps working.
  • Provenance comments: removed the stale reverse-engineering version reference (2.3000.1042386815) from the shortcake / pair-success comments.

Verification

  • cargo fmt --all --check — clean
  • cargo clippy --all --tests — clean
  • cargo build --all — ok
  • wacore-libsignal (128) + waproto (12) tests pass
  • LID-migration tests pass (exercise the retained proto messages end-to-end)

Depends on the companion whatspec regeneration (same branch) that produced these files.

Refresh the whatspec-generated artifacts and the pinned client version:

- Copy the regenerated reference modules verbatim from whatspec: the
  A/B-props registry (wacore/src/iq/abprops.rs), typed mex operations
  (wacore/src/iq/mex_operations.rs), AppState action schemas
  (wacore/appstate/src/schemas.rs) and the protobuf schema
  (waproto/src/whatsapp.proto, plus the regenerated .desc/.sha256).
- Bump the default app_version tertiary to 1042742319.
- Initialize the new Kyber prekey fields (kyber_pre_key_id,
  kyber_ciphertext) added to PreKeySignalMessage/PendingPreKey; they
  stay None since post-quantum prekeys are not implemented.
- Retain LIDMigrationMapping/LIDMigrationMappingSyncPayload in the proto:
  WA dropped them from the public bundle, but the wire still carries them
  as the encoded LIDMigrationMappingSyncMessage payload.
- Drop the stale reverse-engineering version references from the
  shortcake/pair-success provenance comments.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b7742bba-9656-465c-be01-d26e399428b3

📥 Commits

Reviewing files that changed from the base of the PR and between 8c91acc and a3d1bb1.

📒 Files selected for processing (1)
  • tests/e2e/tests/session_reuse.rs

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for pinned newsletter messages and related pin/unpin actions.
    • Introduced additional backup and device-migration capabilities for improved account continuity.
    • Updated message and status handling to support newer app behaviors.
  • Bug Fixes

    • Improved session handling to better preserve message delivery across device and account migrations.
    • Refined privacy-token and first-contact behavior for more accurate recipient addressing.
  • Tests

    • Expanded end-to-end coverage for session storage, migration durability, and undecryptable-message handling.

Walkthrough

This PR refreshes generated WhatsApp protocol and contract surfaces, adds new schema and MEX entries, initializes Kyber placeholders, updates LID session coverage, and bumps a device version constant.

Changes

Protocol and schema regeneration

Layer / File(s) Summary
Proto schema updates
waproto/src/whatsapp.proto, waproto/src/whatsapp.desc.sha256
Adds defaults, tightens required fields, introduces backup/encryption/LID-migration/sync-action messages, and updates the stored checksum values.
Kyber field initialization
wacore/libsignal/src/protocol/protocol.rs, wacore/libsignal/src/protocol/state/session.rs
Initializes Kyber prekey fields to None in the signal message and session prekey constructors.
Appstate schema registry
wacore/appstate/src/schemas.rs
Clears AVATAR_UPDATED payload metadata, adds STATUS_PRIVACY enum mappings, and registers WASA_ROOT_SECRET in ALL.
Mex operation refresh
wacore/src/iq/mex_operations.rs
Updates DOC_IDs and reshapes query contracts for AI agent, report appeal, group info, native ads, newsletter, enforcements, reports, and related module removals.
Labyrinth and newsletter mutations
wacore/src/iq/mex_operations.rs
Adds Labyrinth backup/snapshot/upload mutations and newsletter pin/unpin mutations with typed request, response, and thread metadata contracts.
LID session keying tests
tests/e2e/tests/lid_sessions.rs
Updates session key formatting and adds regression coverage for companion-device keying and PN-to-LID migration durability.
Version constant and comment refreshes
wacore/src/store/device.rs, wacore/src/pair.rs, wacore/src/shortcake.rs
Updates the tertiary app version default and removes stale version strings from comments.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Suggested labels: size-increase-ok

Suggested reviewers: cubic-dev-ai

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: bumping the WhatsApp protocol surface to 2.3000.1042742319.
Description check ✅ Passed The description is directly related to the protocol bump and the regenerated artifacts and code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/whatsapp-rust-whatspec-review-p7w53u

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.

@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown

Greptile Summary

Bumps the pinned WhatsApp client version from 2.3000.1040878135 to 2.3000.1042742319 and regenerates all whatspec-produced artifacts (proto schema, A/B-props, mex operations, AppState schemas).

  • Proto additions: new Labyrinth backup-crypto messages (CreateBackupInput/Output, EncryptMessageInput/Output, EncryptedSecretValuesOutput, VirtualDeviceOutput, LabyrinthWaCommand), WASARootSecretAction and CoexV2VersionAction in SyncActionValue, Kyber prekey fields on PreKeySignalMessage and SessionStructure.PendingPreKey, and four new WebMessageInfo.Status values.
  • Code changes: Kyber fields initialized to None (PQ unimplemented, X3DH preserved); app_version_tertiary bumped in device.rs; stale version pin removed from pair.rs / shortcake.rs comments; AVATAR_UPDATED schema cleared (no handler code touched it), STATUS_PRIVACY enum fields enriched, WASA_ROOT_SECRET schema added.
  • E2e test fixes: correct device-0 addressing assumptions to use the peer's real companion device ID, add is_from_me guard to assert_no_event closures, fix LID to-attribute assertions to use to_non_ad_string(), add two new regression tests for companion-device session keying and post-migration durability.

Confidence Score: 5/5

Safe to merge — all changes are mechanical proto-surface regeneration with targeted, well-scoped code adjustments.

The non-generated changes are small and well-contained: two struct literals gain two None fields (PQ prekeys unimplemented), one integer constant is bumped, two comment lines are trimmed, and three schema entries are updated. The e2e test corrections fix real device-addressing bugs rather than introducing new logic. No handler code was found that depended on the cleared AVATAR_UPDATED schema fields, and the proto field renames (deviceID → deviceId, shareToFB → shareToFb) have zero callers in the codebase.

No files require special attention. The auto-generated files (abprops.rs, mex_operations.rs, whatsapp.proto) are large but produced verbatim by whatspec and verified by the companion regeneration.

Important Files Changed

Filename Overview
waproto/src/whatsapp.proto Protocol version bump to 2.3000.1042742319: adds Kyber prekey fields, Labyrinth backup crypto messages, WASARootSecretAction/CoexV2VersionAction, cosmetic field renames (deviceID→deviceId, shareToFB→shareToFb), and default-value annotations throughout.
wacore/libsignal/src/protocol/protocol.rs Adds kyber_pre_key_id: None and kyber_ciphertext: None to PreKeySignalMessage struct literal to satisfy the new proto fields; PQ prekeys remain unimplemented, classic X3DH behavior preserved.
wacore/libsignal/src/protocol/state/session.rs Mirrors protocol.rs: adds kyber_pre_key_id: None and kyber_ciphertext: None to PendingPreKey struct literal so set_unacknowledged_pre_key_message compiles against the updated proto.
wacore/appstate/src/schemas.rs Adds WASA_ROOT_SECRET schema entry, enriches STATUS_PRIVACY with enum_fields for mode/modes, clears AVATAR_UPDATED value_field/value_proto_type (no handler code references them), and bumps the module version comment.
wacore/src/store/device.rs Single-line tertiary version bump: 1040878135 → 1042742319, matching the new live WA bundle.
tests/e2e/tests/lid_sessions.rs Adds peer_session_addr() helper, fixes hardcoded device-0 assumptions in migration tests, scopes assert_no_event to peer messages only (is_from_me guard), and adds two new regression tests: companion-device session keying and post-migration durability.
tests/e2e/tests/privacy_tokens.rs Fixes two assertions that were comparing a device-suffixed LID against the bare to attribute; now correctly uses to_non_ad_string() to strip the device suffix before comparison.
tests/e2e/tests/session_reuse.rs Widens device scan range from 0..=5 to 0..=99 (companions have higher device IDs), fixes session-cleared assertion to accept any established session rather than requiring device-0, and relaxes sender-JID assertions to accept PN or LID.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant A as Client A
    participant WA as WhatsApp Server
    participant B as Client B (companion)

    Note over A,B: Classic X3DH (Kyber fields = None)
    A->>WA: "PreKeySignalMessage{preKeyId, signedPreKeyId, baseKey, identityKey, kyberPreKeyId=None, kyberCiphertext=None}"
    WA->>B: Forward encrypted message

    Note over B: Decrypt & establish session
    B->>WA: "Reply (sender=LID:device, not device 0)"
    WA->>A: Deliver reply

    Note over A: Session keyed at LID:companion_device (not bare :0 address)

    Note over A,WA: AppState sync (new actions)
    A->>WA: "SyncActionValue{wasaRootSecretAction=89, coexV2VersionAction=88}"
    WA->>A: Ack
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant A as Client A
    participant WA as WhatsApp Server
    participant B as Client B (companion)

    Note over A,B: Classic X3DH (Kyber fields = None)
    A->>WA: "PreKeySignalMessage{preKeyId, signedPreKeyId, baseKey, identityKey, kyberPreKeyId=None, kyberCiphertext=None}"
    WA->>B: Forward encrypted message

    Note over B: Decrypt & establish session
    B->>WA: "Reply (sender=LID:device, not device 0)"
    WA->>A: Deliver reply

    Note over A: Session keyed at LID:companion_device (not bare :0 address)

    Note over A,WA: AppState sync (new actions)
    A->>WA: "SyncActionValue{wasaRootSecretAction=89, coexV2VersionAction=88}"
    WA->>A: Ack
Loading

Reviews (7): Last reviewed commit: "test(e2e): scan sessions up to device 99..." | Re-trigger Greptile

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wacore/appstate/src/schemas.rs (1)

245-259: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Restore avatarUpdatedAction on AVATAR_UPDATED
wacore/appstate/src/schemas.rs:245-259 still maps to SyncActionValue.AvatarUpdatedAction in waproto/src/whatsapp.proto, and that message carries eventType plus recentAvatarStickers. Leaving value_field/value_proto_type as None drops the payload for this action.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wacore/appstate/src/schemas.rs` around lines 245 - 259, `AVATAR_UPDATED` is
currently defined without a payload mapping, so the `AvatarUpdatedAction` data
is being dropped. Update the `AVATAR_UPDATED` schema in `schemas.rs` to restore
the `avatarUpdatedAction` value wiring by setting the appropriate `value_field`
and `value_proto_type` to match `SyncActionValue.AvatarUpdatedAction`, so the
protobuf fields like `eventType` and `recentAvatarStickers` are preserved.
Ensure the change is consistent with the existing schema definitions and the
`WAWebStickersAvatarUpdatedSyncAction` module mapping.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@wacore/src/iq/mex_operations.rs`:
- Around line 6573-6584: The newsletter mutation input is serializing the wrong
shape because message_ids is modeled as a single String instead of an array.
Update the Input struct used by the newsletter mutations to make message_ids an
Option<Vec<String>> (or the exact upstream wire type) so both mutation payloads
serialize as a list. Keep the serde annotations on Input and Variables
consistent so the request body matches the expected message_ids array.

In `@waproto/src/whatsapp.proto`:
- Line 2276: The proto2 defaults on these fields may have been copied
incorrectly, causing omitted values to resolve to the wrong runtime values;
review the affected descriptors in whatsapp.proto, especially Field.minVersion,
Reportable.minVersion, RoutingInfo.taskId, CarouselMessage.carouselCardType,
WebMessageInfo.status, and MessageAddOn.status, and remove or correct any
[default = ...] annotations that do not exactly match the upstream schema so
absent fields retain the intended proto2 behavior.

---

Outside diff comments:
In `@wacore/appstate/src/schemas.rs`:
- Around line 245-259: `AVATAR_UPDATED` is currently defined without a payload
mapping, so the `AvatarUpdatedAction` data is being dropped. Update the
`AVATAR_UPDATED` schema in `schemas.rs` to restore the `avatarUpdatedAction`
value wiring by setting the appropriate `value_field` and `value_proto_type` to
match `SyncActionValue.AvatarUpdatedAction`, so the protobuf fields like
`eventType` and `recentAvatarStickers` are preserved. Ensure the change is
consistent with the existing schema definitions and the
`WAWebStickersAvatarUpdatedSyncAction` module mapping.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1de6bc3c-1129-42e8-887b-207b413be604

📥 Commits

Reviewing files that changed from the base of the PR and between 37effa5 and ec8ff6d.

📒 Files selected for processing (11)
  • wacore/appstate/src/schemas.rs
  • wacore/libsignal/src/protocol/protocol.rs
  • wacore/libsignal/src/protocol/state/session.rs
  • wacore/src/iq/abprops.rs
  • wacore/src/iq/mex_operations.rs
  • wacore/src/pair.rs
  • wacore/src/shortcake.rs
  • wacore/src/store/device.rs
  • waproto/src/whatsapp.desc
  • waproto/src/whatsapp.desc.sha256
  • waproto/src/whatsapp.proto

Comment thread wacore/src/iq/mex_operations.rs
Comment thread waproto/src/whatsapp.proto
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

📦 Binary size report

Metric main PR Δ
bin size (stripped) 10.81 MiB 10.82 MiB +5.19 KiB (+0.05%) 🔺
bin .text 8.81 MiB 8.82 MiB +5.12 KiB (+0.06%) 🔺
bin allocated (text+data+bss) 10.81 MiB 10.82 MiB +4.02 KiB (+0.04%) 🔺
llvm-lines wacore 504,323 504,429 +106 (+0.02%) 🔺
llvm-lines wacore copies 17,278 17,330 +52 (+0.30%) 🔺
llvm-lines whatsapp-rust lib 761,162 761,299 +137 (+0.02%) 🔺
llvm-lines whatsapp-rust lib copies 24,680 24,695 +15 (+0.06%) 🔺
deps crates (Cargo.lock) 468 468 0
.text per crate
Crate main PR Δ
.text whatsapp_rust 1.63 MiB 1.63 MiB +679 B (+0.04%) 🔺
.text wacore 531.47 KiB 531.49 KiB +17 B (+0.00%) 🔺
.text wacore_binary 157.70 KiB 157.70 KiB 0
.text wacore_libsignal 178.73 KiB 179.42 KiB +701 B (+0.38%) 🔺
.text wacore_appstate 156.45 KiB 158.46 KiB +2.01 KiB (+1.29%) ⚠️
.text wacore_noise 26.05 KiB 26.05 KiB 0
.text waproto 1.60 MiB 1.60 MiB +1.01 KiB (+0.06%) 🔺
.text whatsapp_rust_sqlite_storage 512.98 KiB 512.98 KiB 0
.text whatsapp_rust_tokio_transport 43.61 KiB 43.61 KiB 0
.text whatsapp_rust_ureq_http_client 10.47 KiB 10.47 KiB 0
.text std 1.00 MiB 1.00 MiB +758 B (+0.07%) 🔺
.text other deps 2.95 MiB 2.95 MiB 0
Top movers (cargo-bloat attribution)
Crate main PR Δ
wacore_appstate 156.45 KiB 158.46 KiB +2.01 KiB (+1.29%)
rustix 1.88 KiB 191 B -1.69 KiB (-90.08%)
buffa_descriptor 2.98 KiB 4.67 KiB +1.69 KiB (+56.87%)
waproto 1.60 MiB 1.60 MiB +1.01 KiB (+0.06%)

Baseline: cd317bc27 (latest main run) · Head: 7aad3fd14 · Graphs

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 11 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Not reviewed (too large): wacore/src/iq/abprops.rs (~4,171 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.

Requires human review: Massive auto-generated protocol surface update with new messages and fields. Even with CI passing and a trusted author, the scale and new features risk integration issues and warrant human review.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

claude added 3 commits July 7, 2026 16:14
Under LID addressing a 1:1 peer is reached at its connected companion
device (non-zero), so its inbound Signal session is keyed there — never
at device 0. The migration tests hardcoded device 0 (`@lid.0`/`@c.us.0`),
which under LID addressing carries no inbound traffic: the injected
legacy PN state sat on a device the peer never sends from, so the
on-the-fly PN→LID migration was never exercised and the final assertion
failed once the mock switched to realistic LID-from-the-start delivery.

Derive the target device from the peer's own JID via a shared
`peer_session_addr` helper, and add coverage:
- `test_inbound_1x1_session_keyed_at_companion_device` guards the
  non-zero-device invariant the migration tests depend on.
- `test_pn_migration_is_durable_across_followup_messages` verifies the
  migrated LID session keeps serving follow-up messages without re-migration
  or undecryptable events.

Reproduced locally against the updated barback mock: with the correct
device the client migrates the PN session to LID and decrypts cleanly.

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/e2e/tests/lid_sessions.rs`:
- Around line 594-688: The session downgrade logic is duplicated across multiple
LID migration tests, so factor the repeated “compute lid_addr/pn_addr, read the
LID session, copy it to PN, then delete the LID session” flow into a shared
helper used by the affected tests in lid_sessions.rs. Create a small async
helper near the existing test utilities, wire the tests that currently inline
the backend.get_session / put_session / delete_session sequence to call it, and
keep the helper centered around the existing peer_session_addr, TestClient, and
persistence_manager().backend() symbols so future protocol changes only need one
update.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0bc98866-448a-4ba0-9240-0955774b1a03

📥 Commits

Reviewing files that changed from the base of the PR and between ec8ff6d and e93cc40.

📒 Files selected for processing (1)
  • tests/e2e/tests/lid_sessions.rs

Comment thread tests/e2e/tests/lid_sessions.rs

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread tests/e2e/tests/lid_sessions.rs
jlucaso1 and others added 2 commits July 8, 2026 00:17
The PN->LID migration assert_no_event checks caught own offline self-sync redeliveries (is_from_me) that BadMac independently of the migration under test, flaking against realistic offline traffic. Scope every UndecryptableMessage assertion in lid_sessions.rs to peer messages; a real migration failure (peer, !is_from_me) is still caught.

@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.

♻️ Duplicate comments (1)
tests/e2e/tests/lid_sessions.rs (1)

634-691: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Durability test logic is solid, but the downgrade duplication is still here.

The test correctly downgrades to PN-only, triggers migration via inbound messages, and asserts LID retention with PN cleanup. No issues with the test logic itself.

However, the "downgrade session to PN-only" sequence (compute lid_addr/pn_addr, read LID session, put_session under PN, delete_session for LID) at lines 647-656 is now the fourth copy of this pattern (also at lines 241-250, 520-535, and the hidden first new test). This was already flagged in a prior review — still not extracted into a shared helper. Each new test that inlines this sequence is another site that drifts if the protocol changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/e2e/tests/lid_sessions.rs` around lines 634 - 691, The PN-only
downgrade sequence is duplicated across multiple tests, including this one in
test_pn_migration_is_durable_across_followup_messages. Extract the repeated
session migration setup into a shared helper that handles computing lid_addr and
pn_addr, copying the LID session to PN, and deleting the LID entry, then call
that helper from all affected tests to keep the behavior consistent if the
protocol changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@tests/e2e/tests/lid_sessions.rs`:
- Around line 634-691: The PN-only downgrade sequence is duplicated across
multiple tests, including this one in
test_pn_migration_is_durable_across_followup_messages. Extract the repeated
session migration setup into a shared helper that handles computing lid_addr and
pn_addr, copying the LID session to PN, and deleting the LID entry, then call
that helper from all affected tests to keep the behavior consistent if the
protocol changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: af25873d-a0ad-4ae7-b855-00cff2ee1c12

📥 Commits

Reviewing files that changed from the base of the PR and between e93cc40 and 70ee8e7.

📒 Files selected for processing (1)
  • tests/e2e/tests/lid_sessions.rs

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.

Re-trigger cubic

…ice-suffixed get_lid()

`test_only_nct_send_ab_without_salt_still_receives_463` and
`test_send_and_syncd_ab_without_delivery_still_receives_463` asserted the sent
message's `to` equals `get_lid()`. A 1:1 `to` carries the recipient's BARE LID
(the device is addressed per-recipient in the enc fan-out, never on `to`), while
`get_lid()` returns the account's own device-suffixed LID (`:33`, matching the
real WA `<success lid="…:33@lid">`). Compare against `to_non_ad_string()` so the
assertion checks LID-addressing without over-specifying the device.

Same class of fix as the lid_sessions device-aware addressing already in this
branch; the mock is compliant and unchanged.
@coderabbitai coderabbitai Bot removed the api-design label Jul 8, 2026

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.

Re-trigger cubic

jlucaso1 added 2 commits July 8, 2026 04:37
A compliant 1:1 message is LID-addressed on the wire, so the receiver's
`MessageInfo.source.sender` is the peer's LID (the PN rides in sender_pn), not
the phone. `test_message_info_fields` asserted the sender equals the peer's PN
JID; accept either the PN or the LID identity.

`test_session_state_after_roundtrip` asserted a bare device-0 "primary" LID
session (`!addr.contains(':')`) had its pending_pre_key cleared. The peer is a
companion, so its session is device-suffixed (`<lid>:33@lid.0`) — there is no
device-0 session to key on. Assert instead that at least one of the peer's LID
sessions is fully established after the roundtrip.

Mock is compliant and unchanged; these are stale PN/device-0 test assumptions,
same class as the lid_sessions and privacy_tokens fixes on this branch.
…overed

`scan_sessions` only swept device ids 0..=5, but a paired peer is a non-zero
companion (e.g. device 33). After a roundtrip the ONLY session in range was the
phantom device-0 one, whose pending_pre_key never clears (device 0 never
completes X3DH), so `test_session_state_after_roundtrip` saw pending still set.
Widen the sweep to 0..=99 (matching the lid_sessions helper) so the peer's real
device session — which the roundtrip did establish — is found and inspected.
@coderabbitai coderabbitai Bot added size-increase-ok Accepted binary-size increase: downgrades the per-PR size gate to a warning and removed breaking-change labels Jul 8, 2026

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.

Re-trigger cubic

@jlucaso1
jlucaso1 merged commit ba1ac3b into main Jul 8, 2026
34 checks passed
@jlucaso1
jlucaso1 deleted the claude/whatsapp-rust-whatspec-review-p7w53u branch July 8, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-increase-ok Accepted binary-size increase: downgrades the per-PR size gate to a warning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants