Skip to content

test(outbound): pin chunked thread-reply behavior (issue #5) - #17

Open
Xuxchloris wants to merge 1 commit into
larksuite:mainfrom
Xuxchloris:fix/thread-reply-chunk-tests
Open

test(outbound): pin chunked thread-reply behavior (issue #5)#17
Xuxchloris wants to merge 1 commit into
larksuite:mainfrom
Xuxchloris:fix/thread-reply-chunk-tests

Conversation

@Xuxchloris

Copy link
Copy Markdown

References #5.

Context

The root cause described in #5 (a long threaded reply loses reply_to on chunks after the first, so the tail leaks out of the topic thread into the main timeline) is already fixed in mainOutboundSender.send() keeps effective_reply_to on every chunk when reply_in_thread=True:

if reply_in_thread is True:
    effective_reply_to = reply_to
else:
    effective_reply_to = reply_to if idx == 0 else None

What was missing is regression coverage pinning that behavior (and the legacy flat-reply behavior), which is why the issue stayed open.

Change

Add two tests to lark_channel/channel/tests/test_sender.py:

  • test_thread_reply_every_chunk_replies_to_root: with reply_in_thread=True, a 25-char text chunked into 3 parts produces 3 reply_message calls, all to the same root with reply_in_thread=True — no chunk leaks to the main timeline.
  • test_flat_reply_only_first_chunk_quotes_parent: legacy flat-reply contract stays intact — only the first chunk quote-replies, the rest are fresh create_message calls.

Verification

  • python -m pytest lark_channel/channel/tests/test_sender.py — 12/12 pass.

The fix for larksuite#5 (every chunk of a long reply must reply to the root when
reply_in_thread=True, otherwise chunks after the first leak out of the
thread) is already in main but had no regression coverage. Add two tests
to test_sender.py:

- thread reply: all 3 chunks go through reply_message to the root with
  reply_in_thread=True;
- flat reply: only the first chunk quote-replies; the rest are fresh
  creates (legacy behavior preserved).

12/12 tests pass in the sender suite.
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.

1 participant