fix(feishu): correct identity model docs and prefer tenant-scoped user_id

Feishu's open_id is app-scoped (same user gets different open_ids per
bot app), not a canonical identity. Functionally correct for single-bot
mode but semantically misleading.

- Add comprehensive Feishu identity model documentation to module docstring
- Prefer user_id (tenant-scoped) over open_id (app-scoped) in
  _resolve_sender_profile when both are available
- Document bot_open_id usage for @mention matching
- Update user_id_alt comment in SessionSource to be platform-generic

Ref: closes analysis from PR #8388 (closed as over-scoped)
This commit is contained in:
Teknium
2026-04-13 03:30:38 -07:00
committed by Teknium
parent c9c6182839
commit 9bd1518425
3 changed files with 52 additions and 4 deletions

View File

@@ -1537,7 +1537,7 @@ class TestAdapterBehavior(unittest.TestCase):
adapter._dispatch_inbound_event.assert_awaited_once()
event = adapter._dispatch_inbound_event.await_args.args[0]
self.assertEqual(event.message_type, MessageType.TEXT)
self.assertEqual(event.source.user_id, "ou_user")
self.assertEqual(event.source.user_id, "u_user") # tenant-scoped user_id preferred over app-scoped open_id
self.assertEqual(event.source.user_name, "张三")
self.assertEqual(event.source.user_id_alt, "on_union")
self.assertEqual(event.source.chat_name, "Feishu DM")