fix(weixin): reject nonzero send ret#211
Open
louiseboo wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
retas a failed WeChat text send even whenerrcodeis zero.ret,errcode, and the server message in the raised error.{ret: -2, errcode: 0, errmsg: "prepare failed"}.Fixes #210
Why
_send_text()only checkederrcode. iLink can reject message preparation with a non-zeroretanderrcode=0, causing Raven callers to report a false successful delivery._poll_once()already treats either field as authoritative failure status.Verification
DID NOT RAISEbefore the implementation change.uv run pytest tests/test_channels_weixin.py::test_send_text_rejects_nonzero_ret_even_when_errcode_is_zero -q→ 1 passed.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.