Skip to content

fix: hide soft-deleted conversations from console APIs - #40978

Open
csurong wants to merge 2 commits into
langgenius:mainfrom
csurong:fix/hide-soft-deleted-conversations
Open

fix: hide soft-deleted conversations from console APIs#40978
csurong wants to merge 2 commits into
langgenius:mainfrom
csurong:fix/hide-soft-deleted-conversations

Conversation

@csurong

@csurong csurong commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • exclude soft-deleted conversations from console conversation detail lookups
  • prevent message history lookups from returning soft-deleted conversations
  • add regression coverage for both console endpoints

Fixes #40976

Screenshots

Not applicable. This is a backend-only change.

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and vp staged (frontend) to appease the lint gods

Tests

  • uv run --project api pytest -q api/tests/unit_tests/controllers/console/app/test_conversation_api.py api/tests/unit_tests/controllers/console/app/test_message_api.py
  • uv run --project api ruff check api/controllers/console/app/conversation.py api/controllers/console/app/message.py api/tests/unit_tests/controllers/console/app/test_conversation_api.py api/tests/unit_tests/controllers/console/app/test_message_api.py
  • uv run --project api ruff format --check api/controllers/console/app/conversation.py api/controllers/console/app/message.py api/tests/unit_tests/controllers/console/app/test_conversation_api.py api/tests/unit_tests/controllers/console/app/test_message_api.py

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 19, 2026
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-08-20 02:14:00.777494061 +0000
+++ /tmp/pyrefly_pr.txt	2026-08-20 02:13:45.913384413 +0000
@@ -3375,13 +3375,13 @@
 ERROR Cannot index into `object` [bad-index]
    --> tests/unit_tests/controllers/console/app/test_audio.py:137:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_message_api.py:115:26
+   --> tests/unit_tests/controllers/console/app/test_message_api.py:127:26
 ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_message_api.py:116:23
+   --> tests/unit_tests/controllers/console/app/test_message_api.py:128:23
 ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._get_message_detail` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_message_api.py:138:19
+   --> tests/unit_tests/controllers/console/app/test_message_api.py:150:19
 ERROR Argument `Literal['550e8400-e29b-41d4-a716-446655440000']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_detail` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_message_api.py:139:20
+   --> tests/unit_tests/controllers/console/app/test_message_api.py:151:20
 ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
   --> tests/unit_tests/controllers/console/app/test_model_config_api.py:89:51
 ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 59.72% 59.73% +0.00%
Strict coverage 59.30% 59.31% +0.00%
Typed symbols 39,770 39,776 +6
Untyped symbols 27,011 27,011 0
Modules 3175 3175 0

@41tair

41tair commented Aug 20, 2026

Copy link
Copy Markdown
Member

There are same issues in https://github.com/langgenius/dify/blob/main/api/controllers/console/app/message.py#L539 ? Could you address it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Soft-deleted conversations remain accessible through console APIs

2 participants