fix: align with observed signal-cli-rest-api behaviour

Real-frame parsing test, README notes from live verification (manual mode
needs a build newer than 0.101, sync before listing groups, 30-day phone
rule, observed errors and long texts), compose image pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vincent BourdonandClaude Opus 5.5 committed 2026-11-20 18:33:10 +01:00
1 parent 136e431917
commit 788dd0b968
3 files changed
+41 -4

No files matched your search

+23
View File
@@ -101,3 +101,26 @@ func TestReplyTargets(t *testing.T) {
}
}
}
// Real frames captured from signal-cli-rest-api (build 1794354199-ci,
// MODE=json-rpc-native, JSON_RPC_RECEIVE_MODE=manual), anonymised.
const (
realDirect = `{"envelope":{"source":"+33600000001","sourceNumber":"+33600000001","sourceUuid":"b26a99ac-0000-4c6a-84da-000000000001","sourceName":"Alice","sourceDevice":1,"timestamp":1795187556780,"serverReceivedTimestamp":1795187558661,"serverDeliveredTimestamp":1795187610311,"dataMessage":{"timestamp":1795187556780,"message":"sbtest direct","expiresInSeconds":0,"isExpirationUpdate":false,"viewOnce":false,"isEndSession":false,"isProfileKeyUpdate":false,"hasProfileKey":true}},"account":"+33600000000"}`
realGroup = `{"envelope":{"source":"+33600000001","sourceNumber":"+33600000001","sourceUuid":"b26a99ac-0000-4c6a-84da-000000000001","sourceName":"Alice","sourceDevice":1,"timestamp":1795187575919,"serverReceivedTimestamp":1795187577893,"serverDeliveredTimestamp":1795187610312,"dataMessage":{"timestamp":1795187575919,"message":"sbtest groupe 🎬 accentué","expiresInSeconds":0,"isExpirationUpdate":false,"viewOnce":false,"isEndSession":false,"isProfileKeyUpdate":false,"hasProfileKey":true,"groupInfo":{"groupId":"aXdGf/8kFRszxYAbAvV238fSrZ115FoB62/5/fYgtmo=","groupName":"Test","revision":2,"type":"DELIVER"}}},"account":"+33600000000"}`
realReaction = `{"envelope":{"source":"+33600000001","sourceNumber":"+33600000001","sourceUuid":"b26a99ac-0000-4c6a-84da-000000000001","sourceName":"Alice","sourceDevice":1,"timestamp":1795187612623,"dataMessage":{"timestamp":1795187612623,"message":null,"expiresInSeconds":0,"viewOnce":false,"hasProfileKey":false,"reaction":{"emoji":"👍🏻","targetAuthor":"+33600000001","targetSentTimestamp":1795187575919,"isRemove":false},"groupInfo":{"groupId":"aXdGf/8kFRszxYAbAvV238fSrZ115FoB62/5/fYgtmo=","groupName":"Test","revision":2,"type":"DELIVER"}}},"account":"+33600000000"}`
)
func TestParseRealFrames(t *testing.T) {
d, ok := parseEnvelope([]byte(realDirect), self)
if !ok || d.From != "+33600000001" || d.GroupID != "" || d.Text != "sbtest direct" {
t.Fatalf("direct: %+v, %v", d, ok)
}
g, ok := parseEnvelope([]byte(realGroup), self)
// Same id as GET /v1/groups returned for this group.
if !ok || g.GroupID != "group.YVhkR2YvOGtGUnN6eFlBYkF2VjIzOGZTcloxMTVGb0I2Mi81L2ZZZ3Rtbz0=" || g.Text != "sbtest groupe 🎬 accentué" {
t.Fatalf("group: %+v, %v", g, ok)
}
if _, ok := parseEnvelope([]byte(realReaction), self); ok {
t.Fatal("reaction accepted")
}
}