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 15, 2026, 2:46 PM ET / 18:46 UTC. ClawSweeper reviewWhat this changesThe PR decrypts WhatsApp secret-encrypted edit envelopes during live and history sync, validates their target key, and routes them through existing edit storage. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 2 items remain Keep open: current v0.17.1 still lacks encrypted-edit decryption, and this focused patch follows the established edit-reconciliation path. It needs redacted after-fix proof from a real WACLI/WhatsApp sync before merge because its current evidence is fixture-only. Priority: P1 Review scores
Verification
How this fits togetherWACLI converts WhatsApp live and history sync events into parsed messages and persists them in its local SQLite store. Protocol edit parsing redirects an edit to the original message row, so this change prepares encrypted edit envelopes for that existing reconciliation path. flowchart LR
A[WhatsApp sync event] --> B[Detect encrypted edit envelope]
B --> C[Decrypt envelope]
C --> D[Validate target key]
D --> E[Parse protocol edit]
E --> F[Reconcile original message row]
F --> G[Stored edited message]
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: Land the narrow decrypt-and-reconcile approach after a redacted real-device sync demonstrates that both live and history encrypted edits update exactly one original row while preserving target-mismatch rejection. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main sends these envelopes directly into parsing while ordinary edit reconciliation only receives decrypted protocol edits. The supplied fixtures demonstrate the intended path, but not a real WhatsApp transport run. Is this the best way to solve the issue? Yes: decrypting only MESSAGE_EDIT envelopes and then reusing the established protocol-edit parser is the narrowest maintainable solution, with target validation preventing a decrypted payload from retargeting another row. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 97e14efdf91a. LabelsLabel changes:
Label 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
|
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.