fix(telemetry): 3 bugs — Slack Block Kit text key, cluster reopen clears resolution, affectedInstallIds uses correct ID

This commit is contained in:
saravanakumardb1 2026-02-17 11:22:13 -08:00
parent ae2dae4413
commit 08b9642408

View File

@ -116,7 +116,7 @@ async function sendClusterAlert(
type: 'section',
text: {
type: 'mrkdwn',
value: [
text: [
`*Telemetry Error Cluster Escalated*`,
`*Event:* ${cluster.module}/${cluster.eventName}`,
`*Platform:* ${cluster.platform} (${cluster.channel})`,
@ -424,8 +424,12 @@ async function updateClusterForEvent(event: TelemetryEventDoc): Promise<void> {
if (uid && event.userId && !existing.affectedUserIds.includes(uid)) {
if (existing.affectedUserIds.length < 100) existing.affectedUserIds.push(uid);
}
if (uid && event.anonymousInstallId && !existing.affectedInstallIds.includes(uid)) {
if (existing.affectedInstallIds.length < 100) existing.affectedInstallIds.push(uid);
if (
event.anonymousInstallId &&
!existing.affectedInstallIds.includes(event.anonymousInstallId)
) {
if (existing.affectedInstallIds.length < 100)
existing.affectedInstallIds.push(event.anonymousInstallId);
}
if (!existing.affectedOsFamilies.includes(event.osFamily)) {
existing.affectedOsFamilies.push(event.osFamily);
@ -861,6 +865,10 @@ export async function telemetryRoutes(app: FastifyInstance) {
if (parsed.data.status === 'resolved' || parsed.data.status === 'ignored') {
updates.resolvedBy = req.jwtPayload?.sub ?? 'unknown';
updates.resolvedAt = new Date().toISOString();
} else if (parsed.data.status === 'open') {
// Clear resolution metadata when reopening
updates.resolvedBy = undefined;
updates.resolvedAt = undefined;
}
const updated = await repo.updateCluster(id, pk, updates);