Skip to content

refactor(api): type messages cleanup stats with MessagesCleanStatsDict TypedDict#34527

Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom
YB0y:refactor/typed-dict-messages-clean-stats
Apr 3, 2026
Merged

refactor(api): type messages cleanup stats with MessagesCleanStatsDict TypedDict#34527
asukaminato0721 merged 1 commit intolanggenius:mainfrom
YB0y:refactor/typed-dict-messages-clean-stats

Conversation

@YB0y
Copy link
Copy Markdown
Contributor

@YB0y YB0y commented Apr 3, 2026

Summary

  • Add MessagesCleanStatsDict TypedDict with keys batches, total_messages, filtered_messages, total_deleted
  • Annotate return types of run and _clean_messages_by_time_range, and the local stats variable

Why this change

Both methods return a stats dict with 4 fixed integer keys but were typed as dict[str, int]. The TypedDict makes the statistics contract explicit so callers and tests can rely on the key names.

Changes

  • services/retention/conversation/messages_clean_service.py: Define MessagesCleanStatsDict, update 2 method return types and 1 local variable annotation

Test plan

  • ruff check passes

Part of #32863 (services/retention/conversation/messages_clean_service.py)

@YB0y YB0y requested a review from QuantumGhost as a code owner April 3, 2026 12:08
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. refactor labels Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

Pyrefly Diff

No changes detected.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 3, 2026
@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 3, 2026
Merged via the queue into langgenius:main with commit 8a398f3 Apr 3, 2026
27 checks passed
@YB0y YB0y deleted the refactor/typed-dict-messages-clean-stats branch April 8, 2026 13:35
HanqingZ pushed a commit to HanqingZ/dify that referenced this pull request Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants