Skip to content

chore: migrate to Wechaty 2 EventTarget API and PuppetMock ding-dong test - #334

Open
huan wants to merge 1 commit into
mainfrom
fix/wechaty-alpha21-mock-tests
Open

huan wants to merge 1 commit into
mainfrom
fix/wechaty-alpha21-mock-tests

Conversation

@huan

@huan huan commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Migrated examples/, tests/, and docs from WechatyBuilder / .on() / .once() to Wechaty (new Wechaty(...) / Wechaty.singleton()) and WinterTC EventTarget (addEventListener / next()) for wechaty@2.0.0-alpha.21.
  • Bumped wechaty-puppet-mock to >=2.0.0-alpha.21 and added a ding -> dong roundtrip test alongside the scan smoke test in tests/wechaty-puppet-mock.test.ts.
  • Removed wechaty-puppet-neo from package.json and temporarily skipped tests/wechaty-puppet-neo.test.ts until wechaty-puppet-neo supports wechaty-puppet@2.x.
  • Updated test:unit:deno FFI permissions to node_modules/@lmdb.

Verification

  • npm test (lint:biome, lint:ts, lint:md, test:smoke): 2 passed, 0 failed, 1 skipped
  • npm run test:unit:deno: 2 passed, 0 failed, 1 ignored
  • npm run build && npm run clean: passed

Note

Medium Risk
Starter examples and CI no longer wire Puppet Neo, and the Neo integration test is disabled until a 2.x-compatible release—npm start behavior may differ from documented Neo-first setup until that dependency returns.

Overview
Migrates the getting-started repo from Wechaty 1-style WechatyBuilder / .on() / .once() to Wechaty 2 new Wechaty(...) / Wechaty.singleton() with WinterTC EventTarget handlers (addEventListener, bot.next()). Example ding-dong bots and the minimal chatbot sample are updated accordingly; explicit PuppetNeo imports and puppet type hacks are removed from those examples.

Dependencies and tests: wechaty-puppet-neo is dropped from package.json, wechaty-puppet-mock is bumped to >=2.0.0-alpha.21, mock smoke tests are split into scan and ding → dong cases, and the Neo smoke test is skipped until Neo supports wechaty-puppet@2.x. The Deno unit script’s FFI allowlist moves from Neo native paths to node_modules/@lmdb.

Docs (README and Cloud Shell tutorial) now describe new Wechaty(...) instead of WechatyBuilder, matching the new example style.

Reviewed by Cursor Bugbot for commit da27c1b. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T20:35:15.102055Z da27c1b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor

cursor Bot commented Nov 27, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: d5fbf06c-d16d-4172-bcf7-d78454a16a9d)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da27c1bee9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/ding-dong-bot.ts
Comment on lines +67 to 69
const bot = new Wechaty({
name: 'ding-dong-bot',
// wechaty-puppet-neo@0.1.1 still bundles wechaty-puppet@1.x types
puppet: new PuppetNeo() as unknown as Exclude<NonNullable<Parameters<typeof WechatyBuilder.build>[0]>['puppet'], string | undefined>,
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Supply a compatible puppet for the default starter

For a fresh checkout following the documented npm install / npm start flow without WECHATY_PUPPET, removing the explicit puppet does not select a compatible replacement for Neo. Wechaty resolves an omitted puppet through its system configuration, whose default is wechaty-puppet-wechat4u, not Neo. This silently changes the starter's backend while its header, README, and tutorial still promise Neo's QR-code login flow; the README's explicit Neo example also imports the dependency removed in this commit. Configure a supported Wechaty 2 puppet and update the installation and login instructions together, rather than leaving the main entry point dependent on an undocumented fallback. The same omission affects examples/basic/ding-dong-bot.ts.

AGENTS.md reference: AGENTS.md:L15-L15

Useful? React with 👍 / 👎.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants