fix(qa-lab): tighten telegram canary matching

This commit is contained in:
Ayaan Zaidi
2026-04-10 21:34:39 +05:30
parent ecb3e0a62d
commit 9d3583bc2f
2 changed files with 25 additions and 3 deletions

View File

@@ -166,6 +166,29 @@ describe("telegram live qa runtime", () => {
).toBe("match");
});
it("classifies threaded blank sut replies as matches", () => {
expect(
__testing.classifyCanaryReply({
groupId: "-100123",
sutBotId: 88,
driverMessageId: 55,
message: {
updateId: 3,
messageId: 11,
chatId: -100123,
senderId: 88,
senderIsBot: true,
senderUsername: "sut_bot",
text: "",
replyToMessageId: 55,
timestamp: 1_700_000_002_000,
inlineButtons: [],
mediaKinds: ["photo"],
},
}),
).toBe("match");
});
it("redacts observed message content by default in artifacts", () => {
expect(
__testing.buildObservedMessagesArtifact({

View File

@@ -325,7 +325,7 @@ async function flushTelegramUpdates(token: string) {
}
offset = (updates.at(-1)?.update_id ?? offset) + 1;
}
return offset;
throw new Error("timed out after 15000ms draining Telegram updates");
}
async function sendGroupMessage(token: string, groupId: string, text: string) {
@@ -471,8 +471,7 @@ function classifyCanaryReply(params: {
}) {
if (
params.message.chatId !== Number(params.groupId) ||
params.message.senderId !== params.sutBotId ||
!params.message.text.trim()
params.message.senderId !== params.sutBotId
) {
return "ignore" as const;
}