fix: apply encrypted message edits during sync - #363
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 22, 2026, 10:50 PM ET / August 23, 2026, 02:50 UTC. ClawSweeper reviewWhat this changesThe PR decrypts WhatsApp secret-encrypted message-edit envelopes during live and history sync so the original stored message is updated through existing edit reconciliation. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 2 items remain This PR remains necessary: released current main still stores these encrypted edit envelopes without decrypting them into the established edit path. The focused patch appears correct, but redacted real WhatsApp sync evidence is still required before merge. Priority: P1 Review scores
Verification
How this fits togetherWACLI receives live WhatsApp events and downloaded history, parses them into message records, then stores them in SQLite. Protocol edit metadata redirects a revision to the original message row before persistence. flowchart LR
A[Live WhatsApp event] --> C[Sync handler]
B[History sync record] --> C
C --> D[Decrypt encrypted edit]
D --> E[Parse protocol edit]
E --> F[Reconcile original message]
F --> G[SQLite message store]
Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain this narrow decryption-and-validation path once a redacted affected-account sync demonstrates that the original row is edited and no opaque envelope row is stored. Do we have a high-confidence way to reproduce the issue? Yes—current source establishes the missing decryption path, and the linked issue provides an affected-account procedure; this review did not execute an account-backed sync. Is this the best way to solve the issue? Yes—the patch decrypts only MESSAGE_EDIT envelopes, validates the resulting protocol edit, and reuses established reconciliation rather than creating a parallel storage path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 97e14efdf91a. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Summary
SecretEncryptedMessage{MESSAGE_EDIT}envelopes before parsing and persistenceCloses #362
Behavior proof
The regression fixtures seed an original message and then deliver a secret-encrypted edit. Both live sync and history sync now update the original row with the edited body, mark it edited, and keep the database at one row instead of persisting the opaque envelope. A mismatched decrypted target is rejected without changing the original row.
Validation
go test ./internal/app -run 'Test(LiveSyncDecryptsSecretMessageEditBeforeStorage|LiveSyncRejectsSecretMessageEditTargetMismatch|HistorySyncDecryptsSecretMessageEditBeforeStorage|HistorySyncEditedMessageSurvivesOlderOriginal|SyncEventHandlerPanicHasStackAndCounter)$' -count=1go test ./internal/wa ./internal/apppnpm format:checkpnpm lintpnpm testpnpm buildgit diff --checkLimitations
No live WhatsApp account was used for validation; behavior proof is provided by deterministic sync fixtures using the project client interface and storage layer.
Disclosure: AI was used to understand the codebase and review the fix.