fix: preserve NUL characters in persisted messages

Store message text as UTF-8 bytes and migrate existing rows without loss.
Cover HTTP round trips, restart persistence, Unicode limits and idempotent retries.
Adapt direct database tools to the binary storage format.

(cherry picked from commit 386276532730b8758298080b49db63738ca300a4)
This commit is contained in:
Самохвалов Андрей Ремович
2026-11-07 09:53:49 +03:00
parent 9e18e2f07c
commit a46a04b866
5 changed files with 166 additions and 4 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ class IdempotencyTests(unittest.TestCase):
with psycopg.connect(URL) as conn:
count = conn.execute(
"SELECT count(*) FROM messages WHERE chat_id=%s AND sender_id=%s AND text=%s",
(chat["id"], alice["id"], "same body"),
(chat["id"], alice["id"], b"same body"),
).fetchone()[0]
self.assertEqual(count, 1)