Исправить замечания ревью кода: убрать повтор в AppendOnce за счёт запаса у чистки ключей, вынести MessagePayload и SameContent, принять X-Request-Id от балансировщика, упростить фоновые задачи сервера, сократить комментарии

This commit is contained in:
2026-11-04 12:19:49 +03:00
parent c9d0f73221
commit 7fbd781ca3
25 changed files with 207 additions and 247 deletions
+13
View File
@@ -45,3 +45,16 @@ func TestNewMessageKeepsSurroundingWhitespace(t *testing.T) {
t.Fatalf("text must be stored verbatim, got %q", m.Text)
}
}
func TestSameContentComparesWhatTheSenderWrote(t *testing.T) {
chatID, alice := ident.New(), ident.New()
first, _ := chat.NewMessage(ident.New(), chatID, alice, "привет")
retry, _ := chat.NewMessage(ident.New(), chatID, alice, "привет")
other, _ := chat.NewMessage(ident.New(), chatID, alice, "привет!")
if !first.SameContent(retry) {
t.Fatal("messages with the same text must have the same content")
}
if first.SameContent(other) {
t.Fatal("messages with different text must differ")
}
}