fix: order failure pattern timestamps chronologically

(cherry picked from commit 075d55e9cb)
This commit is contained in:
Eneko Ruiz authored and haelyra committed 2026-10-20 17:40:57 -04:00
1 parent 3a26147843
commit c2a28b2963
2 files changed
+22 -2

No files matched your search

+2 -2
View File
@@ -85,7 +85,7 @@ function detectPatterns(skillRuns, options = {}) {
}
const sortedRuns = [...group.runs].sort(
(a, b) => (b.createdAt || '').localeCompare(a.createdAt || '')
(a, b) => (Date.parse(b.createdAt) || 0) - (Date.parse(a.createdAt) || 0)
);
const firstSeen = sortedRuns[sortedRuns.length - 1].createdAt || null;
@@ -112,7 +112,7 @@ function detectPatterns(skillRuns, options = {}) {
// Sort by count descending, then by lastSeen descending
return patterns.sort((a, b) => {
if (b.count !== a.count) return b.count - a.count;
return (b.lastSeen || '').localeCompare(a.lastSeen || '');
return (Date.parse(b.lastSeen) || 0) - (Date.parse(a.lastSeen) || 0);
});
}