fix(KB-186): add ID-based tiebreaker to sort comparators for stable ordering

- Add numeric ID tiebreaker to TaskStore.listTasks() when createdAt timestamps match
- Add same tiebreaker to InlineCreateCard and TaskDetailModal dependency dropdown sorts
- Add store-sort integration test verifying ascending ID order with identical timestamps
- Add InlineCreateCard tests for identical-timestamp dropdown ordering and search filtering
- Add TaskDetailModal test for identical-timestamp dependency dropdown ordering
This commit is contained in:
Dustin Byrne
2026-03-28 19:40:17 -04:00
parent b5717562f8
commit 478ba72044
6 changed files with 132 additions and 3 deletions

View File

@@ -204,7 +204,13 @@ export function InlineCreateCard({ tasks, onSubmit, onCancel, addToast }: Inline
(t.description && t.description.toLowerCase().includes(term))
)
: [...tasks]
).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
).sort((a, b) => {
const cmp = b.createdAt.localeCompare(a.createdAt);
if (cmp !== 0) return cmp;
const aNum = parseInt(a.id.slice(a.id.lastIndexOf("-") + 1), 10) || 0;
const bNum = parseInt(b.id.slice(b.id.lastIndexOf("-") + 1), 10) || 0;
return bNum - aNum;
});
return (
<div className="dep-dropdown" onMouseDown={(e) => e.preventDefault()}>
<input