From 5c7250ff718f859b08f29f3f7aeb9564043dd090 Mon Sep 17 00:00:00 2001 From: "t3-code[bot]" <269035359+t3-code[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 07:29:57 +0000 Subject: [PATCH 1/2] test(web): remove duplicate sidebar ordering tests --- apps/web/src/components/Sidebar.logic.test.ts | 100 ------------------ 1 file changed, 100 deletions(-) diff --git a/apps/web/src/components/Sidebar.logic.test.ts b/apps/web/src/components/Sidebar.logic.test.ts index fede3c183448..86cee77446f1 100644 --- a/apps/web/src/components/Sidebar.logic.test.ts +++ b/apps/web/src/components/Sidebar.logic.test.ts @@ -34,7 +34,6 @@ import { sortLogicalProjectsForSidebar, resolveSidebarDropTarget, pinOrderKeyBetween, - planPinnedReorder, planSidebarThreadDrop, sidebarMarkerId, sidebarListItemId, @@ -958,59 +957,6 @@ describe("reduceSidebarProjectScopeMenuState", () => { }); }); -describe("sortThreadsForSidebar", () => { - const sortable = (input: { id: string; createdAt: string }) => ({ - id: input.id, - createdAt: input.createdAt, - }); - - it("orders by creation time, newest first, ignoring activity", () => { - const sorted = sortThreadsForSidebar([ - sortable({ id: "oldest", createdAt: "2026-03-09T08:00:00.000Z" }), - sortable({ id: "newest", createdAt: "2026-03-09T12:00:00.000Z" }), - sortable({ id: "middle", createdAt: "2026-03-09T10:00:00.000Z" }), - ]); - - expect(sorted.map((thread) => thread.id)).toEqual(["newest", "middle", "oldest"]); - }); - - it("breaks creation-time ties by id so the order is stable", () => { - const sorted = sortThreadsForSidebar([ - sortable({ id: "b", createdAt: "2026-03-09T10:00:00.000Z" }), - sortable({ id: "a", createdAt: "2026-03-09T10:00:00.000Z" }), - ]); - - expect(sorted.map((thread) => thread.id)).toEqual(["a", "b"]); - }); - - it("surfaces an un-settled thread at the top via its re-entry stamp", () => { - const sorted = sortThreadsForSidebar([ - { - id: "old-unsettled", - createdAt: "2026-03-09T08:00:00.000Z", - unsettledAt: "2026-03-09T13:00:00.000Z", - }, - sortable({ id: "newest", createdAt: "2026-03-09T12:00:00.000Z" }), - sortable({ id: "middle", createdAt: "2026-03-09T10:00:00.000Z" }), - ]); - - expect(sorted.map((thread) => thread.id)).toEqual(["old-unsettled", "newest", "middle"]); - }); - - it("ignores a re-entry stamp older than the thread's creation", () => { - const sorted = sortThreadsForSidebar([ - { - id: "stale-stamp", - createdAt: "2026-03-09T10:00:00.000Z", - unsettledAt: "2026-03-09T09:00:00.000Z", - }, - sortable({ id: "newest", createdAt: "2026-03-09T12:00:00.000Z" }), - ]); - - expect(sorted.map((thread) => thread.id)).toEqual(["newest", "stale-stamp"]); - }); -}); - describe("pinOrderKeyBetween", () => { it("produces keys that sort between their bounds", () => { const middle = pinOrderKeyBetween(null, null)!; @@ -1062,52 +1008,6 @@ describe("pinOrderKeyBetween", () => { }); }); -describe("planPinnedReorder", () => { - it("writes only the moved thread when neighbors are keyed", () => { - const assignments = planPinnedReorder({ - orderedIds: ["a", "c", "b"], - keysById: new Map([ - ["a", "f"], - ["b", "m"], - ["c", "t"], - ]), - movedId: "c", - }); - expect(assignments).toHaveLength(1); - expect(assignments[0]!.id).toBe("c"); - expect(assignments[0]!.orderKey > "f" && assignments[0]!.orderKey < "m").toBe(true); - }); - - it("treats list edges as open bounds", () => { - const assignments = planPinnedReorder({ - orderedIds: ["b", "a"], - keysById: new Map([ - ["a", "m"], - ["b", null], - ]), - movedId: "b", - }); - expect(assignments).toHaveLength(1); - expect(assignments[0]!.orderKey < "m").toBe(true); - }); - - it("materializes keys for the whole section when a neighbor is keyless", () => { - const assignments = planPinnedReorder({ - orderedIds: ["b", "a", "c"], - keysById: new Map([ - ["a", null], - ["b", "m"], - ["c", null], - ]), - movedId: "b", - }); - expect(assignments.map((entry) => entry.id)).toEqual(["b", "a", "c"]); - const keys = assignments.map((entry) => entry.orderKey); - expect([...keys].sort()).toEqual(keys); - expect(new Set(keys).size).toBe(keys.length); - }); -}); - describe("resolveSidebarDropTarget", () => { const thread = (key: string, section: SidebarSection): SidebarListItem => ({ kind: "thread", From a5a653065fb0ec5ffc3de2678659d57ce0e658ed Mon Sep 17 00:00:00 2001 From: "t3-code[bot]" <269035359+t3-code[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 07:32:51 +0000 Subject: [PATCH 2/2] fix(web): drop unused sidebar re-export --- apps/web/src/components/Sidebar.logic.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/components/Sidebar.logic.ts b/apps/web/src/components/Sidebar.logic.ts index 2796b2f7f885..05664206105b 100644 --- a/apps/web/src/components/Sidebar.logic.ts +++ b/apps/web/src/components/Sidebar.logic.ts @@ -872,7 +872,7 @@ export { sortActiveThreadsByOrderKey as sortThreadsForSidebar } from "@t3tools/c // Pinned-reorder key math and the keyed sort live in client-runtime // (state/thread-sort) so web and mobile compute identical pinned orders. -export { pinOrderKeyBetween, planPinnedReorder } from "@t3tools/client-runtime/state/thread-sort"; +export { pinOrderKeyBetween } from "@t3tools/client-runtime/state/thread-sort"; export { sortPinnedThreadsByOrderKey as sortPinnedThreadsForSidebar } from "@t3tools/client-runtime/state/thread-sort"; const EMPTY_CONTENT_MATCH_KEYS: ReadonlySet = new Set();