Skip to content

feat: add skip_truncate to channel delete - #236

Merged
mogita merged 3 commits into
masterfrom
feat/cha-5241-skip-truncate
Sep 10, 2026
Merged

feat: add skip_truncate to channel delete#236
mogita merged 3 commits into
masterfrom
feat/cha-5241-skip-truncate

Conversation

@mogita

@mogita mogita commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Ticket

CHA-5241

Problem

Soft deleting a channel also truncates it, so a channel recreated with the same id comes back empty and replies quoting older messages fail. The API gained a skip_truncate option that keeps the history, and Channel.delete cannot send it.

Solution

Channel.delete takes skip_truncate: bool = False in the sync and async clients, and adds the query param only when it is set, so existing calls send the same request as before.

Client.delete_channels already forwards **options into the request body, so the batch endpoint needed no code change, only a docs example.

The server owns the rules: skip_truncate is rejected together with a hard delete, and only distinct channels are eligible.

How to verify

  1. pytest stream_chat/tests/test_channel_delete.py passes. The three tests assert the param is absent by default and present when set, sync and async.
  2. make lint passes (black, flake8, mypy).

🤖 Generated with Claude Code

Soft deleting a channel truncates it, so a channel recreated with the same id comes back empty. Channel.delete takes skip_truncate and sends it as a query param when set. Client.delete_channels already forwards options, so the batch endpoint needs no change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The async path had no test for skip_truncate being omitted, so sending it as false would have passed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comment thread stream_chat/base/channel.py Outdated
yaziine
yaziine previously approved these changes Sep 10, 2026
@mogita
mogita merged commit 610523b into master Sep 10, 2026
5 of 10 checks passed
@mogita
mogita deleted the feat/cha-5241-skip-truncate branch September 10, 2026 11:44
@github-actions github-actions Bot mentioned this pull request Sep 10, 2026
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