docs(pairing): address reviewer comments — comments, error msg, __all__ test

- Clarify SystemExit message for missing/null allowFrom (manager.py)
- Document why Feishu passes content="" for unauthorized DMs
- Document exact-match semantics in BaseChannel.is_allowed()
- Document negligible collision probability in generate_code()
- Add test_all_exports_are_importable for nanobot.pairing.__all__
This commit is contained in:
chengyongru
2026-05-15 15:46:44 +08:00
committed by Xubin Ren
parent ac9a2d0c25
commit 199a1bb8fa
5 changed files with 15 additions and 1 deletions
+2
View File
@@ -82,6 +82,8 @@ def generate_code(
with _LOCK:
data = _load()
_gc_pending(data)
# Collision probability is negligible (~1e-12 with 20 pending codes),
# so we skip an existence check for simplicity.
raw = "".join(secrets.choice(_ALPHABET) for _ in range(_CODE_LENGTH))
code = f"{raw[:4]}-{raw[4:]}"