Skip to content

refactor(whatsapp): consolidate tests around canonical owners - #156348

Draft
vincentkoc wants to merge 8 commits into
mainfrom
test/whatsapp-suite-cleanup-20260923
Draft

vincentkoc wants to merge 8 commits into
mainfrom
test/whatsapp-suite-cleanup-20260923

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

WhatsApp test fixtures duplicated policy, routing, session persistence, and dispatch logic. Those copies could keep tests green while the real owners regressed.

User Impact

No production behavior changes. The suite now exercises the real shared owners with deterministic transport and reply stubs, while retaining current account, lifecycle, media, and delivery behavior.

Why This Change Was Made

  • Replace copied fixture algorithms and fake JSON persistence with canonical channel-turn helpers and SQLite session reads.
  • Keep acquired spies and test state owned by each case, including successful setup → rejected acquisition with a borrowed spy → fresh successful setup.
  • Preserve frozen-main guards, consolidate retained inbound extraction checks, and check readable quoted edited-image bytes, actual cache callbacks, persisted delivery context, recipient transitions, and multi-account discovery.

33 changed paths: production 0 lines; tests −300 and test support −532, net −832 against the frozen integration base. Related: #139428.

Evidence

  • Frozen-main baseline (53cd9aa): 126 files / 1,430 passing cases.
  • Reconciled candidate: 126 distinct files / 1,432 passing cases, using one latest passing whole-file report per path. Covers the WhatsApp, database-worker, plugin E2E, synthetic QA, shared-owner, Gateway authority, migration, and UI logout routes.
  • Remote private-QA runtime/declaration and AI builds passed; installed dependency versions and source hashes matched the frozen inputs. This does not claim live WhatsApp linking or paid-provider behavior.
  • Native review completed five passes and reported one P2: obsolete routing fixture options. The finding and subsequent fixture/type/lint corrections received exact independent source review; affected runtime and type checks are recorded separately. No final-head native-clean verdict is claimed.
  • Targeted faults produced the intended failures for 12 concrete regressions, including fixture acquisition, account discovery, media, registry/auth persistence, retry/cache/timer behavior, shutdown reporting, conflict diagnostics, and recipient transitions. Nine had completed original-lease restored controls; the interrupted 440-retry run was followed by a clean control on a newly qualified lease. Diagnostic and recipient-transition faults also passed exact restored controls. The latter ran mutant → restored, without a separate initial control. These executions retain their original candidate-version attribution; mutation sites and witness assertions remain unchanged across the final mechanical lint fixes.
  • Changed-check continuation: the original passing commands were retained; corrected extension-test types, targeted formatting/lint, and all eight remaining native guards passed in scoped continuations. Full plugin lint reported an unchanged frozen-base extensions/agentsapi/agentsapi-session.ts max-lines violation (711 > 700), alongside candidate diagnostics that are now fixed and pass targeted lint. A green full-plugin lint or full changed-check rerun is not claimed.

The original partial failures and the empty-state last-route mutation survivor remain recorded separately. That survivor prompted a same-account prior-recipient transition check in the existing routing case. This remains a draft; final approval and merge stay with the maintainer.

@vincentkoc vincentkoc self-assigned this Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check could not safely complete for this revision.

ClawSweeper will not retry this unchanged revision.

Next step: No contributor action is requested. Maintainers should inspect the linked workflow run.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review September 23, 2026 08:30
@openclaw-barnacle openclaw-barnacle Bot added channel: whatsapp-web Channel integration: whatsapp-web size: XL labels Sep 23, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 23, 2026, 7:11 AM ET / 11:11 UTC (Revision 2).

ClawSweeper review

What this changes

Consolidates WhatsApp tests around existing routing, delivery, storage, and setup implementations, strengthens retained assertions, and removes a private allowlist forwarding wrapper.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open as a useful, member-authored test-audit batch. Current main retains the duplicated fixtures this PR replaces, and source review found no concrete introduced correctness defect.

Priority: P3
Reviewed head: 356736d3345a0e61ca03eaf528617e2da4f60e1c

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The consolidation is coherent and source review found no blocking defect, but materially changed fixtures remain unqualified by execution.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored cleanup is exempt from external-contributor live proof. Its fixture changes exercise existing turn and transport boundaries, but the cited passing shard predates the latest packet; current test qualification remains separate. No stored-data model changes require migration proof.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored cleanup is exempt from external-contributor live proof. Its fixture changes exercise existing turn and transport boundaries, but the cited passing shard predates the latest packet; current test qualification remains separate. No stored-data model changes require migration proof.
Evidence reviewed 10 items Introduced production change preserves behavior: Both production callers now invoke the same normalizer previously called by the deleted six-line wrapper. The removed symbol has no remaining WhatsApp caller; its remaining core guardrail reference forbids exporting it.
Cleanup remains applicable on main: Fetched main still contains the copied buffered reply dispatcher and reply-visibility policy in the test helper. The forwarding wrapper also remains on fetched main and the supplied latest release commit; neither establishes that this cleanup has already landed.
Private test boundary: The new owner-spy helper is exported through channel-test-helpers, which the entrypoint inventory classifies as non-production and private-local-only; package exclusions keep it out of published artifacts. This is not a new public plugin API.
Findings None None.
Security None None.

How this fits together

The WhatsApp plugin turns incoming messages into agent turns and sends replies through shared delivery infrastructure. These fixtures exercise that pipeline with controlled agent output and mocked external transport.

flowchart LR
  A[Incoming WhatsApp messages] --> B[Plugin preparation and routing]
  B --> C[Shared turn lifecycle]
  D[Controlled agent replies] --> C
  C --> E[Delivery dispatcher]
  E --> F[Mock WhatsApp transport]
  C --> G[Isolated session storage]
  F --> H[Receipt and payload assertions]
Loading

Before merge

  • Complete next step (P2) - When authorized validation resumes, qualify the current head with the WhatsApp owner suite, separate connection/logging E2E, declared edited-image fault control, changed-test types and boundary checks, and publish measured test costs before landing.
Agent review details

Security

None.

PR surface

Source -6, Tests -1348. Total -1354 across 38 files.

View PR surface stats
Area Files Added Removed Net
Source 3 4 10 -6
Tests 35 1170 2518 -1348
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 38 1174 2528 -1354

Review metrics

None.

Technical review

Best possible solution:

Keep the smaller fixtures coupled to canonical owners, preserving independent regression assertions and demonstrating their execution cost without claiming an unmeasured speedup.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is a test-consolidation proposal rather than a reported product defect; source inspection confirms the duplicated fixture implementations.

Is this the best way to solve the issue?

Yes in direction: using existing owners removes self-confirming policy copies while retaining transport isolation; current-head execution is still needed to qualify the rewritten fixtures.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0c7d77cd47ab.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P3: This is internal test maintenance with a behavior-preserving production simplification and no established urgent user-facing regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored cleanup is exempt from external-contributor live proof. Its fixture changes exercise existing turn and transport boundaries, but the cited passing shard predates the latest packet; current test qualification remains separate. No stored-data model changes require migration proof.

Evidence

What I checked:

  • Introduced production change preserves behavior: Both production callers now invoke the same normalizer previously called by the deleted six-line wrapper. The removed symbol has no remaining WhatsApp caller; its remaining core guardrail reference forbids exporting it. (extensions/whatsapp/src/channel.ts:79, 356736d3345a)
  • Cleanup remains applicable on main: Fetched main still contains the copied buffered reply dispatcher and reply-visibility policy in the test helper. The forwarding wrapper also remains on fetched main and the supplied latest release commit; neither establishes that this cleanup has already landed. (extensions/whatsapp/src/test-helpers.ts:280, 0c7d77cd47ab)
  • Private test boundary: The new owner-spy helper is exported through channel-test-helpers, which the entrypoint inventory classifies as non-production and private-local-only; package exclusions keep it out of published artifacts. This is not a new public plugin API. (scripts/lib/plugin-sdk-entries.mts:54, 356736d3345a)
  • Fixture ownership and proof boundary: The replacement producer submits final payloads to the real dispatcher and reads its queue counts. Shared dispatch owns settlement; fixture teardown aborts and joins tracked producers before restoring spies and removing isolated state. The PR explicitly excludes substituted model, command, and final-visibility policy from this fixture's proof. (extensions/whatsapp/src/auto-reply.test-harness.ts:153, 356736d3345a)
  • Dependency-backed assertions: The monitor fixture now imports Baileys' actual message normalizer, and credential tests retain its actual BufferJSON codec. extensions/whatsapp/package.json pins baileys 7.0.0-rc14, establishing the dependency contract relevant to these assertions. (extensions/whatsapp/src/monitor-inbox.test-harness.ts:180, 356736d3345a)
  • Pinned dependency source inspected: npm metadata identifies WhiskeySockets/Baileys and gitHead 7e7b0757e3f9f3c7789fb1cfd2f241d5002a199a for 7.0.0-rc14. Read-only, in-memory inspection of the published package's lib/Utils/messages.js confirms editedMessage unwrapping; lib/Utils/generics.js confirms base64 BufferJSON serialization and revival. No dependency code was executed. (7e7b0757e3f9)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • sunlit-deng: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record current-head owner-suite and separate connection/logging E2E results, including the declared edited-image fault control.
  • Publish measured costs for materially changed tests and current changed-test type and boundary-check results.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-23T10:14:22.358Z sha b79fca2 :: needs changes before merge. :: none

@vincentkoc
vincentkoc marked this pull request as draft September 23, 2026 11:02
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 23, 2026
Reconcile the existing cleanup with frozen main while preserving both histories. Replace copied fixture algorithms with canonical channel-turn owners, retain current detectors, and make acquired fixture cleanup failure-safe.
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: slack Channel integration: slack and removed channel: whatsapp-web Channel integration: whatsapp-web labels Sep 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: ios App: ios app: linux app: macos App: macos app: wearos App: wearos app: web-ui App: web-ui channel: a2a channel: buzz channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: qa-channel Channel integration: qa-channel channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: twitch Channel integration: twitch docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: acpx extensions: active-memory extensions: admin-http-rpc extensions: agentsapi extensions: alibaba extensions: amazon-bedrock extensions: amazon-bedrock-mantle extensions: anthropic extensions: anthropic-vertex extensions: apple-fm extensions: arcee extensions: baseten Extension: baseten extensions: brave extensions: browser extensions: byteplus extensions: canvas extensions: cerebras extensions: chutes extensions: clawrouter Extension: clawrouter extensions: clickclack extensions: cloudflare-ai-gateway extensions: codex extensions: cohere extensions: comfy extensions: copilot extensions: copilot-proxy Extension: copilot-proxy extensions: crabbox extensions: deepgram extensions: deepinfra extensions: deepseek extensions: device-pair extensions: diagnostics-otel Extension: diagnostics-otel extensions: diagnostics-prometheus extensions: diffs extensions: fish-audio Extension: fish-audio extensions: onepassword 1Password plugin extensions: openai extensions: qa-lab extensions: tts-local-cli gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: azure-speech Azure Speech plugin plugin: beam Beam session sharing plugin plugin: bonjour Plugin integration: bonjour plugin: code-mode-quickjs plugin: cua-computer plugin: file-transfer plugin: google-meet plugin: linux-node plugin: session-share plugin: team-reports plugin: typesafe rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security Security documentation size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant