fix: align sender paths with plan, remove QQ-as-universal fallback

- Remove get_bot_account("qq") fallback from all 4 sender paths
  (plan L108/L208/L449: unknown platform = no account, never substitute QQ)
- Sender paths now error immediately if platform bot account is not configured
- Add detailed comments on filter_bot legacy fallback explaining why
  global user_id match is needed (plan contingency L528 insufficient for
  platform-tagged legacy rows like telegram+qq_account)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
晴猫
2026-03-15 08:25:56 +09:00
parent d3420bd1b3
commit be047aa2c3
5 changed files with 11 additions and 16 deletions

View File

@@ -176,7 +176,10 @@ def find_messages(
)
)
# 兼容旧数据:历史机器人消息在所有平台上都使用 QQ 账号进行存储
# 兼容旧数据:历史机器人消息在所有平台上都使用 QQ 账号作为 user_id 存储
# 例如旧 Telegram bot 消息的 (platform="telegram", user_id=qq_account)。
# plan 建议的 ("", qq_account) pair 只能覆盖空 platform 行,无法覆盖这种情况。
# 因此这里使用全局 user_id 匹配作为临时方案,待 DB 迁移后应移除此兜底。
if qq_fallback := get_bot_account("qq"):
exclusion_conditions.append(Messages.user_id == qq_fallback)