Repository navigation
test(whatsapp): exercise real outbound target policy - #134019
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 5:57 AM ET / 09:57 UTC. ClawSweeper reviewWhat this changesThe PR replaces mocked WhatsApp outbound-target tests with compact table-driven tests against real target normalization and allow-list outcomes. Merge readinessKeep 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 Review scores
Verification
How this fits togetherWhatsApp 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]
Before merge
Agent review detailsSecurityNone. PR surfaceTests -214. Total -214 across 1 file. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
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. |
|
Merged via squash.
|
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
node scripts/check-changed.mjs -- extensions/whatsapp/src/resolve-outbound-target.test.ts: changed-file validation.