Skip to content

test(whatsapp): exercise real outbound target policy - #134019

Merged
steipete merged 1 commit into
mainfrom
codex/test-whatsapp-outbound-policy
Aug 31, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-whatsapp-outbound-policy

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

WhatsApp target-policy tests script a mocked normalizer and reload a stateless resolver before every case, obscuring the actual input-to-policy contract.

Why This Change Was Made

Use real target inputs and exact resolution/error outcomes with a static import. Preserve missing/invalid targets, group and newsletter exemptions, wildcard and empty policies, implicit/heartbeat/custom-mode enforcement, formatted-address diagnostics, and trimming. The numeric allowlist row now succeeds only if the numeric entry itself matches, strengthening the old mocked case.

User Impact

No runtime behavior change. The target-policy test body took 61 ms before and 20 ms after locally. Tests are smaller and exercise actual normalization with policy rather than hand-scripted normalization results.

Evidence

  • Four focused suites pass, 70 tests: target policy, normalization, action authorization, and channel outbound behavior.
  • node scripts/check-changed.mjs -- extensions/whatsapp/src/resolve-outbound-target.test.ts: changed-file validation.
  • Formatting, diff check, owner/caller/sibling review, and structured Codex autoreview.
  • Production unchanged. Tests +53/-267 lines, net -214. No mocks or per-case module reloads remain in the changed suite.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added channel: whatsapp-web Channel integration: whatsapp-web size: M maintainer Maintainer-authored PR labels Aug 31, 2026
@steipete
steipete marked this pull request as ready for review August 31, 2026 09:47
@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 Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 5:57 AM ET / 09:57 UTC.

ClawSweeper review

What this changes

The PR replaces mocked WhatsApp outbound-target tests with compact table-driven tests against real target normalization and allow-list outcomes.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. This is a focused, behavior-neutral test refactor that replaces scripted normalization with assertions against the real outbound-target policy; no blocking defect was found.

Priority: P3
Reviewed head: c9ae38ce317e886518f5391865dba5f1fe115ae4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A clean, compact test-boundary refactor with no correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, test-only refactor leaves the production owner unchanged; source review ties the cases to the existing resolver branches, so external real-behavior proof is not required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, test-only refactor leaves the production owner unchanged; source review ties the cases to the existing resolver branches, so external real-behavior proof is not required.
Evidence reviewed 5 items Introduced test refactor: The verified PR-introduced delta changes only the outbound-target test, replacing module mocks and reloads with static-import assertions over actual inputs and exact outcomes.
Production policy owner: Current main normalizes the target, exempts group/newsletter JIDs, normalizes allow-list entries, and either returns the normalized destination or the policy error; the new cases cover those decisions without changing them.
Runtime caller: The WhatsApp channel adapter supplies outbound requests to this resolver as its resolveTarget implementation, so this colocated suite protects the policy boundary used before delivery.
Findings None None.
Security None None.

How this fits together

WhatsApp outbound delivery resolves a requested destination before the channel sends a message. The resolver normalizes direct, group, and newsletter targets, then applies the direct-message allow-list policy.

flowchart LR
A[Outbound message request] --> B[WhatsApp channel adapter]
B --> C[Outbound target resolver]
C --> D[Normalize destination]
D --> E{Group or newsletter}
E -->|Yes| F[Allow normalized target]
E -->|No| G[Evaluate direct-message allow list]
G --> H[Resolved target or policy error]
Loading

Before merge

  • Complete next step (P2) - No repair lane is needed: the patch has no actionable correctness defect and awaits ordinary PR completion.
Agent review details

Security

None.

PR surface

Tests -214. Total -214 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 53 267 -214
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 53 267 -214

Review metrics

Metric Value Why it matters
Production versus test LOC production 0; tests +53/-267 (net -214) The change removes mock-heavy test setup without altering runtime code or public configuration.

Technical review

Best possible solution:

Retain the real-input table-driven suite as the canonical coverage for outbound-target normalization and direct-message policy, alongside the sibling target-form tests.

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

Not applicable: this PR changes test coverage rather than reporting a runtime failure. Source inspection maps the new cases directly to the production resolver's existing branches.

Is this the best way to solve the issue?

Yes. Testing the resolver with real normalization is the maintainable boundary-level approach; the adjacent target suite already owns detailed target-form normalization coverage.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against afd1a36d5d6d.

Labels

Label changes:

  • add P3: This is low-risk test cleanup with no runtime behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, test-only refactor leaves the production owner unchanged; source review ties the cases to the existing resolver branches, so external real-behavior proof is not required.

Label justifications:

  • P3: This is low-risk test cleanup with no runtime behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, test-only refactor leaves the production owner unchanged; source review ties the cases to the existing resolver branches, so external real-behavior proof is not required.

Evidence

What I checked:

Likely related people:

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

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer review complete. The latest ClawSweeper review has no actionable findings or Rank-up moves; ordinary completion is covered by the owner/caller/sibling inspection and clean structured Codex autoreview.

All 70 tests across the four focused suites pass, and the changed-file gate passes. Exact-head CI is green for c9ae38c: https://github.com/openclaw/openclaw/actions/runs/33379399741. Production is unchanged; the real-input policy suite removes 214 net test lines and preserves the normalization and authorization outcomes described above. Proceeding through the native prepare/merge workflow.

@steipete
steipete merged commit e93f4b3 into main Aug 31, 2026
174 checks passed
@steipete
steipete deleted the codex/test-whatsapp-outbound-policy branch August 31, 2026 10:16
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

channel: whatsapp-web Channel integration: whatsapp-web maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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