git » sdk » commit dba941d

More debug storage

author Stephen Paul Weber
2026-09-16 14:14:46 UTC
committer Stephen Paul Weber
2026-09-16 14:14:46 UTC
parent c9e959e15d8e3e5d380ede990e8eb2f6845f6de1

More debug storage

borogove/Chat.hx +4 -0
borogove/ChatMessage.hx +1 -1
borogove/Client.hx +1 -0
borogove/MessageSync.hx +11 -3
borogove/Push.hx +1 -0

diff --git a/borogove/Chat.hx b/borogove/Chat.hx
index bb8e97b..eccaf65 100644
--- a/borogove/Chat.hx
+++ b/borogove/Chat.hx
@@ -1231,6 +1231,7 @@ class DirectChat extends Chat {
 			message.sortId = client.nextSortId();
 			message.debug = {
 				source: "live",
+				path: "DirectChat#prepareIncomingMessage",
 				sortId: { method: "between", lower: lower, upper: null },
 			};
 		}
@@ -2270,6 +2271,7 @@ class Channel extends Chat {
 				sortId = message.sortId = FractionalIndexing.between(lower, null, FractionalIndexing.BASE_95_DIGITS);
 				message.debug = {
 					source: "live",
+					path: "Channel#prepareIncomingMessage sortId != null && message.type == MessageChannel",
 					sortId: { method: "between", lower: lower, upper: null },
 				};
 			} else {
@@ -2280,6 +2282,7 @@ class Channel extends Chat {
 				message.sortId = client.nextSortId();
 				message.debug = {
 					source: "live",
+					path: "Channel#prepareIncomingMessage else (probably PM?)",
 					sortId: { method: "between", lower: lower, upper: null },
 				};
 			}
@@ -2308,6 +2311,7 @@ class Channel extends Chat {
 			sortId = message.sortId = FractionalIndexing.between(lower, null, FractionalIndexing.BASE_95_DIGITS);
 			message.debug = {
 				source: "outgoing",
+				path: "Channel#prepareOutgoingMessage",
 				sortId: { method: "between", lower: lower, upper: null },
 			};
 		}
diff --git a/borogove/ChatMessage.hx b/borogove/ChatMessage.hx
index 04bf34d..3e9bde4 100644
--- a/borogove/ChatMessage.hx
+++ b/borogove/ChatMessage.hx
@@ -227,7 +227,7 @@ class ChatMessage {
 	public final attachments: ReadOnlyArray<ChatAttachment>;
 
 	@:allow(borogove)
-	private final debug: Null<Dynamic>;
+	private var debug: Null<Dynamic>;
 
 	/**
 		Map of reactions to this message
diff --git a/borogove/Client.hx b/borogove/Client.hx
index 1005db5..7496205 100644
--- a/borogove/Client.hx
+++ b/borogove/Client.hx
@@ -1999,6 +1999,7 @@ class Client extends EventEmitter {
 			builder.sortId = nextSortId();
 			builder.debug = {
 				source: "outgoing",
+				path: "Client#storeMessageBuilder",
 				sortId: { method: "between", lower: lower, upper: null },
 			};
 		}
diff --git a/borogove/MessageSync.hx b/borogove/MessageSync.hx
index 46c013a..32ea58c 100644
--- a/borogove/MessageSync.hx
+++ b/borogove/MessageSync.hx
@@ -31,6 +31,7 @@ class MessageSync {
 	private var handler:MessageListHandler;
 	private var contextHandler:(ChatMessageBuilder, Stanza)->ChatMessageBuilder = (b,_)->b;
 	private var errorHandler:(Stanza)->Void;
+	private final startSortA:Null<String>;
 	private var sortA:Null<String>;
 	private final sortB:Null<String>;
 	public var lastPage(default, null):ResultSetPageResult;
@@ -43,6 +44,7 @@ class MessageSync {
 		this.stream = stream;
 		this.filter = Reflect.copy(filter);
 		this.sortA = sortA;
+		this.startSortA = sortA;
 		this.sortB = sortB;
 		this.serviceJID = serviceJID != null ? serviceJID : client.accountId();
 	}
@@ -122,7 +124,9 @@ class MessageSync {
 						builder.debug = {
 							source: "mam",
 							serviceJID: serviceJID,
-							sortId: { method: "between", lower: sortLower, upper: sortB },
+							filter: filter,
+							path: "decrypted",
+							sortId: { method: "between", startSortA: startSortA, lower: sortLower, upper: sortB },
 						};
 						builder.serverId = result.attr.get("id");
 						builder.serverIdBy = serviceJID;
@@ -137,7 +141,9 @@ class MessageSync {
 							builder.debug = {
 								source: "mam",
 								serviceJID: serviceJID,
-								sortId: { method: "between", lower: sortLower, upper: sortB },
+								filter: filter,
+								path: "decryption failed",
+								sortId: { method: "between", startSortA: startSortA, lower: sortLower, upper: sortB },
 							};
 							builder.serverId = result.attr.get("id");
 							builder.serverIdBy = serviceJID;
@@ -158,7 +164,9 @@ class MessageSync {
 				builder.debug = {
 					source: "mam",
 					serviceJID: serviceJID,
-					sortId: { method: "between", lower: sortLower, upper: sortB },
+					filter: filter,
+					path: "unencrypted",
+					sortId: { method: "between", startSortA: startSortA, lower: sortLower, upper: sortB },
 				};
 				builder.serverId = result.attr.get("id");
 				builder.serverIdBy = serviceJID;
diff --git a/borogove/Push.hx b/borogove/Push.hx
index 16cf4ef..d3fec48 100644
--- a/borogove/Push.hx
+++ b/borogove/Push.hx
@@ -56,6 +56,7 @@ class Push {
 							return builder;
 						}
 					);
+					toStore.debug = { source: "push", sortId: { method: "between", lower: lower, upper: null } };
 					persistence.storeMessages(message.account(), [toStore]);
 				});
 				return Notification.fromChatMessage(message);