Skip to content

fix(weixin): reject nonzero send ret#211

Open
louiseboo wants to merge 1 commit into
EverMind-AI:mainfrom
louiseboo:fix/wechat-send-ret-forkbase
Open

fix(weixin): reject nonzero send ret#211
louiseboo wants to merge 1 commit into
EverMind-AI:mainfrom
louiseboo:fix/wechat-send-ret-forkbase

Conversation

@louiseboo

Copy link
Copy Markdown

Summary

  • Treat a non-zero iLink ret as a failed WeChat text send even when errcode is zero.
  • Include ret, errcode, and the server message in the raised error.
  • Add a regression test for the observed sanitized response {ret: -2, errcode: 0, errmsg: "prepare failed"}.

Fixes #210

Why

_send_text() only checked errcode. iLink can reject message preparation with a non-zero ret and errcode=0, causing Raven callers to report a false successful delivery. _poll_once() already treats either field as authoritative failure status.

Verification

  • Red: the new regression test failed with DID NOT RAISE before the implementation change.
  • Green: uv run pytest tests/test_channels_weixin.py::test_send_text_rejects_nonzero_ret_even_when_errcode_is_zero -q → 1 passed.
  • Relevant suite: uv run pytest tests/test_channels_weixin.py tests/test_channels_manager.py tests/test_channels_outlet.py -q → 71 passed.
  • uv run ruff check raven/channels/adapters/weixin/channel.py tests/test_channels_weixin.py → clean.
  • uv run ruff format --check raven/channels/adapters/weixin/channel.py tests/test_channels_weixin.py → clean.

Risk

Low. The success path (ret=0, errcode=0, or absent zero-default fields) is unchanged. The only behavior change is that a server-declared failure now propagates to the caller instead of being silently treated as success.

Rollback

Revert commit 2d8cd2f; no data migration or configuration change is involved.

Privacy

The issue and test use sanitized identifiers and content. No user tokens, chat IDs, local paths, or private messages are included.

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.

WeChat send silently succeeds when iLink returns non-zero ret with errcode=0

1 participant