Skip to content

test(e2e): migrate WhatsApp QR compact guard - #5187

Merged
cv merged 1 commit into
mainfrom
e2e-migrate/test-whatsapp-qr-compact-simple
Jun 11, 2026
Merged

test(e2e): migrate WhatsApp QR compact guard#5187
cv merged 1 commit into
mainfrom
e2e-migrate/test-whatsapp-qr-compact-simple

Conversation

@jyaunches

@jyaunches jyaunches commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrate test/e2e/test-whatsapp-qr-compact-e2e.sh to a focused Vitest renderer proof and retire the shell script.

Refs #5098
Refs #4522
Supersedes the simplified subset of #5146.

Contract mapping

  • Legacy assertion: bundled OpenClaw / @openclaw/whatsapp version is resolved from Dockerfile.base.
    • Replacement: test/e2e-scenario/live/whatsapp-qr-compact.test.ts reads ARG OPENCLAW_VERSION and installs openclaw@<version> plus @openclaw/whatsapp@<version>.
    • Boundary preserved: pinned upstream renderer package boundary.
  • Legacy assertion: the WhatsApp plugin channel-login path renders through renderQrTerminal.
    • Replacement: the Vitest test scans installed @openclaw/whatsapp/dist for renderQrTerminal before measuring output.
    • Boundary preserved: real upstream plugin distribution path.
  • Legacy assertion: baseline QR without the NemoClaw preload is oversized.
    • Replacement: the Vitest test runs the real renderQrTerminal(qr) probe without NODE_OPTIONS and requires rows >= WHATSAPP_QR_OVERSIZE_MIN_ROWS (default 50).
    • Boundary preserved: real OpenClaw media-runtime renderer.
  • Legacy assertion: QR with the NemoClaw compact preload is scan-friendly and smaller.
    • Replacement: the Vitest test reruns the same probe with NODE_OPTIONS=--require nemoclaw-blueprint/scripts/whatsapp-qr-compact.js, requires rows <= WHATSAPP_QR_COMPACT_MAX_ROWS (default 40), and requires shrinkage versus baseline.
    • Boundary preserved: real preload injection and renderer behavior.

Simplicity check

  • Test shape: focused Vitest test with local temp-dir helpers.
  • New shared helpers: none.
  • New framework/registry/ledger: none.
  • No WhatsApp account, phone scan, sandbox, Docker, or NVIDIA_API_KEY required; the renderer proof preserves the legacy contract.
  • Workflow changes: existing whatsapp-qr-compact-e2e regression lane now invokes the Vitest test instead of the deleted shell script.

Verification

  • NEMOCLAW_RUN_E2E_SCENARIOS=1 npx vitest run --project e2e-scenarios-live test/e2e-scenario/live/whatsapp-qr-compact.test.ts --silent=false --reporter=default
  • npx vitest run --project cli test/whatsapp-qr-compact.test.ts test/regression-e2e-workflow.test.ts test/e2e-script-workflow.test.ts --silent=false --reporter=default
  • git diff --check

Note: full pre-push CLI test started but was killed by signal 9 on this host; the narrow required checks above passed.

Summary by CodeRabbit

  • Tests

    • Strengthened WhatsApp QR compact mode validation with comprehensive E2E testing of terminal output dimensions and scan-frame compatibility, including baseline and preload comparisons.
  • Chores

    • Modernized test infrastructure and CI/CD workflows, updated documentation references, and removed legacy test scripts.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4e37b384-d9e1-465b-9d17-7bd7bb9d979d

📥 Commits

Reviewing files that changed from the base of the PR and between 0f99ee5 and 6d6f9ce.

📒 Files selected for processing (7)
  • .github/workflows/regression-e2e.yaml
  • test/e2e-scenario/live/whatsapp-qr-compact.test.ts
  • test/e2e-script-workflow.test.ts
  • test/e2e/test-messaging-providers.sh
  • test/e2e/test-whatsapp-qr-compact-e2e.sh
  • test/regression-e2e-workflow.test.ts
  • test/whatsapp-qr-compact.test.ts
💤 Files with no reviewable changes (1)
  • test/e2e/test-whatsapp-qr-compact-e2e.sh

📝 Walkthrough

Walkthrough

Migrates WhatsApp compact QR e2e verification from bash script to Vitest with hermetic OpenClaw dependency pinning. Updates CI workflow to run the new TypeScript test, removes legacy script references, and adds workflow contract assertions.

Changes

WhatsApp QR E2E Migration to Vitest

Layer / File(s) Summary
Vitest e2e test implementation for WhatsApp compact QR rendering
test/e2e-scenario/live/whatsapp-qr-compact.test.ts
Hermetically installs pinned OpenClaw and @openclaw/whatsapp versions, renders a deterministic WhatsApp pairing QR payload via renderQrTerminal twice (baseline and with NemoClaw preload), measures terminal row/column counts by stripping ANSI codes, and asserts baseline exceeds WHATSAPP_QR_OVERSIZE_MIN_ROWS (≥50), compact fits within WHATSAPP_QR_COMPACT_MAX_ROWS (≤40), and compact is strictly smaller than baseline. Includes subprocess execution with timeout escalation (SIGTERM/SIGKILL), OpenClaw version parsing, recursive file search, and temporary directory cleanup.
Workflow routing and contract test for Vitest execution
.github/workflows/regression-e2e.yaml, test/regression-e2e-workflow.test.ts
Workflow adds npm dependency installation and switches whatsapp-qr-compact-e2e job from bash script invocation to npx vitest run --project e2e-scenarios-live with NEMOCLAW_RUN_E2E_SCENARIOS=1 environment variable. New workflow contract test verifies job steps contain the live scenario test path and Vitest command, and asserts the retired shell script is not referenced.
Legacy script removal and documentation updates
test/e2e-script-workflow.test.ts, test/e2e/test-messaging-providers.sh, test/whatsapp-qr-compact.test.ts
Removes test/e2e/test-whatsapp-qr-compact-e2e.sh from the legacy script allowlist, updates inline shell script comments to reference the new Vitest test location instead of the old bash script, reorders Vitest import specifiers, and clarifies test file comments pointing to the new e2e scenario validation path.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

area: e2e, integration: openclaw, area: ci

Suggested reviewers

  • cv
  • prekshivyas

Poem

🐰 From bash to TypeScript, QR codes take flight,
Hermetic installs and dimensions done right,
Compact and oversized, both measured with care,
NemoClaw's preload trims QR with flair.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: migrating a WhatsApp QR compact guard from a shell script (test-whatsapp-qr-compact-e2e.sh) to a Vitest test, which is the primary purpose of this pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch e2e-migrate/test-whatsapp-qr-compact-simple

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: whatsapp-qr-compact-e2e
Optional E2E: None

Dispatch hint: whatsapp-qr-compact-e2e

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • whatsapp-qr-compact-e2e (low; hermetic Node/npm test, no Docker/GPU/NVIDIA_API_KEY): This PR changes the implementation and workflow wiring of the existing WhatsApp compact-QR E2E lane. Run the lane to confirm the workflow-dispatched job installs dependencies correctly and the migrated Vitest scenario preserves the real renderer compactness proof.

Optional E2E

  • None.

New E2E recommendations

  • None.

Dispatch hint

  • Workflow: regression-e2e.yaml
  • jobs input: whatsapp-qr-compact-e2e

@github-actions

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Recommendation

Required Vitest E2E scenarios: e2e-scenarios-all
Optional Vitest E2E scenarios: None

Dispatch required Vitest E2E scenarios:

  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref>

Workflow run

Full Vitest E2E advisor summary

Vitest E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required Vitest E2E scenarios

  • e2e-scenarios-all: The PR adds a new free-standing live Vitest E2E test under test/e2e-scenario/live. It is not a live-supported typed scenario ID in the trusted registry/runtime-support surface, so a targeted scenario dispatch would be invalid; run the canonical Vitest scenario fan-out instead.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref>

Optional Vitest E2E scenarios

  • None.

Relevant changed files

  • test/e2e-scenario/live/whatsapp-qr-compact.test.ts

@github-actions

Copy link
Copy Markdown
Contributor

PR Review Advisor

Findings: 0 needs attention, 1 worth checking, 1 nice ideas
Top item: Disable lifecycle scripts for the nested OpenClaw install

Review findings

🛠️ Needs attention

  • None.

🔎 Worth checking

  • Disable lifecycle scripts for the nested OpenClaw install (test/e2e-scenario/live/whatsapp-qr-compact.test.ts:149): The migrated Vitest test creates a temporary project and runs `npm install openclaw@${openclawVersion} @openclaw/whatsapp@${openclawVersion}` without `--ignore-scripts`. The versions are exact, but they are fetched outside the repository lockfile and npm lifecycle scripts may execute package-controlled code in the regression workflow environment. The workflow already uses `npm ci --ignore-scripts` for root dependencies, so this nested install is the remaining installer-trust gap.
    • Recommendation: Add `--ignore-scripts` to the nested `npm install` if the renderer probe works without lifecycle hooks. If lifecycle scripts are required, document why, keep the version source pinned, and minimize inherited environment variables for this child process.
    • Evidence: The workflow runs `npm ci --ignore-scripts`, then invokes this Vitest file. Inside the test, `runCommand("npm", ["install", "--no-audit", "--no-fund", `openclaw@${openclawVersion}`, `@openclaw/whatsapp@${openclawVersion}`], ...)` does not disable lifecycle scripts.

🌱 Nice ideas

  • Preserve failure diagnostics after removing the shell log artifact (.github/workflows/regression-e2e.yaml:331): The deleted shell test wrote npm install output to `/tmp/nemoclaw-e2e-whatsapp-qr-install.log` and the workflow uploaded that artifact on failure. The migrated Vitest path embeds stderr in assertion messages, but no longer uploads the install log or probe context as a failure artifact. That can make registry/install/import failures harder to debug.
    • Recommendation: Consider writing the nested npm install and probe stderr/stdout to an artifact directory or restoring an upload step for the WhatsApp compact-QR lane.
    • Evidence: The PR removes the `Upload WhatsApp compact-QR E2E logs on failure` step and replaces the shell script with `npx vitest run --project e2e-scenarios-live test/e2e-scenario/live/whatsapp-qr-compact.test.ts`.
Consider writing more tests for
  • **Runtime validation** — Validate the `whatsapp-qr-compact-e2e` regression lane executes the Vitest target with `NEMOCLAW_RUN_E2E_SCENARIOS=1` and reaches both the baseline oversized and compact patched renderer assertions.. The PR changes a GitHub Actions regression lane and migrates a live renderer proof from shell to Vitest. The static migration looks behavior-preserving, but the workflow path and nested npm install/render probe need runtime validation for confidence.
  • **Runtime validation** — Validate the migrated test failure path preserves enough npm install and renderer-import diagnostics when the pinned OpenClaw install or `renderQrTerminal` import fails.. The PR changes a GitHub Actions regression lane and migrates a live renderer proof from shell to Vitest. The static migration looks behavior-preserving, but the workflow path and nested npm install/render probe need runtime validation for confidence.
  • **Runtime validation** — Validate the temporary npm install for `openclaw` and `@openclaw/whatsapp` does not require lifecycle scripts before adding `--ignore-scripts`.. The PR changes a GitHub Actions regression lane and migrates a live renderer proof from shell to Vitest. The static migration looks behavior-preserving, but the workflow path and nested npm install/render probe need runtime validation for confidence.
  • **Acceptance clause:** No linked issue acceptance clauses were provided by deterministic context. — add test evidence or identify existing coverage. The deterministic context has `linkedIssues: []`, so there were no issue-body or issue-comment clauses to extract literally.

Workflow run details

This is an automated advisory review. A human maintainer must make the final merge decision.

@jyaunches
jyaunches requested a review from cv June 11, 2026 00:52
@cv
cv merged commit 7ddebe3 into main Jun 11, 2026
44 checks passed
@cv
cv deleted the e2e-migrate/test-whatsapp-qr-compact-simple branch June 11, 2026 02:29
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure integration: openclaw OpenClaw integration behavior integration: whatsapp WhatsApp integration or channel behavior refactor PR restructures code without intended behavior change labels Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure integration: openclaw OpenClaw integration behavior integration: whatsapp WhatsApp integration or channel behavior refactor PR restructures code without intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants